Mercurial > hg > smallbox
comparison Problems/generateAudioDeclippingProblem.m @ 220:0d30f9074dd9
Merge
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Wed, 11 Apr 2012 15:56:39 +0100 |
parents | 9c418bea7f6a |
children |
comparison
equal
deleted
inserted
replaced
165:775caafd5651 | 220:0d30f9074dd9 |
---|---|
56 FS=filesep; | 56 FS=filesep; |
57 TMPpath=pwd; | 57 TMPpath=pwd; |
58 | 58 |
59 if ~ exist( 'soundfile', 'var' ) || isempty(soundfile) | 59 if ~ exist( 'soundfile', 'var' ) || isempty(soundfile) |
60 %ask for file name | 60 %ask for file name |
61 [pathstr1, name, ext, versn] = fileparts(which('SMALLboxSetup.m')); | 61 [pathstr1, name, ext] = fileparts(which('SMALLboxSetup.m')); |
62 cd([pathstr1,FS,'data',FS,'audio']); | 62 cd([pathstr1,FS,'data',FS,'audio']); |
63 [filename,pathname] = uigetfile({'*.mat; *.mid; *.wav'},'Select a file to transcribe'); | 63 [filename,pathname] = uigetfile({'*.mat; *.mid; *.wav'},'Select a file to transcribe'); |
64 [pathstr, name, ext, versn] = fileparts(filename); | 64 [pathstr, name, ext] = fileparts(filename); |
65 data.name=name; | 65 data.name=name; |
66 | 66 |
67 if strcmp(ext,'.mid') | 67 if strcmp(ext,'.mid') |
68 midi=readmidi(filename); | 68 midi=readmidi(filename); |
69 % data.notesOriginal=midiInfo(midi); | 69 % data.notesOriginal=midiInfo(midi); |
90 cd([pathstr1,FS, 'data', FS, 'audio', FS, 'mat']); | 90 cd([pathstr1,FS, 'data', FS, 'audio', FS, 'mat']); |
91 x=load([pathname,filename]); | 91 x=load([pathname,filename]); |
92 end | 92 end |
93 else | 93 else |
94 [x.signal, x.fs, x.nbits]=wavread(soundfile); | 94 [x.signal, x.fs, x.nbits]=wavread(soundfile); |
95 [pathstr, name, ext, versn] = fileparts(soundfile); | 95 [pathstr, name, ext] = fileparts(soundfile); |
96 data.name=name; | 96 data.name=name; |
97 end | 97 end |
98 | 98 |
99 if ~ exist( 'clippingLevel', 'var' ) || isempty(clippingLevel), clippingLevel = 0.6; end | 99 if ~ exist( 'clippingLevel', 'var' ) || isempty(clippingLevel), clippingLevel = 0.6; end |
100 if ~ exist( 'windowSize', 'var' ) || isempty(windowSize), windowSize = 256; end | 100 if ~ exist( 'windowSize', 'var' ) || isempty(windowSize), windowSize = 256; end |