[Portaudio] PA not playing on Linux with ALSA

Matthias Geier matthias.geier at gmail.com
Sun Jan 13 05:07:42 EST 2019


Hi Diemo, sqweek and others.

On Sat, Jan 12, 2019 at 12:33 AM sqweek E. wrote:
>
> Hi Diemo,
>
> I remember seeing this before, and I think it was ultimately due to the pulseaudio <-> alsa bridge not providing timing information, rather than something portaudio was doing/not doing. I remember resolving the issue by having my application detect when the stream time was not progressing and fall back to a different time source (can't remember if I used system clock or a calculation based on the number of processed frames).

I've also experienced the lack of timing when using PulseAudio.

However, this only happened when using the default device (called
"default"), which is some kind of "virtual" device.
When I'm using a "real" device (e.g. "hw:0,0"), the timing information works!

cheers,
Matthias

> If you search this list you'll also find a pulseaudio backend implentation for portaudio, courtesy of Tuukka Pasenen. Unfortunately it is yet to be merged into the main branch, and I also don't remember if the stream timing info has been implemented yet.
>
> ... I shouldn't send emails from my phone where it's difficult to check the history xD
>
> -sqweek
>
> > On 12 Jan 2019, at 03:44, Diemo Schwarz <Diemo.Schwarz at ircam.fr> wrote:
> >
> >
> > Hello again,
> >
> > thanks to your hints, I do get sound on RPi (and Mac). The next step is to run this program on an Intel Linux box, where I'm back with time being stuck:
> >
> > You see how the stream callback's currentTime is stuck at 0, and the outputBufferDacTime cycles through 6 buffers before resetting to 0.
> > I tried lower and higher latencies with same result.
> >
> > audio_callback: curtime 0  outtime 0  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0232  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0464  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0697  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0929  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.116  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0232  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0464  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0697  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.0929  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0.116  latency 0.557279  n 1024 flags 0
> > audio_callback: curtime 0  outtime 0  latency 0.557279  n 1024 flags 0
> >
> > Could this all be due to some mismatch with ALSA libs? The box has a pristine Debian installation [1], with ALSA already installed (aplay, etc. work), but I don't have root access, so I had to compile libasound 1.1.8 (from 7.1.2019!) from source, to get PA to compile with ALSA support (setenv LDFLAGS and CFLAGS before configure).
> > There's also pulseaudio installed, which I don't know if it can interfere with PA, and these ALSA errors remain:
> >
> > ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
> > ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
> > ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
> > ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
> >
> > Forgive me if this is an off-PA question (it's been more than 15 years since I last meddled with Linux audio), but any help would be appreciated.
> >
> > Best...
> >                                ...Diemo
> >
> > [1] Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
> >
> > I also now realise that this response didn't go to the list:
> >
> >> On 19/12/18 12:34, Diemo Schwarz wrote:
> >> Hi Phil,
> >> thanks for the hint, that info pointed me into the right direction to augment the requested output latency, and now I get sound!
> >> Should I worry about all these
> >> ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
> >> messages?
> >> Cheers...
> >>                                 ...Diemo
> >>> On 19/12/18 05:58, Phil Burk wrote:
> >>> Hello Diemo,
> >>>
> >>> PA on RPi specific info is here: https://app.assembla.com/wiki/show/portaudio/Platforms_RaspberryPi
> >>>
> >>>  > the audio callback is called only once.
> >>>
> >>> What value are you returning from your callback? If you do not return paContinue then it will stop.
> >>>
> >>> http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html#a8a60fb2a5ec9cbade3f54a9c978e2710
> >>>
> >>> Are you using the built-in PWM output? That is very low quality.
> >>> If you want good quality then you may need an audio board. I had good luck with the HifiBerry DAC+.
> >>> https://www.hifiberry.com/products/dacplus/
> >>>
> >>> See also: http://portaudio.com/docs/v19-doxydocs/compile_linux.html
> >>>
> >>> Phil Burk
> >>>
> >>>
> >>>
> >>> On Tue, Dec 18, 2018 at 10:28 AM Diemo Schwarz <Diemo.Schwarz at ircam.fr <mailto:Diemo.Schwarz at ircam.fr>> wrote:
> >>>
> >>>
> >>>     Hi, this is probably more a question of configuring ALSA correctly on a
> >>>     Raspberry (3) with Raspbian (stretch), but I'm humbly asking for where to look.
> >>>
> >>>     So I have a program that plays fine on Mac, but on Raspberry, it doesn't, since
> >>>     the audio callback is called only once.
> >>>     Some of the PA test programs have the same behaviour (paex_sine), some do work
> >>>     (paex_pink), some work with lots of glitches (patest_sine_time, patest_sine8,
> >>>     patest_sine_srate).
> >>>
> >>>     It might have something to do with sr (see output of patest_sine_srate below).
> >>>     If that rings a bell with someone please let me know, thank you!...
> >>>                                                                      ...Diemo
> >>>
> >>>
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
> >>>     ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
> >>>     'defaults.bluealsa.device'
> >>>     ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned
> >>>     error: No such file or directory
> >>>     ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
> >>>     directory
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
> >>>     ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition
> >>>     'defaults.bluealsa.device'
> >>>     ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned
> >>>     error: No such file or directory
> >>>     ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or
> >>>     directory
> >>>     ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
> >>>     PortAudio Test: output sine wave. SR = 44100, BufSize = 64
> >>>     Hardware SR changing not being tested on this platform.
> >>>     Play for 5 seconds.
> >>>     PortAudio Test: output sine wave. SR = 48000, BufSize = 64
> >>>     Hardware SR changing not being tested on this platform.
> >>>     Play for 5 seconds.
> >
> >
> > --
> > Diemo Schwarz, PhD -- http://diemo.concatenative.net
> > Sound–Music–Movement Interaction Team -- http://ismm.ircam.fr
> > IRCAM - Centre Pompidou -- 1, place Igor-Stravinsky, 75004 Paris, France
> > Phone +33-1-4478-4879 -- Fax +33-1-4478-1540
> > _______________________________________________
> > Portaudio mailing list
> > Portaudio at lists.columbia.edu
> > https://lists.columbia.edu/mailman/listinfo/portaudio
> _______________________________________________
> Portaudio mailing list
> Portaudio at lists.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/portaudio


More information about the Portaudio mailing list