playing wav files in matlab-

조회 수: 10 (최근 30일)
alex
alex 2012년 10월 21일
I have wav files that I want to play- I read them using wavread, and play them using sound or play(audioplayer).
my problem is that for this assignment precision is important, and some how my files are sound later then they should be-
all my files work this way- silence for x milliseconds ,and a strong noise for just a couple milliseconds afterwards.
but in my code, using both functions the sound comes too far behind the x milliseconds..
what can I do to make it more precise? maybe changing stuff like bits or Fz?

답변 (1개)

Image Analyst
Image Analyst 2012년 10월 21일
Maybe load them in prior to needing to play them so you don't have to waste time reading from disk at the instant that they need to be played. You might also try bumping up the priority of the MATLAB process (control-shift-Esc, right click process and set priority to high, NOT real time). Others may have other ideas. When you play your waves, do other players have silence, then the sound, then loud noise at the end? You might want to open up your sound file in a program like free Audacity to see what the waveform looks like. Trim off the noise at the end or silence from the beginning if there is any, then resave the cropped waveform.
  댓글 수: 1
alex
alex 2012년 10월 21일
I'm not sure I understand you..
I have a wav file that goes - silence for 250 miliseconds and then a laud noise for like 10 milliseconds . that's it- thats the file, I have a bunch of those that instead of 250 milliseconds the duration is longer a bit..
when I play the file, I hear the noisy part after allmost 0.5-0.6 seconds so it is much slower then it should be. I measure only the part of the play\sound .. all the other things like reading and loading them isn't the problem.
I thought maybe using a faster sample rate like
b=audioplayer(a,96000)
play(b)
or
sound(a,96000)
but I thinks its wrong because my file (the 250 milliseconds one) has 14000 samples in it, and by my calculations it should be sampled with 44100 kh, because the noise starts in the 11000-th sample,
so
44100/11000~ 0.250..
so what can I do?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by