Mercurial > hg > aimc
comparison matlab/bmm/carfac/CARFAC_SAI_hacking.m @ 623:b3118c9ed67f
Turn the AGC coeffs inside out: array of structs instead of a struct of little arrays.
In C++ use a vector<AGC_coeffs> for this; each of 4 stages has an entry; many fewer places
need to do indexing by stage, and this removes the temptation to use little eigen arrays
for the 4 stages.
Also latest version of experimental log-lag SAI hacks.
author | dicklyon@google.com |
---|---|
date | Tue, 21 May 2013 04:24:05 +0000 |
parents | ec3a1c74ec54 |
children |
comparison
equal
deleted
inserted
replaced
611:0fbaf443ec82 | 623:b3118c9ed67f |
---|---|
26 %% | 26 %% |
27 | 27 |
28 dB_list = -40; % -60:20:0 | 28 dB_list = -40; % -60:20:0 |
29 | 29 |
30 wav_fn = 'plan.wav'; | 30 wav_fn = 'plan.wav'; |
31 wav_fn = 'Stiletto44.wav'; | |
32 wav_fn = 'You Can Call Me Al.wav'; | |
31 | 33 |
32 if ~exist(['./', wav_fn], 'file') | 34 if ~exist(['./', wav_fn], 'file') |
33 error('wav file not found') | 35 error('wav file not found') |
34 end | 36 end |
35 | 37 |
36 wav_fn | 38 wav_fn |
37 [file_signal, fs] = wavread(wav_fn); | 39 [file_signal, fs] = wavread(wav_fn); |
38 | 40 |
39 if fs == 44100 | 41 % if fs == 44100 |
40 file_signal = (file_signal(1:2:end-1, :) + file_signal(2:2:end, :)) / 2; | 42 % file_signal = (file_signal(1:2:end-1, :) + file_signal(2:2:end, :)) / 2; |
41 fs = fs / 2; | 43 % fs = fs / 2; |
42 end | 44 % end |
43 | 45 % |
44 if fs ~= 22050 | 46 % if fs ~= 22050 |
45 error('unexpected sample rate') | 47 % error('unexpected sample rate') |
46 end | 48 % end |
47 | 49 |
48 file_signal = file_signal(:, 1); % mono | 50 file_signal = file_signal(:, 1); % mono |
49 file_signal = [file_signal; zeros(fs, 1)]; % pad with a second of silence | 51 file_signal = [file_signal; zeros(fs, 1)]; % pad with a second of silence |
50 | 52 |
51 | 53 |
54 for dB = dB_list | 56 for dB = dB_list |
55 test_signal = [test_signal; file_signal * 10^(dB/20)]; | 57 test_signal = [test_signal; file_signal * 10^(dB/20)]; |
56 end | 58 end |
57 | 59 |
58 %% | 60 %% |
59 CF_struct = CARFAC_Design(1); % default design | 61 CF_struct = CARFAC_Design(1, fs); % default design |
60 | 62 |
61 CF_struct = CARFAC_Init(CF_struct); | 63 CF_struct = CARFAC_Init(CF_struct); |
62 | 64 |
63 [frame_rate, num_frames] = SAI_RunLayered(CF_struct, test_signal); | 65 [frame_rate, num_frames] = SAI_RunLayered(CF_struct, test_signal); |
64 | 66 |
68 wav_fn, ['CARFAC_SAI_movie_', wav_fn(1:end-4), '.mpg']) | 70 wav_fn, ['CARFAC_SAI_movie_', wav_fn(1:end-4), '.mpg']) |
69 | 71 |
70 %% | 72 %% |
71 system('rm -r frames'); | 73 system('rm -r frames'); |
72 | 74 |
75 |