Can MATLAB Play or Record 384 kHz Sampling Rate Audio Stream?

18 次查看(过去 30 天)
Hello there, it's my first time posting question here at MATLAB forum. This might be a simple yes or no question.
Platform and hardware: I am using an RME ADI-2 Pro FS R AD/DA converter for my project. The maximum sampling rate for this hardware is 768 kHz for both AD and DA part. I am using Windows 10 and I need to install an ASIO driver to make the RME play/record 768 kHz audio stream. But I can play/record 384 kHz audio stream without the ASIO driver.
Problem description: I can properly play/record sampling rate under 192 kHz (including 192 kHz). But I can not play/record audio streams above 192 kHz.
wav files I used:
My code for playing back is:
[y, Fs] = audioread('chirp_1s_384k_fs.wav');
soundsc(y,Fs,24);
My code for recording is:
recorder = audiorecorder(384e3,24,2);
recordblocking(recorder,5);
Here are my error reports:
According to the documentation in soundsc, up to 384 kHz sampling rate is supported.
Fs — Sample rate
8192 (default) | positive number
Sample rate, in hertz, of audio data y, is specified as a positive number from 1000 through 384000. Valid values depend on both the sample rates permitted by MATLAB® and the specific audio hardware on your system. MATLAB has a hard restriction of 1000 Hz <= Fs <= 384000 Hz, although further hardware-dependent restrictions apply.
Data Types: single | double
Do I need to specificy or install anything particular to make MATLAB play and record audio streams with sampling rate above 192 kHz? Please shed some light on this.
Thanks in advance,
Van
---------------------------- Follow Ups
I tried to use the data acquisition toolbox. But the sampling rate will be forced to go back to 192 kHz when I set anything higher:
My friend tried to play the 384 kHz chirp file using his MATLAB on his MAC. It works with the audioplayer. I tried it on my Windows, still not working for 384 kHz.
  3 个评论
Van Fan
Van Fan 2022-3-21
Thanks Geoff. This setting is on for me. But I couldn't get any sampling rate higher than 192 kHz.

请先登录,再进行评论。

回答(1 个)

sai charan sampara
sai charan sampara 2024-1-18
编辑:sai charan sampara 2024-1-19
Hello Van,
I understand that you are trying to play an audio with a sampling rate of 384kHz.
MATLAB does support playing audio with sampling rate in the frequency of 1kHz-384kHz. For any sampling rate not in this range (<1k or >384k), it gives an error saying, “Device Error: Invalid Sample Rate”. In your case the error message is “Device Error: Unanticipated host error”. This might be because your computer hardware might not support this sampling rate. MATLAB tries to play the audio with the higher sampling rate as it is in the valid range, but the device fails and hence generates this error message. The valid sampling rates are therefore dependent on the device too. You can check your device’s specification and supported sampling rates from the manufacturer’s documentation. Getting your hardware upgraded to something that supports the given sampling rate can solve this issue. Some possible workarounds are:
Changing the audio device for playback might be able to solve the issue. It can be done using "ID" property of "audioplayer" as follows: https://www.mathworks.com/help/matlab/ref/audioplayer.html#:~:text=ID%20%E2%80%94%20Audio%20device%20identifier
You can also try using a different driver for playback. It can be done using "Driver" property of "audioDeviceWriter" as follows:

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by