Soundcard 'monitor' stream doesn't arrive with Spectrum plugin

Cefn Hoile lists.freedesktop.org at cefn.com
Mon Jun 18 12:19:23 PDT 2012


On 18 June 2012 17:11, Cefn Hoile <lists.freedesktop.org at cefn.com> wrote:
> On 18 June 2012 16:27, Stefan Sauer <ensonic at hora-obscura.de> wrote:
>> On 06/12/2012 04:25 PM, Cefn Hoile wrote:
>>> On 12 June 2012 14:40, Stefan Sauer <ensonic at hora-obscura.de> wrote:
>>>> On 06/12/2012 04:13 AM, Cefn Hoile wrote:
>>>>> I'm hoping to base a tutorial demo on the first python example linked
>>>>> below, and I attempted to test its logic by playing music from
>>>>> Rhythmbox through my (Ubuntu Oneiric) soundcard while visualising the
>>>>> result of the 'spectrum' FFT as changing numbers streaming on the
>>>>> console. Sadly this first debugging step was a failure.
>>>>>
>>>>> http://pzwart3.wdka.hro.nl/wiki/Spectrum.py
>>>>>
>>>>> The spectrum plugin loaded by this python script only ever reports -60
>>>>> decibels for every frequency band in the spectrum, regardless how loud
>>>>> I turn up the music!
>>>> You can change that:
>>>> spectrum threshold=-96
>>>>
>>>> Stefan
>>>>> I have tried both alsasrc and pulsesrc with various device names
>>>>> (default, pulse, the introspected alsa monitor device name from pactl)
>>>>> at the beginning of the listener_desc pipeline (declared in the linked
>>>>> code). In most of the cases I've tried (barring typos) the pipeline
>>>>> seems to be established and run perfectly fine (as far as I can tell)
>>>>> but somehow no sound frequencies show up in the frequency analysis
>>>>> from the spectrum plugin.
>>>>>
>>>>> Does this python code work for anyone else? How would I verify that
>>>>> the pipeline is correct, or narrow down the problem? Any suggestions
>>>>> what the initial source plugin or entire pipeline should in fact be on
>>>>> an Ubuntu system to get loudnesses per frequency range streaming out
>>>>> of the spectrum plugin to the console using this code as a reference?
>>>>>
>>>>> Thanks for any help.
>>>>>
>>>>> Cefn
>>>>> http://cefn.com
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.freedesktop.org
>>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> gstreamer-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>> Thanks for the suggestion, Stefan. You're right you can change it :)
>>> Now I get regular lines which report -96 instead of -60 ...
>>>
>>> data: -96.0 -96.0 -96.0 -96.0 -96.0 -96.0 -96.0 -96.0
>>>
>>> My current pipeline looks like this...
>>>
>>> pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" !
>>> spectrum threshold=-96 interval=1000000000 bands=8 ! fakesink
>>>
>>> ...and still the DB levels never vary depending on output from the soundcard.
>> Then I'd say there is a different problem. Are you sure you are
>> monitoring the right monitor-port?
>> Try gst-launch -e pulsesrc
>> device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" ! wavenc !
>> filesink location=monitor.wav
>> and check the resulting wav file.
>>
>> Stefan
>>>
>>> Cefn
>>> http://cefn.com
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> Based on the results of the test you suggest, it is indeed silent. It
> makes me think I must have the wrong audio device but then I don't
> know what other choices I have. Does monitor need to be activated
> somehow?
>
> If I run the following to see all the possible names pulseaudio can
> make sense of, I've tried all the values which appear and they all
> produce silent .wav files. As you can see from the 'RUNNING' output
> below, Gstreamer is able to activate the streams though.
>
> pactl list short sources
> 0       alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor        module-alsa-card.c      s16le
> 2ch 44100Hz     RUNNING
> 1       alsa_output.pci-0000_00_1b.0.analog-stereo.monitor      module-alsa-card.c      s16le
> 2ch 44100Hz     IDLE
> 2       alsa_input.pci-0000_00_1b.0.analog-stereo       module-alsa-card.c      s16le
> 2ch 44100Hz     SUSPENDED
>
> Any ideas for something to try? I believe I have a stock build (had no
> asound.conf or ~/asoundrc until just now when I was experimenting and
> trying an alsa force-reload according to
> https://wiki.archlinux.org/index.php/PulseAudio/Examples#ALSA_Monitor_source).

I have success!

Seeing all the reported problems with NVidia cards at
https://wiki.archlinux.org/index.php/PulseAudio/Examples#ALSA_Monitor_source
I checked to see if I had NVidia. I have dual audio combining Intel
and NVidia, which is probably subject to the bug at
ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html#_issues_in_pulseaudio

I speculatively installed Pavucontrol and turned off the HDMI output
(which wasn't being used by my audio programs anyway according to
pavucontrol). Restarted alsa and pulseaudio with 'alsa force-reload'
and suddenly GStreamer is responding to the monitor output from my
soundcard.

Thanks for the steer, it helped me along the way to a fix.

Cefn
http://cefn.com


More information about the gstreamer-devel mailing list