Play low sampling frequency audio in matlab

5 vues (au cours des 30 derniers jours)
arun sebastian
arun sebastian le 23 Avr 2018
I have a 6467584*1 double array containing audio data. The sampling frequency for the data is 256. When I try to play the audio using the soundsc function it shows the following error :
% Error using sound (line 76) Device Error: Invalid sample rate. Error in soundsc (line 55)
sound(varargin{:});
Is there any function that I can use in MATLAB to play audio?

Réponses (1)

Walter Roberson
Walter Roberson le 23 Avr 2018
Modifié(e) : Walter Roberson le 23 Avr 2018
The difficulty appears to originate in the portaudio layer; although sound() itself permits as low as 80 Hz, portaudio is not able to open something that low. Exactly what it can handle might depend upon your OS and hardware.
I am running a scan now to see what the lowest rate is that my system can handle. It may take a while.
foo = rand(1,1000);
for r = 80:8000; try sound(foo,r); fprintf('\nOk at %d!\n', r); break; catch ME; if mod(r,100)==0; fprintf('%d...', r); end; end; end
It is past 800 now; I will update when it stops.
... 1000 was the lowest accepted on my system.
You may need to resample your 256 to 1024 to play it.

Community Treasure Hunt

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

Start Hunting!

Translated by