PortAudio Error: Unanticipated host error.
17 次查看(过去 30 天)
显示 更早的评论
I'm trying to use a digiducer accelerometer on an Ubuntu 16.04 system running Matlab R2012a.
I used H = dsp.AudioRecorder(.....) function and get no errors. But when I subsequently use AUDIO = step(H), I get 'PortAudio Error: Unanticipated host error.' What causes this?
device = '333D01 10595173209464075160919: USB Audio (hw:1,0)';
fs = 22050; % fs = Hz
FrameSize = 1024;
H = dsp.AudioRecorder('DeviceName', device, ...
'SampleRate', fs, ...
'NumChannels', 2, ...
'DeviceDataType', '16-bit integer', ...
'BufferSizeSource', 'Property', ...
'BufferSize', 4096, ...
'QueueDuration', 1, ...
'SamplesPerFrame', FrameSize, ...
'OutputDataType', 'double');
AUDIO = step(H);
On calling this step(H) function, I get the following errors in my Linux terminal:
Expression 'alsa_snd_pcm_hw_params_set_buffer_size_near( self->pcm, hwParams, &bufSz )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1996
Expression 'PaAlsaStreamComponent_FinishConfigure( &self->capture, hwParamsCapture, inParams, self->primeBuffers, realSr, inputLatency )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2646
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2758
0 个评论
回答(2 个)
Walter Roberson
2016-10-28
You might be losing interrupts. See http://www.mathworks.com/matlabcentral/answers/307634-how-to-fix-port-audio-error-unanticipated-host-error#comment_399182
0 个评论
Shuvodip Majumdar
2023-3-18
For me this error occured because the audio writer was expecting a sample rate of 45600 Hz, but I was using 48000 Hz. Once I changed the output sample rate to 45600 Hz, the error disappeared.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!