Audio recorder is Choosing wrong source with pulseaudio

Bug #1243442 reported by poe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Audio Recorder
Fix Released
High
moma

Bug Description

I am using kubuntu 13.04. And Pulseaudio is installed. When choosing a playback device, and recording, and going to pavucontrol,

the Audio recorder is taking input from "Built in Audio Analog Stereo"(screenshot 1- not recording) and recording nothing, when it should choose "Monitor of built in Audio Analog stereo"(screenshot 2-recording ) and when i change to that its recording. I am including two screenshots here..

Screenshot 1 = http://i.imgur.com/EyiP5DO.png

Screenshot 2 = http://i.imgur.com/YtjBVUy.png

Revision history for this message
moma (osmoma) wrote :
Download full text (3.9 KiB)

Hi,
Are the two pictures same?
Please send also picture of the main window when you open the device-list.
Alá: http://bildr.no/view/1305665

An interesting question.
There is always a possibility that the program picks a Sink(output) device-id instead of Source(input) device. We have to investigate the source-code and test a Gstreamer-pipeline from a command line.

The recorder uses PulseAudio to get a list of "Source" input-devices. Source devices can either be microphones (webcams, mic input on a soundcard, etc.) or so-called ".monitor" devices that point to a real audio-card.

Please study src/pulseaudio.c.
http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/pulseaudio.c

The function pa_get_device_lists_ext() loads IDs and Description of both Source(input) and Sink(output) devices. The program uses the Sink-list to read the audio-cards' real name/description. Then the Sink-list is never read or used again.
Please see void pa_get_device_lists() and its description.

Now, let's test the devices and recording from the command line?

0) First, take a listing of available "Source" devices with the pactl command.
pactl comes from the "pulseaudio-utils" package, so apt-get it first.

$ pactl list | grep -A2 'Source #'
Notice that the "Source" word may have been translated to your language (depending on the language settings), so check the listing with "pactl list" first.

Equally, you can also list the "Sink" devices, though we do not need them here.
$ pactl list | grep -A2 'Sink #'

1) Now you should have the IDs and Names/Descriptions of all Source-devices.
This is the device listing from my computer. I show only the device names/ids here. Ok?

$ pactl list | grep -A2 'Source #'
Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
(sound card1 we can record from / we can tap its output).

Name: alsa_input.pci-0000_00_1b.0.analog-stereo
(3.5mm mic input on a sound card1).

Name: alsa_output.pci-0000_06_01.0.analog-stereo.monitor
(sound card2 we can record from / we can tap its output).

Name: alsa_input.pci-0000_06_01.0.analog-stereo
(mic input on a sound card2).

Name: alsa_input.usb-Creative_Ltd._VF0610_WebCam<snip>.analog-mono
(webcam with microphone).

Some device names end with a ".monitor" label. These IDs can tap (record) audio from a real audio-card. Eg. in my case its Sink (output device) is "alsa_output.pci-0000_00_1b.0.analog-stereo" (only shown in the Sink-listing). This is the real sound-card with loudspeakers. We CANNOT record from it. BUT we can record from its ".monitor" device that is "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor". Ok?

2) Now, test the recording with various device names (in a terminal window).
Create a GStreamer pipeline for recording. Take the device id for the above listing and put it into the device="xxxx" argument. Like this:

$ gst-launch-1.0 pulsesrc device="alsa_output.pci-0000_06_01.0.analog-stereo.monitor" ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=test.oga

Play some music or speak to the microphone, etc!
Notice: the gst-launch command comes from "gstreamer1.0-tools" package. Sudo apt-get it.

Here the filesink location="test.oga", so it outp...

Read more...

Revision history for this message
moma (osmoma) wrote :

A small clarification.
The pactl command seems call the device IDs for Names. (ID would have been a better term).

moma (osmoma)
Changed in audio-recorder:
assignee: nobody → moma (osmoma)
Revision history for this message
poe (breakboss) wrote :

hi moma,

you are right. My apologies, the two pictures are the same. this is the second screenshot, where it was not recording = http://i.imgur.com/lKqvNyv.png

You are also right that the A.r is picking a sink device instead of a source device . these are the devices i got from commands you mentioned.
$ pactl list | grep -A2 'Source #'
Source #0
        State: IDLE
        Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
--
Source #2
        State: RUNNING
        Name: alsa_input.usb-046d_0825_8EAB4400-02-U0x46d0x825.analog-mono
--
Source #4
        State: RUNNING
        Name: alsa_input.pci-0000_00_1b.0.analog-stereo
raman@raman:~$ pactl list | grep -A2 'Sink #'
Sink #0
        State: RUNNING
        Name: alsa_output.pci-0000_00_1b.0.analog-stereo

$ pactl list | grep -A2 'Sink #'
Sink #0
        State: RUNNING
        Name: alsa_output.pci-0000_00_1b.0.analog-stereo

What I also did though, was use the following command I got from folks over at #pulseaudio on freenode.

$ pacmd set-default-source "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"

Which set my device default to the proper source.

Now in A.r, there is an option that shows up that says "Systems Default device", which immediately records properly. However the recording does not work for any other option like Built in audio analog stereo (output) or Spotify etc....

Revision history for this message
moma (osmoma) wrote : Re: [Bug 1243442] Re: Audio recorder is Choosing wrong source with pulseaudio

Re-hi,
Let us verify the pipeline.

1) Would you please run this pipeline in a terminal window.
I copied the device-id from your listing. Test this Gstreamer-pipeline:

$ gst-launch-1.0 pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-
stereo.monitor" ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink
location=test.oga

Then play some music.
Notice: the gst-launch command comes from "gstreamer1.0-tools" package.
Sudo apt-get it.

Now start pavucontrol, and check the device.
*Does it show the "monitor" or the ordinary sound-card device?*

Check also the output file.
$ aplay test.oga

Greetings
  Osmo (Moma) Antero
  Palmela / Portugal

On Wed, Oct 23, 2013 at 9:39 PM, poe <email address hidden> wrote:

> hi moma,
>
> you are right. My apologies, the two pictures are the same. this is the
> second screenshot, where it was not recording =
> http://i.imgur.com/lKqvNyv.png
>
> You are also right that the A.r is picking a sink device instead of a
> source device . these are the devices i got from commands you mentioned.
> $ pactl list | grep -A2 'Source #'
> Source #0
> State: IDLE
> Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
> --
> Source #2
> State: RUNNING
> Name: alsa_input.usb-046d_0825_8EAB4400-02-U0x46d0x825.analog-mono
> --
> Source #4
> State: RUNNING
> Name: alsa_input.pci-0000_00_1b.0.analog-stereo
> raman@raman:~$ pactl list | grep -A2 'Sink #'
> Sink #0
> State: RUNNING
> Name: alsa_output.pci-0000_00_1b.0.analog-stereo
>
> $ pactl list | grep -A2 'Sink #'
> Sink #0
> State: RUNNING
> Name: alsa_output.pci-0000_00_1b.0.analog-stereo
>
> What I also did though, was use the following command I got from folks
> over at #pulseaudio on freenode.
>
> $ pacmd set-default-source "alsa_output.pci-0000_00_1b.0.analog-
> stereo.monitor"
>
> Which set my device default to the proper source.
>
> Now in A.r, there is an option that shows up that says "Systems Default
> device", which immediately records properly. However the recording does
> not work for any other option like Built in audio analog stereo (output)
> or Spotify etc....
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1243442
>
> Title:
> Audio recorder is Choosing wrong source with pulseaudio
>
> Status in Audio Recorder:
> New
>
> Bug description:
> I am using kubuntu 13.04. And Pulseaudio is installed. When choosing a
> playback device, and recording, and going to pavucontrol,
>
> the Audio recorder is taking input from "Built in Audio Analog
> Stereo"(screenshot 1- not recording) and recording nothing, when it
> should choose "Monitor of built in Audio Analog stereo"(screenshot
> 2-recording ) and when i change to that its recording. I am including
> two screenshots here..
>
> Screenshot 1 = http://i.imgur.com/EyiP5DO.png
>
> Screenshot 2 = http://i.imgur.com/YtjBVUy.png
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/audio-recorder/+bug/1243442/+subscriptions
>

--
// moma
   http://www.futuredesktop.org

Revision history for this message
moma (osmoma) wrote :

Re-hi,
Let us verify the pipeline.

1) Would you please run this pipeline in a terminal window.
I copied the device-id from your listing. Test this Gstreamer-pipeline:

$ gst-launch-1.0 pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=test.oga

Then play some music.
Notice: the gst-launch command comes from "gstreamer1.0-tools" package. Sudo apt-get it.

Important: Start pavucontrol and check the device there.
*Does it show the "monitor" or the ordinary sound-card device?*

Check also the output file.
$ aplay test.oga

// Osmo (Moma) Antero
      Palmela / Portugal

Revision history for this message
poe (breakboss) wrote :

hi ,

1) I have checked the pipeline, it records from the ordinary sound-card device, and NOT the monitor.

2) I checked pavucontrol and it shows the ordinary sound-card device

3) The audio file test.oga is blank.

thanks.

Revision history for this message
moma (osmoma) wrote :

Hello,
Ok, the error must be in the configuration of PulseAudio.
Would you please erase and reset the configuration. Close pavucontrol and stop the recorder.

# Local PA settings are here:
ls -l ~/.config/pulse/

# Remove the entire directory. You may take a backup first.
rm -fr ~/.config/pulse/

# Kill and restart PA (no need for: pulseaudio -D).
pulseaudio -k

You may also send a question to PulseAudio devs about the configuration anomaly.
Ref: http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

$ man pulseaudio

Revision history for this message
moma (osmoma) wrote :

Check also the settings in pavucontrol, its [Configration] page.
Picture: http://bildr.no/view/QitXNytx

Revision history for this message
poe (breakboss) wrote :

hi,

I removed the entire pulse folder in ~/.config . And used pulseaudio -k.

That basically solved the problem. Now everything works as it should. Thank you so much for taking the time :)

poe

Revision history for this message
poe (breakboss) wrote :

I will also try to reproduce the error and forward the faulty config files to pulseaudio.

thanks again :)

Revision history for this message
moma (osmoma) wrote :

Ok, thank you too. This was an interesting issue.
Well done Poe.

Boa tarde.
Osmo (moma) Antero

On Thu, Oct 24, 2013 at 8:20 PM, poe <email address hidden> wrote:

> I will also try to reproduce the error and forward the faulty config
> files to pulseaudio.
>
> thanks again :)
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1243442
>
> Title:
> Audio recorder is Choosing wrong source with pulseaudio
>
> Status in Audio Recorder:
> New
>
> Bug description:
> I am using kubuntu 13.04. And Pulseaudio is installed. When choosing a
> playback device, and recording, and going to pavucontrol,
>
> the Audio recorder is taking input from "Built in Audio Analog
> Stereo"(screenshot 1- not recording) and recording nothing, when it
> should choose "Monitor of built in Audio Analog stereo"(screenshot
> 2-recording ) and when i change to that its recording. I am including
> two screenshots here..
>
> Screenshot 1 = http://i.imgur.com/EyiP5DO.png
>
> Screenshot 2 = http://i.imgur.com/YtjBVUy.png
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/audio-recorder/+bug/1243442/+subscriptions
>

--
// moma
   http://www.futuredesktop.org

Changed in audio-recorder:
importance: Undecided → High
status: New → Triaged
moma (osmoma)
Changed in audio-recorder:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.