×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Matlab audio formating

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

RE: Matlab audio formating

Looks like you've clipped the signal at some point in the recording process. That is an unrecoverable error.

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

(OP)
Thanks. I figured it was due to the vista recorder...ill try some others.
as far as "chopping those bits out" how do you edit the matrix within matlab?  

RE: Matlab audio formating

(OP)
ok...like new_matrix = old(old>.01)
or something...

RE: Matlab audio formating

Not really. Why not use music editing software like goldwave?


 

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

Agree, you don't need Matlab for the agricultural stuff.

- Steve

RE: Matlab audio formating

(OP)
But I do. Im taking inputs from users and need to clean up the recording for processsing in order to determine cepstral coefficients to provide input to a neural network...now, I could go through the samples one by one (hundreds of samples) and cut them up to look nice...but yea...a program to do it all for me would be nice =.=

RE: Matlab audio formating

Fair enough.  

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

Locating and removing the silent bits requires a thresholding method, something like an RMS filter is common, these are on the FEX if not in Matlab already.  Then you can use logical indexing for your chopping.

% 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 sad

- Steve

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close