Audio source getting stuck on monitor record

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, good $TIME_OF_DAY

I am experimenting with interaction between music and coloured lights,
as you do in these days. So I've set up a Python script to record from
a PulseAudio source monitor, FFT some audio chunks into a spectrum and
send it to an Arduino for led goodness.

I am experiencing locks between the recording script and the audio
source, and while it is totally likely that I am not using the PA api
correctly, I can easily reproduce the same locking using
mplayer+pacat. I have experienced locking sometimes on a good laptop
(an i7 using PulseAudio 8.0 with Ubuntu 16.04) using the pa_simple api
,but running the things on a raspberry pi (using Raspbian Stretch and
PulseAudio 10.0) they are absolutely regular, and moving to the
asynchronous API didn't help.

In order to reproduce the lock it is enough to record on the source
monitor in one shell:

    pi at raspberrypi:~ $ pacmd list-sources | grep name:
             name: <alsa_output.platform-soc_audio.analog-stereo.monitor>

    pi at raspberrypi:~ $ pacat --record -d
alsa_output.platform-soc_audio.analog-stereo.monitor >/dev/null

...and run mplayer in another shell, stop it with Ctrl-C, and run it again:

    pi at raspberrypi:~ $ mplayer Cibo\ Matto\ -\ Flowers.mp3
    MPlayer 1.3.0 (Debian), built with gcc-6.2.1 (C) 2000-2016 MPlayer Team
    # [...]
    Starting playback...
    A:   5.5 (05.4) of 177.0 (02:57.0)  3.4%

    # Hit Ctrl-C here

    MPlayer interrupted by signal 2 in module: decode_audio
    Exiting... (Quit)

    # Run it again

    pi at raspberrypi:~ $ mplayer Cibo\ Matto\ -\ Flowers.mp3
    MPlayer 1.3.0 (Debian), built with gcc-6.2.1 (C) 2000-2016 MPlayer Team
    # [...]
    Starting playback...
    A:   0.1 (00.0) of 177.0 (02:57.0) ??,?%
    Audio device got stuck!
    A:   0.5 (00.4) of 177.0 (02:57.0) ??,?%
    Audio device got stuck!
    A:   0.5 (00.4) of 177.0 (02:57.0) ??,?%
    # [...]

FYI my python script, in its async incarnation, is at

    https://github.com/dvarrazzo/arduino/blob/89f53ca/tools/alsa2spectrum.py

I would be interested in writing a script reliable enough to run in
background to digest whatever is played on the device into coloured
lights. Is it possible? Is there any piece of documentation I have
missed?

Thank you very much.

-- Daniele


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux