The platform I'll be using throughout these posts is Ubuntu Studio 13.04 (64 bits), and first of all I wanted to write here the settings to properly and easily route all the sound generated in the computer.
Many standard applications use Pulseaudio, and only the more musically oriented ones (and not all) use JACK (JACK Audio Connection Kit), so it is interesting to know how to mix all of them together, so let's see some examples:
* Route pulseaudio stuff to JACK, so that we can, for example, listen to YouTube videos while making music with JACK-aware applications.
In UbuntuStudio, JACK Sink and JACK Source module are already installed, so the whole thing is very simple. We can start the JACK server with QJackCtl, and we will see that by default a connection from PulseAudio JACK Sink to system is already done, so JACK will route the audio of any application that goes to PulseAudio JACK Sink to the system for playback.
So now we just have to make sure that PulseAudio application will send their audio to the JACK Sink and all should be set. We do this with pavucontrol (PulseAudio Volume Control), and just select PulseAudio JACK Sink as the fallback output device.
With that in place, we both PulseAudio and JACK applications can live together happily.
* Routing audio input, for example to record a Skype call
In order to record a Skype call we also need to change the fallback input device in pavucontrol to be PulseAudio JACK Source. With the system -> PulseAudio JACK Source connection in QJackCtl, the microphone data will be sent to JACK Source, and after setting JACK Source as the fallback input device, Skype will get that as the input for the Microphone. At the same time we can record the whole conversation for example with Audacity by also connecting JACK Sink -> JACK Source (JACK Sink will give us the audio coming from skype, otherwise we would only record what is coming from our microphone). As an example:
When this is correctly set, we can add all sorts of extra routing to our audio. For example, in the previous example with Skype, perhaps we would like to add some filters to our voice? We only need to change the routing in QJackCtl, so we do not send the system directly to JACK Source, but we route it through some other module. In the following example, I route it through the application jack_rack in order to apply some basic distortion to it.
I think you get the idea by now...
By the way, in order to get the previous screencasts, I just used Kazam, and again selecting JACK Sink and JACK Source as the devices to record from, as can be seen below: