Using sound function with .wav on MAC

4 ビュー (過去 30 日間)
Meaghan
Meaghan 2013 年 2 月 27 日
I'm trying to play a .wav file on my MAC and I've seen a few posts online say that the sound function works for them. I've only been able to get it to work when using matlab demo sounds.
Am I just doing something wrong or will the song (.wav file) not play on a mac?
I used:
y = wavread('01_Bridge_Burning.wav') sound(y,Fs);
(It's for a school project.)
Thank you!
  3 件のコメント
Meaghan
Meaghan 2013 年 2 月 27 日
My apologies. The code runs for about 3 min worth of iterations then ends on an error for "java.lang.OutOfMemoryError: Java heap space". But the whole series is silent.
Sorry, I should have been clearer. I tried a few different frequencies, but left it as Fs in the post. I wasn't entirely sure what a favorable frequency would be.
Jan
Jan 2013 年 2 月 27 日
The favorable frequency is the frequency defined in the WAV file. Therefore it is obligatory to obtain this frequency as output when importing the WAV. Did you try the code I've posted?
3 minutes of iterations? You did not post any code with iterations.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2013 年 2 月 27 日
編集済み: Jan 2013 年 2 月 27 日
Did you notice that you use FS without defining it? Perhaps you play a sound sampled at 44.1kHz with 8.000kHz, such that the recorded (low) frequence cannot be reproduced by the small speaker of your computer.
[y, Fs, nBits] = wavread(filename);
sound(y, Fs, nBits)

カテゴリ

Help Center および File ExchangeAudio 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