Mercurial > hg > aimmat
view aim-mat/tools/@signal/ci_simulate.m @ 0:74dedb26614d
Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 12:32:31 +0100 |
parents | |
children | 20ada0af3d7d |
line wrap: on
line source
% method of class @signal % function sig=ci_simulate(signal) % % INPUT VALUES: % sig: @signal % % RETURN VALUE: % sigresult: @signal ` % % (c) 2003, University of Cambridge, Medical Research Council % Stefan Bleeck (stefan@bleeck.de) % http://www.mrc-cbu.cam.ac.uk/cnbh/aimmanual % $Date: 2003/01/20 18:33:51 $ % $Revision: 1.4 $ function sig=ci_simulate(sigorg) % stolen from AMO.m audio_sample_rate=getsr(sigorg); % audio_sample_rate=16000; p.channel_stim_rate=900; p.audio_sample_rate=audio_sample_rate; p.analysis_rate=p.channel_stim_rate; p.num_selected = 10; p.num_bands = 22; p.electrodes=22:-1:1; p=Append_process(p,'FFT_filterbank_proc'); p=Append_process(p,'Power_sum_envelope_proc'); p=Append_process(p,'Reject_smallest_proc'); values=getvalues(sigorg); FTM=Process(p,values); % Parameters for Resynthesis % -------------------------- pre.resynthesis_rate = audio_sample_rate; pre.num_bands = p.num_bands; pre.analysis_rate = p.channel_stim_rate; pre.electrodes=p.electrodes; insertion = 22; % insertion depth in mm cochlength=33; % length of cochlea elecspacing = 0.75; % spacing between electrodes in mm b = 0.3; % space constant in mm % prepare non-overlapping crossover frequencies according to Greenwood % -------------------------------------------------------------------- for i=1:23 %elec_position_base(i)=insertion-elecspacing*(i-1); % position of elec in cochlea from base [mm] crossover_position_base(i)=insertion - (elecspacing*(i-1) - elecspacing*0.5); % position between electrodes from base [mm] end crossover_position_apex=cochlength-crossover_position_base'; % position between electrodes from apex [mm] crossover_freqs_greenwood=Greenwood_x2cf(crossover_position_apex); % corresponding Greenwood frequencies % check if there are frequencies above 1/2 sampling rate, % and remove those bands from FTM, electrodes and crossover freq table toohigh=sum(crossover_freqs_greenwood>0.5*pre.resynthesis_rate); crossover_freqs_greenwood=crossover_freqs_greenwood(1:end-toohigh); % only those < half the sampling rate pre.electrodes=pre.electrodes(1:sum(p.electrodes>toohigh)); FTM=FTM(1:sum(p.electrodes>toohigh),:); num_bands_after=length(pre.electrodes); if pre.num_bands~=num_bands_after msgbox([num2str(pre.num_bands-num_bands_after) ' of the active basal electrodes correspond(s) to frequencies > half the sampling frequency and will be disabled.'],'Disabling electrodes','warn','modal'); end pre.num_bands=num_bands_after; % resynthesize % ------------ %sinusoid % pre.resynthesis_carrier = 'sinus'; % pre.crossover_freqs=crossover_freqs_greenwood; % sinusoids following Greenwood % noise % NOISE pre.resynthesis_carrier = 'noise'; pre.crossover_freqs=crossover_freqs_greenwood; pre = Resynthesis(pre); simul = Resynthesis(pre,FTM); %Windowing and zeropadding to remove clicks w = risewindow(length(simul),0.01*pre.resynthesis_rate)'; %a 10 ms linear rise and fall simul = [zeros(1,10) w.*simul zeros(1,10)]; % return a signal: sig=signal(simul,audio_sample_rate); sig=setname(sig,'Convolution'); return;