2

Environment:

Ubuntu 18.04 USB headset with microphone

I listen to karaoke songs from Youtube in chromium on my headset and I sing along on the mic. Now I wish to simultaneously record the headset-output and my mic-input in audacity.

This link almost seems to work: https://superuser.com/questions/769249/how-to-record-both-input-and-output-audio-simultaneously. I am able to mix the audio as I want to.

I said almost. The problem is that, while the audio recording in audacity works, I cannot hear any music while I am singing.

Is there a workaround such that I can achieve the following?

  1. Chromium audio + mic gets recorded in audacity and
  2. Chromium audio also goes to headset.
Peter
  • 11,260
  • 14
  • 78
  • 155

1 Answers1

2

Yes, this can be done with a combination of two null-sinks and three loopback devices.

It's a bit easier to understand with a diagram: diagram1

The green blocks are the null sinks. The red lines are loopback devices.

Tip: Before continuing, turn your volume down on your headphones. Creating these objects can temporarily create a feedback loop. Don't worry, that will go away when we connect everything up as shown in the diagram.

Execute the following from a terminal to create the null-sinks and loopbacks:

pactl load-module module-null-sink sink_name=Virtual1 sink_properties="device.description='Chrome\ Splitter'"
pactl load-module module-null-sink sink_name=Virtual2 sink_properties="device.description='Chrome\ and\ Mic\ Combiner'"
pactl load-module module-loopback
pactl load-module module-loopback
pactl load-module module-loopback

Note that the sink name and description can be anything you want. The Description will appear in pavucontrol and make things a bit easier to configure.

You now need to wire everything up:

  • Launch Chrome and play your YouTube karaoke song. This will create an entry in the Playback tab of pavucontrol.
  • Launch Audacity and start a recording. This will create an entry in the Recording tab of pavucontrol.
  • Launch pavucontrol

On the Recording Tab configure the loopbacks as follows: Recording Tab

On the Playback Tab configure the loopbacks as follows: Playback Tab

My headphones are called Mpow H10, so choose whatever speaker or headphone output you want instead. Built in Analog Stereo is the microphone input. Again, choose whatever your mic is called in that selection.

That's it! You will now have the audio from your microphone and YouTube video mixed and captured in Audacity and hear only the Youtube audio in your headset.

If you want to know more how this works, here are some useful references:

Dodgyrabbit
  • 3,107
  • 3
  • 26
  • 28