sample rate (Fs) in audiowrite
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amir Tadayon
el 24 de Mzo. de 2019
Respondida: Guillaume
el 29 de Mzo. de 2019
Version: MATLAB R2018
In the document of audiowrite, it is written that the sample rate is any positive scalar between 44100 and 4800 Hz. However, the function accepts sample rates below 44100 Hz, e.g., 39063. More importantly, the document does not mention that the input sample rate must be integer, but the function throws an exception if the sample rate is not an integer.
2 comentarios
Star Strider
el 25 de Mzo. de 2019
I would do the ‘Fs’ calculation before the audiowrite call:
Fs = 1E+7/256;
then pass that value of ‘Fs’ to the function.
Also, the limits you cite apply only to .m4a and .mp4 files, and Windows. From the documentation:
‘When writing to .m4a or .mp4 files on Windows platforms, audiowrite supports only samples rates of 44100 and 48000.’
Respuesta aceptada
Guillaume
el 29 de Mzo. de 2019
Yes, the documentation does not match the actual code of audiowrite, at least in R2018b and R2019a. The documentation states that "Values of Fs are truncated to integer boundaries" but audiowrite actually doesn't do any truncating and simply errors if Fs is not integer.
I'll report the bug. Most likely, the problem is with the documentation and you can only pass integer values as Fs (which would make sense since audio formats store it as integer).
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!