Matlab audio formating
Matlab audio formating
(OP)
Hi all,
Im running vista and recording .wav files with the recording software offered by windows. I then import this data in matlab to process it.
When I plot the data "plot()" it returns the normal looking audio file plot (ill try to include an image). The problem is the file y axis max is from -.4 to .4 but the data exceeds these bounds. So, is there a way to fix this so that it includes all data (other than taking more samples at lower levels)?
Also there is a lot of unwanted data (no audio present). I need to remove this...edit the data so that it only includes the portion where actual audio recording is present.
Thanks in advance.
James
Im running vista and recording .wav files with the recording software offered by windows. I then import this data in matlab to process it.
When I plot the data "plot()" it returns the normal looking audio file plot (ill try to include an image). The problem is the file y axis max is from -.4 to .4 but the data exceeds these bounds. So, is there a way to fix this so that it includes all data (other than taking more samples at lower levels)?
Also there is a lot of unwanted data (no audio present). I need to remove this...edit the data so that it only includes the portion where actual audio recording is present.
Thanks in advance.
James





RE: Matlab audio formating
Wen you've fixed that, decide on a level and a time that represents 'silence' and chop those bits out.
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Matlab audio formating
as far as "chopping those bits out" how do you edit the matrix within matlab?
RE: Matlab audio formating
?
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Matlab audio formating
or something...
RE: Matlab audio formating
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Matlab audio formating
- Steve
RE: Matlab audio formating
RE: Matlab audio formating
Well, i'd create an nx2 matrix called goodbits with start and end of the good bits in each sample
k=1;
for i=1:n
for j=goodbits(i,1):goodbits(i,2)
noisy_wav(k)=original_wav(j);
k=k+1;
end
end
Steve will now present a one liner, probably using sparse.
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Matlab audio formating
% Untested, assumes an rms() function.
idx=rms(data)>threshold;
new_data=data(idx);
Which could of course by combined into a single line if "idx" has no further uses.
Another envelope method I like is based on a hilbert transform:
idx=abs(hilbert(data))>threshold;
Just to comment on Greg's code...
This line:
>> noisy_wav(k)=original_wav(j);
will cause the array noisy_wav() to grow each time a sample is copied across. The loop slows down as the array grows. It's almost always better to calculate the final array size and preallocate it with zeros.
No sparse() solutions today, sorry
- Steve