Why do I hear nothing? sound function

65 ビュー (過去 30 日間)
Niklas Kurz
Niklas Kurz 2021 年 1 月 17 日
編集済み: Adam Danz 2021 年 1 月 18 日
I finally wanna hear what a linear function sounds like. Why does:
dt = 0.001;
t = 0:dt:2;
x = 1.*t;
plot(t,x)
sound(x,1/dt)
not work? Too low frequency? Or is it a property of the function, because there are no oscillations in it?

採用された回答

Adam Danz
Adam Danz 2021 年 1 月 17 日
編集済み: Adam Danz 2021 年 1 月 18 日
According to the documentation, the sound data (first input to sound()) is an mx1 or mx2 matrix. Your sound data are 1x2001. Sound data typically contains values between [-1,1]. The range of your sound data is [0,2].
Valid sampling rates (second input to sound()), are 1000-384000Hz, accepted by Matlab, but also depend on your hardware. In reality, 1000Hz is very low for standard hardware. My Realtek audio supports a 44.1k/48k/96k/192kHz sample rate. To see info on your audio card in Windows, run dxdiag (win + r), and look at the Sound tab.
If you run your audio without specifying the sampling rate or specifying a much higher rate such as 44100, you should hear two clicks.
sound(x'-1, 44100)
  1. transposed to conform to the expected inputs (a column vector)
  2. -1 to conform to the typical range of audio data

その他の回答 (0 件)

カテゴリ

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