2

Hello AskUbuntu community!

I've looked up a lot of Q&A here about loopbacks and sinks, but I'm new to Ubuntu and I can't seem to get things working the way that I need them to. It seems like I really need this explained to me like I'm a 5 year old who doesn't know linux terminology.

Rather than explain my guesses and perhaps confuse people or suggest an inferior solution, I'll describe my goal and what I know:

  1. Create a virtual sink/source "line" that I can select as a capture/input/recording source in a program like Audacity/Teamspeak/Skype/OBS
  2. Send my Blue Yeti USB microphone input to that line
  3. Send my VLC media player audio to that line
  4. Still be able to hear the music from VLC, so that I can adjust the volume per song

OR

  1. Use a pactl command or something that I'm not familiar with to pipe my VLC output into the same input stream as my Blue Yeti USB mic (perhaps this is possible?), or add the input of my Blue Yeti USB microphone to a combined output stream with VLC
  2. Pipe the combined stream (whether input or output) into Audacity/Teamspeak/Skype/OBS as an input/recording/capture source

Stuff I've seen on AskUbuntu:

1) Multiple loopbacks and sinks

pactl load-module module-null-sink sink_name=Virtual1
pactl load-module module-null-sink sink_name=Virtual2
pactl load-module module-loopback sink=Virtual1 
pactl load-module module-loopback sink=Virtual1 
pactl load-module module-loopback sink=Virtual2

Tested?

  • Yes, and it is partially functional.

Problems

  • My CPU load goes to 90-100% on all processor cores, and I basically can't do anything on my computer.
  • Also, the audio becomes robotic/choppy and skips periods of seconds.
  • Moreover, when one song ends, all of my settings for the piping from loopbacks to sinks gets reset in pavucontrol.

Hopes

  • Maybe something can be done with latency_msec or other settings (maybe buffers or frequency or something?) to reduce CPU load? When I was doing something with jackd one time by using the dbus plugin to take audio from pulseaudio, I was told to increase the frames/period setting to 512 to fix robotic/choppy audio, and that worked. The latency was 24msec as a result, but it sounded fine to me and wasn't a problem. It also didn't cause a high CPU load / slow my computer down.
  • Maybe there's also a way to turn what I want to do into a command thing for /etc/pulse/default.pa so that my settings won't be reset when a song ends.

Note

  • I don't need for the VLC sound or my mic to be sent to the recording/chat program right when I talk. A delay is fine, if that reduces CPU load.

2) Loopback between a source and a sink

pactl load-module module-loopback source=<name_or_index> sink=<name_or_index>

Tested?

  • No. I don't really understand it.

Hope

  • Maybe this could be used somehow to cut out some middle-men and reduce CPU load.

Thank you for any help you can provide!

  • 1
    Does this help? , try with a latency_msec=30 up to latency_msec=100 you may not notice the lag. – user.dz Feb 1 '16 at 18:14
  • @Sneetsher It's not quite as effective as I'd like, but it does help, and I can't seem to find anything else that makes what I want to do possible. Thanks! :) – JCopse Feb 8 '16 at 17:46
1

I've got it working with the command you listed at 2), using Arch Linux though. The command I used was:

pactl load-module module-loopback source=alsa_input.pci-0000_00_1f.3.analog-stereo sink=alsa_output.pci-0000_00_1f.3.analog-stereo

I found out the exact name of my Microphone/input and of my Stereo-Out/sink by using:

pactl list | grep -alsa 

ALSA if you were wondering stands for "Advanced Linux Sound Architecture" and is the Kernel module (driver) that gets loaded for my on-board sound.

To load this loopback module on startup I added a line to my default.pa (and also set my default-source/default-sink in it):

echo "load-module module-loopback source=alsa_input.pci-0000_00_1f.3.analog-stereo sink=alsa_output.pci-0000_00_1f.3.analog-stereo" >> /etc/pulse/default.pa

I used pavucontrol to verify that the loopback module was loaded and working in tab "Playback" and had to unmute it there.

Pulseaudio used about 2% CPU time (2 threads) while idle (no sound played/picked up) and about 6-8% when passing the sound through via loopback from the input. You may need root-privileges/sudo for certain commands above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.