matthiasm@0
|
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
matthiasm@0
|
2 % Audio Degradation Toolbox
|
matthiasm@0
|
3 %
|
matthiasm@0
|
4 % Centre for Digital Music, Queen Mary University of London.
|
matthiasm@0
|
5 % This file copyright 2013 Sebastian Ewert, Matthias Mauch and QMUL.
|
SebastianEwert@4
|
6 %
|
matthiasm@0
|
7 % This program is free software; you can redistribute it and/or
|
matthiasm@0
|
8 % modify it under the terms of the GNU General Public License as
|
matthiasm@0
|
9 % published by the Free Software Foundation; either version 2 of the
|
matthiasm@0
|
10 % License, or (at your option) any later version. See the file
|
matthiasm@0
|
11 % COPYING included with this distribution for more information.
|
matthiasm@0
|
12 %
|
matthiasm@0
|
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
matthiasm@0
|
14
|
matthiasm@0
|
15 % Note: Some degradations impose a delay/temporal distortion on the input
|
matthiasm@0
|
16 % data. The last example shows, given time positions before the
|
matthiasm@0
|
17 % degradation, how the corresponding time positions after the degradation
|
matthiasm@0
|
18 % can be retrieved
|
matthiasm@0
|
19
|
matthiasm@0
|
20 %%
|
matthiasm@0
|
21
|
matthiasm@0
|
22 clear
|
SebastianEwert@4
|
23 close all
|
matthiasm@0
|
24
|
matthiasm@23
|
25 addpath(genpath(fullfile(pwd,'AudioDegradationToolbox')));
|
matthiasm@0
|
26
|
matthiasm@0
|
27 pathOutputDemo = 'demoOutput/';
|
matthiasm@0
|
28 if ~exist(pathOutputDemo,'dir'), mkdir(pathOutputDemo); end
|
matthiasm@0
|
29
|
SebastianEwert@4
|
30 filenames = {
|
SebastianEwert@4
|
31 'testdata/RWC_G39.wav';
|
SebastianEwert@4
|
32 'testdata/RWC_G72.wav';
|
SebastianEwert@4
|
33 'testdata/RWC_G84.wav';
|
SebastianEwert@4
|
34 'testdata/RWC_P009m_drum.wav';
|
SebastianEwert@4
|
35 'testdata/RWC-C08.wav';
|
matthiasm@7
|
36 'testdata/session5-faure_elegie2c-001-0.wav';
|
matthiasm@7
|
37 'testdata/175234__kenders2000__nonsense-sentence.wav';
|
SebastianEwert@4
|
38 };
|
matthiasm@0
|
39
|
matthiasm@9
|
40 createSpectrograms = 0;
|
matthiasm@0
|
41
|
matthiasm@0
|
42 %%
|
SebastianEwert@4
|
43 % just copying original files to the demo folder
|
SebastianEwert@5
|
44 maxValueRangeVis = zeros(length(filenames));
|
SebastianEwert@4
|
45 for k=1:length(filenames)
|
SebastianEwert@4
|
46 copyfile(filenames{k}, fullfile(pathOutputDemo,sprintf('00_Original_file%d.wav',k)))
|
SebastianEwert@4
|
47 if createSpectrograms
|
SebastianEwert@4
|
48 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@4
|
49 [s,f,t] = spectrogram(f_audio,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@4
|
50 figure; imagesc(t,f,log10(abs(s)+1)); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('00_Original_file%d.png',k)))
|
SebastianEwert@5
|
51 maxValueRangeVis(k) = max(max(log10(abs(s)+1)));
|
SebastianEwert@4
|
52 end
|
SebastianEwert@4
|
53 end
|
matthiasm@0
|
54
|
matthiasm@0
|
55 %%
|
SebastianEwert@4
|
56 for k=1:length(filenames)
|
SebastianEwert@4
|
57 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@4
|
58
|
SebastianEwert@4
|
59 % with default settings:
|
SebastianEwert@4
|
60 %f_audio_out = degradationUnit_addNoise(f_audio, samplingFreq);
|
SebastianEwert@4
|
61
|
SebastianEwert@4
|
62 % adjusting some parameters:
|
SebastianEwert@4
|
63 parameter.snrRatio = 10; % in dB
|
SebastianEwert@4
|
64 parameter.noiseColor = 'pink'; % convenient access to several noise types
|
SebastianEwert@4
|
65 f_audio_out = degradationUnit_addNoise(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@4
|
66
|
SebastianEwert@4
|
67 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_01_addNoise_file%d.wav',k)));
|
SebastianEwert@4
|
68 if createSpectrograms
|
SebastianEwert@4
|
69 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@5
|
70 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_01_addNoise_file%d.png',k)))
|
SebastianEwert@4
|
71 end
|
SebastianEwert@4
|
72 end
|
matthiasm@0
|
73
|
matthiasm@0
|
74 %%
|
matthiasm@0
|
75 % Some degradations delay the input signal. If some timepositions are given
|
matthiasm@0
|
76 % via timepositions_beforeDegr, the corresponding positions will be returned
|
SebastianEwert@4
|
77 % in timepositions_afterDegr.
|
matthiasm@0
|
78 timepositions_beforeDegr = [2, 3];
|
matthiasm@0
|
79
|
matthiasm@0
|
80 % Processing the time positions even works without processing the audio data (f_audio_out is empty afterwards)
|
SebastianEwert@4
|
81 parameter.loadInternalIR = 0;
|
SebastianEwert@4
|
82 parameter.impulseResponse = [1 -1 1 -1 1 -1 ] / 6; % some impulse response
|
SebastianEwert@4
|
83 parameter.impulseResponseSampFreq = samplingFreq;
|
matthiasm@0
|
84 parameter.normalizeOutputAudio = 1;
|
matthiasm@0
|
85 [f_audio_out,timepositions_afterDegr] = degradationUnit_applyImpulseResponse([], [], timepositions_beforeDegr, parameter);
|
matthiasm@0
|
86
|
SebastianEwert@4
|
87 for k=1:length(filenames)
|
SebastianEwert@4
|
88 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@4
|
89
|
SebastianEwert@4
|
90 % time positions and audio can also be processed at the same time:
|
SebastianEwert@4
|
91 [f_audio_out,timepositions_afterDegr] = degradationUnit_applyImpulseResponse(f_audio, samplingFreq, timepositions_beforeDegr, parameter);
|
SebastianEwert@4
|
92 fprintf('degradation_applyFirFilter: adjusting time positions\n');
|
SebastianEwert@4
|
93 for m=1:length(timepositions_afterDegr) fprintf('%g -> %g\n',timepositions_beforeDegr(m),timepositions_afterDegr(m)); end
|
SebastianEwert@4
|
94
|
SebastianEwert@28
|
95 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_02_applyImpulseResponse_file%d.wav',k)));
|
SebastianEwert@4
|
96 if createSpectrograms
|
SebastianEwert@4
|
97 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
98 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_02_applyImpulseResponse_file%d.png',k)))
|
SebastianEwert@4
|
99 end
|
SebastianEwert@4
|
100 end;
|
matthiasm@0
|
101
|
SebastianEwert@28
|
102 %%
|
SebastianEwert@28
|
103 for k=1:length(filenames)
|
SebastianEwert@28
|
104 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
105
|
SebastianEwert@28
|
106 parameter.snrRatio = 10; % in dB
|
SebastianEwert@28
|
107 parameter.loadInternalSound = 1;
|
SebastianEwert@28
|
108 parameter.internalSound = 'PubEnvironment1';
|
SebastianEwert@28
|
109 f_audio_out = degradationUnit_addSound(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
110
|
SebastianEwert@28
|
111 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_03_addSound_file%d.wav',k)));
|
SebastianEwert@28
|
112 if createSpectrograms
|
SebastianEwert@28
|
113 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
114 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_03_addSound_file%d.png',k)))
|
SebastianEwert@28
|
115 end
|
SebastianEwert@28
|
116 end;
|
SebastianEwert@28
|
117
|
SebastianEwert@28
|
118 %%
|
SebastianEwert@28
|
119 for k=1:length(filenames)
|
SebastianEwert@28
|
120 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
121
|
SebastianEwert@28
|
122 parameter.dsFrequency = 4000;
|
SebastianEwert@28
|
123 f_audio_out = degradationUnit_applyAliasing(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
124
|
SebastianEwert@28
|
125 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_04_applyAliasing_file%d.wav',k)));
|
SebastianEwert@28
|
126 if createSpectrograms
|
SebastianEwert@28
|
127 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
128 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_04_applyAliasing_file%d.png',k)))
|
SebastianEwert@28
|
129 end
|
SebastianEwert@28
|
130 end;
|
SebastianEwert@28
|
131
|
SebastianEwert@28
|
132 %%
|
SebastianEwert@28
|
133 for k=1:length(filenames)
|
SebastianEwert@28
|
134 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
135
|
SebastianEwert@28
|
136 parameter.percentOfSamples = 10; % signal is scaled so that n% of samples clip
|
SebastianEwert@28
|
137 f_audio_out = degradationUnit_applyClippingAlternative(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
138
|
SebastianEwert@28
|
139 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_05_applyClipping_file%d.wav',k)));
|
SebastianEwert@28
|
140 if createSpectrograms
|
SebastianEwert@28
|
141 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
142 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_05_applyClipping_file%d.png',k)))
|
SebastianEwert@28
|
143 end
|
SebastianEwert@28
|
144 end;
|
SebastianEwert@28
|
145 %%
|
SebastianEwert@28
|
146 for k=1:length(filenames)
|
SebastianEwert@28
|
147 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
148
|
SebastianEwert@28
|
149 parameter.compressorSlope = 0.9;
|
SebastianEwert@28
|
150 parameter.normalizeOutputAudio = 1;
|
SebastianEwert@28
|
151 f_audio_out = degradationUnit_applyDynamicRangeCompression(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
152
|
SebastianEwert@28
|
153 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_06_applyDynamicRangeCompression_file%d.wav',k)));
|
SebastianEwert@28
|
154 if createSpectrograms
|
SebastianEwert@28
|
155 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
156 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_06_applyDynamicRangeCompression_file%d.png',k)))
|
SebastianEwert@28
|
157 end
|
SebastianEwert@28
|
158 end;
|
SebastianEwert@28
|
159
|
SebastianEwert@28
|
160 %%
|
SebastianEwert@28
|
161 for k=1:length(filenames)
|
SebastianEwert@28
|
162 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
163
|
SebastianEwert@28
|
164 parameter.nApplications = 5;
|
SebastianEwert@28
|
165 f_audio_out = degradationUnit_applyHarmonicDistortion(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
166
|
SebastianEwert@28
|
167 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_07_applyHarmonicDistortion_file%d.wav',k)));
|
SebastianEwert@28
|
168 if createSpectrograms
|
SebastianEwert@28
|
169 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
170 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_07_applyHarmonicDistortion_file%d.png',k)))
|
SebastianEwert@28
|
171 end
|
SebastianEwert@28
|
172 end;
|
SebastianEwert@28
|
173
|
SebastianEwert@28
|
174 %%
|
SebastianEwert@28
|
175 for k=1:length(filenames)
|
SebastianEwert@28
|
176 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
177
|
SebastianEwert@28
|
178 parameter.LameOptions = '--preset cbr 32';
|
SebastianEwert@28
|
179 f_audio_out = degradationUnit_applyMp3Compression(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
180
|
SebastianEwert@28
|
181 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_08_applyMp3Compression_file%d.wav',k)));
|
SebastianEwert@28
|
182 if createSpectrograms
|
SebastianEwert@28
|
183 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
184 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_08_applyMp3Compression_file%d.png',k)))
|
SebastianEwert@28
|
185 end
|
SebastianEwert@28
|
186 end;
|
SebastianEwert@28
|
187
|
SebastianEwert@28
|
188 %%
|
SebastianEwert@28
|
189 for k=1:length(filenames)
|
SebastianEwert@28
|
190 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
191
|
SebastianEwert@28
|
192 parameter.changeInPercent = +5;
|
SebastianEwert@28
|
193 f_audio_out = degradationUnit_applySpeedup(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
194
|
SebastianEwert@28
|
195
|
SebastianEwert@28
|
196 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_09_applySpeedup_file%d.wav',k)));
|
SebastianEwert@28
|
197 if createSpectrograms
|
SebastianEwert@28
|
198 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
199 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_09_applySpeedup_file%d.png',k)))
|
SebastianEwert@28
|
200 end
|
SebastianEwert@28
|
201 end;
|
SebastianEwert@28
|
202
|
SebastianEwert@28
|
203 %%
|
SebastianEwert@28
|
204 for k=1:length(filenames)
|
SebastianEwert@28
|
205 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
206
|
SebastianEwert@28
|
207 parameter.intensityOfChange = 3;
|
SebastianEwert@28
|
208 parameter.frequencyOfChange = 0.5;
|
SebastianEwert@28
|
209 f_audio_out = degradationUnit_applyWowResampling(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
210
|
SebastianEwert@28
|
211 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_10_applyWowResampling_file%d.wav',k)));
|
SebastianEwert@28
|
212 if createSpectrograms
|
SebastianEwert@28
|
213 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
214 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_10_applyWowResampling_file%d.png',k)))
|
SebastianEwert@28
|
215 end
|
SebastianEwert@28
|
216 end;
|
SebastianEwert@28
|
217
|
SebastianEwert@28
|
218 %%
|
SebastianEwert@28
|
219 for k=1:length(filenames)
|
SebastianEwert@28
|
220 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
221
|
SebastianEwert@28
|
222 parameter.stopFrequency = 1000;
|
SebastianEwert@28
|
223 f_audio_out = degradationUnit_applyHighpassFilter(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
224
|
SebastianEwert@28
|
225 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_11_applyHighpassFilter_file%d.wav',k)));
|
SebastianEwert@28
|
226 if createSpectrograms
|
SebastianEwert@28
|
227 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
228 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_11_applyHighpassFilter_file%d.png',k)))
|
SebastianEwert@28
|
229 end
|
SebastianEwert@28
|
230 end;
|
SebastianEwert@28
|
231
|
SebastianEwert@28
|
232 %%
|
SebastianEwert@28
|
233 for k=1:length(filenames)
|
SebastianEwert@28
|
234 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
235
|
SebastianEwert@28
|
236 parameter.stopFrequency = 1000;
|
SebastianEwert@28
|
237 f_audio_out = degradationUnit_applyLowpassFilter(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
238
|
SebastianEwert@28
|
239 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_12_applyLowpassFilter_file%d.wav',k)));
|
SebastianEwert@28
|
240 if createSpectrograms
|
SebastianEwert@28
|
241 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
242 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_12_applyLowpassFilter_file%d.png',k)))
|
SebastianEwert@28
|
243 end
|
SebastianEwert@28
|
244 end;
|
SebastianEwert@28
|
245
|
SebastianEwert@28
|
246
|
SebastianEwert@28
|
247 %%
|
SebastianEwert@28
|
248 for k=1:length(filenames)
|
SebastianEwert@28
|
249 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
250
|
SebastianEwert@28
|
251 % There are four ways to specify the destination mean spectrum: 1. by
|
SebastianEwert@28
|
252 % loading example files provided with the toolbox, 2. by using specific
|
SebastianEwert@28
|
253 % noise "color" profiles, 3. by providing the destination mean spectrum
|
SebastianEwert@28
|
254 % using the parameter destMagFreqResp, 4. by providing audio data from
|
SebastianEwert@28
|
255 % which the destination mean spectrum is computed.
|
SebastianEwert@28
|
256 parameter.loadInternalMagFreqResp = 1;
|
SebastianEwert@28
|
257 parameter.internalMagFreqResp = 'Beethoven_Appasionata_Rwc';
|
SebastianEwert@28
|
258 f_audio_out = degradationUnit_adaptiveEqualizer(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
259
|
SebastianEwert@28
|
260 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_13_adaptiveEqualizer_file%d.wav',k)));
|
SebastianEwert@28
|
261 if createSpectrograms
|
SebastianEwert@28
|
262 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
263 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_13_adaptiveEqualizer_file%d.png',k)))
|
SebastianEwert@28
|
264 end
|
SebastianEwert@28
|
265 end;
|
SebastianEwert@28
|
266
|
SebastianEwert@28
|
267 %%
|
SebastianEwert@28
|
268 if 1
|
SebastianEwert@28
|
269 for k=1:length(filenames)
|
SebastianEwert@28
|
270 [f_audio,samplingFreq]=wavread(filenames{k});
|
SebastianEwert@28
|
271
|
SebastianEwert@28
|
272 [parameter.audioDataForDestMfcc,parameter.audioDataForDestMfcc_sf]=wavread('testdata/RWC_P009m_drum.wav');
|
SebastianEwert@28
|
273
|
SebastianEwert@28
|
274 % After this unit, the mean MFCC vector of f_audio_out is almost identical to
|
SebastianEwert@28
|
275 % the one of RWC_P009m_drum.wav
|
SebastianEwert@28
|
276 parameter.visualizations = createSpectrograms;
|
SebastianEwert@28
|
277 f_audio_out = degradationUnit_applyMfccMeanAdaption(f_audio, samplingFreq, [], parameter);
|
SebastianEwert@28
|
278
|
SebastianEwert@28
|
279 wavwrite(f_audio_out,samplingFreq,16,fullfile(pathOutputDemo,sprintf('Unit_14_applyMfccMeanAdaption_file%d.wav',k)));
|
SebastianEwert@28
|
280 if createSpectrograms
|
SebastianEwert@28
|
281 [s,f,t] = spectrogram(f_audio_out,hamming(round(samplingFreq*0.093)),round(samplingFreq*0.093/2),[],samplingFreq);
|
SebastianEwert@28
|
282 figure; imagesc(t,f,log10(abs(s)+1),[0 maxValueRangeVis(k)]); axis xy; colormap(hot); ylim([0,8000]); colorbar; print('-dpng', fullfile(pathOutputDemo,sprintf('Unit_14_applyMfccMeanAdaption_file%d.png',k)))
|
SebastianEwert@28
|
283 end
|
SebastianEwert@28
|
284 end
|
SebastianEwert@28
|
285 end
|
SebastianEwert@28
|
286
|
SebastianEwert@28
|
287
|
SebastianEwert@28
|
288
|