m1gin 183

Jack Audio


Create a new client / port for jack audio:

  • pacmd load-module module-jack-source channels=2;
  • pacmd load-module module-jack-sink channels=2;

Disconnect ports/clients:

  • jack_disconnect "system:capture_1" "PulseAudio JACK Source-01:front-left"

Running jack with 44.1KHz for Ardour

Sometimes jack can't start with 44.1KHz but 48KHz. I am not sure but the reasan may be the sound card doesn't support 44.1KHz. In that case, opening an Ardour project was created with 44.1KHz, cause some problems.

To fix the problem we can start jack with dummy driver.

jackd -d dummy -r 44100

It is also possible to use qjackctl to start jack with dummy driver.

After that we can create some clients that appear in qjackctl connections.

  • alsa_in -d hw:0 -r 48000 -j extra_in
  • alsa_out -d hw:0 -r 48000 -j extra_out

And finally we can start Ardour project and connect Ardour's Master out ports to the newly created client named as extra_out in jack.

jack_connect "ardour:Master/audio_out 1" "extra_out:playback_1"
jack_connect "ardour:Master/audio_out 2" "extra_out:playback_2"

qjackctl can also be used for connections.


Adding USB Microphone to Jack clients:

I want to add my Zoom H5 USB microphone to Jack clients to be able to use it. First of all let's list the capture devices:

arecord -l

My card number is 2. I will use this number in the next command:

alsa_in -j ZoomH5 -d hw:2

And at the result I see my ZoomH5 client in the jack connections.

Error Handling:

I got an error message while running the command.

$ alsa_in -j ZoomH5 -d hw:2

Cannot lock down 82280346 byte memory area (Cannot allocate memory) Capture open error: Device or resource busy

To solve this, I added current user to audio group and logout and login.

sudo usermod -a -G audio ${USER}

But I still got the error

Capture open error: Device or resource busy

To solve this, I opened Volume Control and went to Configuration tab and set the Profile Off for the the USB microphone. After that the problem fixed.


References:


Pulse Audio

TIP: When typing pactl and pacmd commands, TAB TAB can be used to see available options.


List available outputs:

pacmd list-sinks

Set default output device:

  • pacmd set-default-sink jack_out
  • pacmd set-default-sink 5

To set default input source channel/device:

  • pacmd set-default-source jack_in
  • pacmd set-default-source jack_out.2.monitor
  • pacmd set-default-source 1 # 1: microphone or 0: monitor


Mute / Unmute default input:

pactl set-source-mute @DEFAULT_SOURCE@ toggle

Change volume of default output:

pactl set-sink-volume @DEFAULT_SINK@ +5%


Restart pulse audio

  • pulseaudio -k
  • pulseaudio --start


List active apps for playback:

pacmd list-sink-inputs | tr '\n' '\r' | perl -pe 's/ *index: ([0-9]+).+?application\.name = "([^\r]+)"\r.+?(?=index:|$)/\2:\1\r/g' | tr '\r' '\n'

List active apps for recording

pacmd list-source-outputs | tr '\n' '\r' | perl -pe 's/ *index: ([0-9]+).+?application\.name = "([^\r]+)"\r.+?(?=index:|$)/\2:\1\r/g' | tr '\r' '\n'


Change source for mumble and use jack:

pactl list source-outputs | while read -r line ;
do
g=$(echo $line | grep -oP 'Source Output #\K[^$]+');
[ "$g" != "" ] && idx="$g";

g=$(echo $line | grep -oP 'application.process.binary = "\K[^"]+');
[ "$g" != "" ] && app="$g";

#echo $line | grep -oP 'application.process.id = "\K[^"]+';

echo $idx : $app

if [ "$app" == "mumble" ]; then
pactl move-source-output $idx jack_in;
app="";
fi;
done


Recording Stereo Mix (Test Edildi!)

Mikrofon sesini aşağıdaki komutla eşzamanlı dinlemek mümkün:

parec --latency-msec=1 | pacat --latency-msec=1

Bu hal üzere, monitor üzerinden kayıt alınarak, mikrofon ve sistem seslerinin eşzamanlı kaydedilmesi sağlanabilir.

http://ubuntuforums.org/showthread.php?t=2123423

Redirect microphone output to speaker:

pactl load-module module-loopback latency_msec=1'

To stop the routing of audio from Microphone to Speaker:

pactl exit

https://www.lynxbee.com/how-to-stream-microphone-audio-to-laptop-speaker-on-linux-ubuntu/


Noise / Echo Cancelling in PulseAudio

Load echo/noise cancel module and give it a name

pactl load-module module-echo-cancel source_name=testsource

Then it will be available in recording tab of sound mixer. it eliminates the background noise and microphone statics too much.

To set it as default source:

pactl set-default-source testsource




#ubuntu #sound #audio #input #output #mixer #soundcontrol #pulseaudio #jackaudio

Add to: