audioalsagnuradiognuradio-companion

GNU Radio: Use sound output as input source


In gnuradio-companion I'm using the audio source block as my input signal for the next blocks. All works almost fine. The only little problem is that I'm getting the signal from my microphone (this is the normal behavior off course). I would rather like to get the audio signal being played directly without having to go through my speakers, the air from my room and the microphone.

All this generates signal losses and adds noise.

I know there is the file source block but this isn't a real solution for me.

I also know I could just plug a mini-jack cable from the output to the input from my sound-card. this isn't a solution either because it could damage the sound-card, and would still add distortion.

Currently I'm using Ubuntu and alsa as audio driver.

I know there are programs like jaaa and xoscope which are able to do this so I think what I'm asking for isn't that strange.


Solution

  • You will need build a "monitor" ALSA device.

    I found this ArchLinux wiki page which recommends the following procedure, which should apply to Ubuntu, too, as that also uses PulseAudio:

    pactl list|grep monitor
    

    pick the right monitor string, e.g. alsa_output.pci-0000_00_1b.0.analog-stereo.monitor. Then create (if it doesn't exist) and edit .asoundrc in your home directory:

    gedit ~/.asoundrc
    

    Add

    pcm.pulse_monitor {
      type pulse
      device <device name from above>
    }
    
    ctl.pulse_monitor {
      type pulse
      device <device name from above>
    }
    

    to that file.

    Now, use pulse_monitor as your device string in the Audio source. Works well for me (on Fedora 22): Screenshot

    EDIT:

    Added a GNU Radio wiki page about this.