annotate aim-mat/modules/bmm/dcgc/gen_dcgc.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % generating function for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 %
tomwalters@0 4 % Toshio Irino and Roy Patterson (2005). "A dynamic, compressive gammachirp auditory filterbank" Revision submitted to IEEE SAP..
tomwalters@0 5 % Implementation in aim-mat by Ralph van Dinther
tomwalters@0 6 % (c) 2011, University of Southampton
bleeck@3 7 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 8 % download of current version is on the soundsoftware site:
bleeck@3 9 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 10 % documentation and everything is on http://www.acousticscale.org
bleeck@3 11
tomwalters@0 12
tomwalters@0 13 function fr=gen_dcgc(sig,options)
tomwalters@0 14
tomwalters@0 15 % Generating the dcgc
tomwalters@0 16
tomwalters@0 17 NumCh = options.nr_channels;
tomwalters@0 18 fre1 = options.lowest_frequency;
tomwalters@0 19 fre2 = options.highest_frequency;
tomwalters@0 20 FRange = [fre1 fre2];
tomwalters@0 21 Frs = FcNch2EqERB(min(FRange),max(FRange),NumCh);
tomwalters@0 22
tomwalters@0 23 sr = getsr(sig);
tomwalters@0 24 GCparam.fs=sr;% Sampling rate (48000)
tomwalters@0 25 GCparam.NumCh=NumCh;% Number of Channels (75)
tomwalters@0 26 GCparam.FRange=FRange;
tomwalters@0 27 GCparam.Ctrl = 'tim';
tomwalters@0 28
tomwalters@0 29 % TCW AIM 2006 - Now defaults to 70 dB, not 40 as before
tomwalters@0 30 if isfield(options, 'gain_ref')
tomwalters@0 31 GCparam.GainRefdB=options.gain_ref;
tomwalters@0 32 else
tomwalters@0 33 GCparam.GainRefdB=70;
tomwalters@0 34 end
tomwalters@0 35
tomwalters@0 36 %% Anticipating the noise pre-excitation stuff I'm going to write...
tomwalters@0 37 % if ~isfield(options, 'pre_excite_with_noise')
tomwalters@0 38 % do_pre_excite=0;
tomwalters@0 39 % else
tomwalters@0 40 % do_pre_excite=options.pre_excite_with_noise;
tomwalters@0 41 % end
tomwalters@0 42 %
tomwalters@0 43 % if ~isfield(options, 'pre_excite_time')
tomwalters@0 44 % pre_excite_time=0.2; % 200ms
tomwalters@0 45 % else
tomwalters@0 46 % pre_excite_time=options.pre_excite_time;
tomwalters@0 47 % end
tomwalters@0 48 %
tomwalters@0 49 % if ~isfield(options, 'pre_excite_level_dB')
tomwalters@0 50 % pre_excite_level_dB=-10;
tomwalters@0 51 % else
tomwalters@0 52 % pre_excite_level_dB=options.pre_excite_level_dB;
tomwalters@0 53 % end
tomwalters@0 54
tomwalters@0 55 NAPparam.cf_afb = [fre1 fre2];
tomwalters@0 56 cf_afb=NAPparam.cf_afb;
tomwalters@0 57 NAPparam.SubBase = 0.5;
tomwalters@0 58
tomwalters@0 59
tomwalters@0 60 sr = getsr(sig);
tomwalters@0 61 Snd = getvalues(sig);
tomwalters@0 62 LenSnd = length(Snd);
tomwalters@0 63
tomwalters@0 64 if (fre2>(0.4.*sr))
tomwalters@0 65 warning('Top filter centre frequency is > 0.4 times the signal samplerate - aliasing effects possible');
tomwalters@0 66 end
tomwalters@0 67
tomwalters@0 68 %%%%% BMM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 69
tomwalters@0 70 [cGCout, pGCout, GCparam, GCresp] = GCFBv205(Snd',GCparam);
tomwalters@0 71 BMM=cGCout;
tomwalters@0 72
tomwalters@0 73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tomwalters@0 74
tomwalters@0 75 fr = frame(BMM);
tomwalters@0 76 fr = setsr(fr,sr);
tomwalters@0 77 fr = setstarttime(fr,getminimumtime(sig));
tomwalters@0 78 fr = setcf(fr,Frs);
tomwalters@0 79
tomwalters@0 80 if ~strcmp(options.do_phase_alignment,'off')
tomwalters@0 81 fr=phasealign(fr,options);
tomwalters@0 82 end
tomwalters@0 83
tomwalters@0 84
tomwalters@0 85