Play low sampling frequency audio in matlab
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2018-4-23
编辑:Walter Roberson
2018-4-23
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!