-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
snd_pcm_readn hangs at record & playback on same device #368
Comments
some remarks: |
Hi @aditpape, thanks for you feedback! I corrected most things: this is my new code:
output:
Also, I have the same issue when I switch to PortAudio. Then my application hangs on Pa_ReadStream. And I'm using one of their examples as the basis of my application. |
c) refer to 'start_threshold'. You should start the device once full or enough data got written to it. e) needs initialization like e.g.
Assume you refer to PulseAudio via pulse ALSA plugin? |
ok, I have output!
|
I switched to buffer_frames = 256 instead of 1024 and I wrote some data into the playback device before starting it. Now the broken pipe error disappeared but my app still hangs.
oh, and I just remembered, I also tried alsaloop and piping audio from arecord to aplay using some examples, but nowhere ever does there come audio out of the lineout of the same device I record from... |
propose to verify the underlaying devices separately with aplay/arecord.. aplay -vvv -Dplughw:Zero,0 -fdat /dev/urandom once properly working separately you can form a forwarding via arecord | aplay ..and if that is working you can continue with your own app. |
both arecord and aplay work as they did before, but forwarding is where it goes wrong. I tried that already as I said ...
output of arecord:
EDIT:
so how do I get the forwarding to work? |
Seems devices do not accept duplex mode.. (using as playback and capture simultaneously) |
I opened two SSH connections to my RPi. One with: And I do actually hear music! |
That error is returned from the snd_pcm_readX()-API, thus cannot be related to the concurrent access to file. Also, for verification, access hardware as direct as possible.. (remove plugins) |
I'm not sure if this is what we are looking for but there are errors:
Going from plughw to hw makes no difference. Same error... |
messages in kernel log are not audio related.. |
When I add the -N option to both commands the error does not show anymore, but playback with aplay stops prematurely. arecord just keeps on going without any errors... status: RUNNING |
'status' or 'info' should show the runtime.. |
hw doesn't give any more interrupts... |
btw this was on the record stream... |
it does, but as soon as I start aplay in another shell, it stops moving |
Correct alsa state files 'loaded'? For duplex operation AUXIN HPOUT seems a dedicated state file needed. sudo alsactl restore -f |
ahhh yes, I ran into a little problem there. But not with the HifiBerry with which I have the same issue. Anyway, this is the output of sudo alsactl restore -f:
|
command for your case should be: Topic seems to turn into pure 'Raspi codec related', thus 'Rapi forum' may help further. |
I ran that command exactly. And no. Like I said it also happens with the HifiBerry! |
Not that familiar with the alsactrl + involvement of the UCM (use case manager) If that also does not help, I am 'out' |
Same error I'm afraid. Ok, well thank you very much for your input! I learned a lot! Thanx! |
I double checked EVERYTHING with only the HifiBerry installed and exactly the same symptoms as with the IQAudio Codec Zero! In the end the HW pointer stops moving as soon as I start aplay in a different shell and arecord exits with a 2221 input/output error. Help! |
It looks like an issue with the BCM I2S kernel driver for RPi 5. You should consult your issue in the RPi forums. |
Ok! Thank you! Will investigate further in the RPi forums… |
It's fixed! |
I'm on a RPi5 4GB running Raspberry Pi OS 64bit Bookworm and my application hangs on snd_pcm_readn when I try to read and write to the same device. This occurs on an IQAudio Codec Zero sound card and on a HifiBerry DAC+ADC Pro as well. When I select a USB sound card as the output and one of the others described for input everything works like it should.
Here is my code:
The text was updated successfully, but these errors were encountered: