Effacer les filtres
Effacer les filtres

PortAudio Error: Unanticipated host error.

17 vues (au cours des 30 derniers jours)
Chris Chow
Chris Chow le 28 Oct 2016
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

Réponses (2)

Walter Roberson
Walter Roberson le 28 Oct 2016

Shuvodip Majumdar
Shuvodip Majumdar le 18 Mar 2023
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.

Catégories

En savoir plus sur Simulation, Tuning, and Visualization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by