Play low sampling frequency audio in matlab
6 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Walter Roberson
on 23 Apr 2018
Edited: Walter Roberson
on 23 Apr 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.
0 Comments
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!