©  Jan Newmarch 2017

Jan Newmarch, Linux Sound Programming, 10.1007/978-1-4842-2496-0_29

29. Jack and Karaoke

Jan Newmarch

(1)Oakleigh, Victoria, Australia

Jack is designed for professional audio. In this chapter you will apply the techniques from earlier chapters to building a karaoke system.

Using Jack Rack for Effects

Karaoke takes inputs from MIDI sources and from microphones. These are mixed together. Generally there is an overall volume control, but there is usually a volume control for the microphones as well. While the MIDI source should be passed straight through, it is common to apply a reverb effect to the microphones.

These are all effects that can be supplied by LADSPA modules (see Chapter 14). The Jack application jack-rack makes these plug-ins accessible to Jack applications so that LADSPA effects can be applied to Jack pipelines.

It is fairly straightforward to add a module to a session. Click the + button and choose from the enormous menu of effects. For example, choosing the Karaoke plug-in from the Utilities menu looks like Figure 29-1.

A435426_1_En_29_Fig1_HTML.jpg
Figure 29-1. Selecting Karaoke effect in Jack Rack

The following are some of the modules that might be relevant:

  • Karaoke (number 1409), which shows in the Utilities menu. This will attempt to remove center vocals from a music track.

  • There are a number of reverb modules that appear in the Simulators ➤ Reverb menu.

    • GVerb

    • Plate reverb

    • TAP Reverberator (from the TAP plug-ins)

    The TAP Reverberator seems to be the most full featured (but is not guaranteed to be in real time).

  • There are a number of amplifiers in the Amplitude ➤ Amplifiers menu.

Multiple modules can be applied in a single jack-rack application, and multiple applications can be run. For example, applying a volume control to a microphone and then applying reverb before sending it to the speakers can be done by adding the TAP reverberator and then one of the amplifiers. This looks like Figure 29-2.

A435426_1_En_29_Fig2_HTML.jpg
Figure 29-2. Jack Rack with reverb and amplifier plug-ins

I’m running this on a USB Sound Blaster TruStudioPro. This is only 16 bits, and I can’t seem to find a suitable Jack hardware configuration. So, I’m running Jack by hand using a plug device, which Jack complains about but works anyway.

jackd -dalsa -dplughw:2 -r 48000

Although gladish can see it under its Jack configuration menu, I haven’t managed to get gladish to accept the Sound Blaster as a setting. So far I can only manage to get Jack running under as a plug device, and gladish keeps swapping it back to a hardware device.

qjackctl does an OK job of saving and restoring sessions, starting jack-rack with its correct plug-ins and their settings, and linking it to the correct capture and playback ports.

Playing MIDI

The major synthesizer engines TiMidity and FluidSynth will output to ALSA devices. To bring them into the Jack world, Jack needs to be started with the -Xseq option or needs a2jmidid to be run.

You can try to manage the connections using the Jack session manager (for example, qjackctl). But this hits a snag using the MIDI synthesizers such as TiMidity or FluidSynth since they assume PulseAudio output rather than Jack output. Restoring a session fails to restore the synthesizer with Jack output.

You can try to manage the connections using LADSPA. Unfortunately, I have so far been unable to manage the Jack server settings using gladish. So, it starts Jack using the default ALSA settings and doesn’t use the -Xseq setting to map the ALSA ports to Jack. You need to start a2jmidid, and then it can successfully manage a session of, for example, timidity, jack_keyboard, and a2jmidid.

Even then, the connection diagram looks like a mess (Figure 29-3).

A435426_1_En_29_Fig3_HTML.jpg
Figure 29-3. LADISH playing MIDI

TiMidity Plus Jack Rack

In Chapter 28, you used TiMidity with a Jack back end and an Xaw interface to give a basic karaoke system. You can now improve on that by using Jack Rack effects.

  • Run TiMidity with Jack output and an Xaw interface, and synchronize the lyrics to the sound with this:

    timidity -ia -B2,8 -Oj -EFverb=0 --trace --trace-text-meta
  • Run Jack Rack with the TAP Reverberator and a volume control installed.

  • Connect ports using qjackctl.

The resulting system looks like Figure 29-4.

A435426_1_En_29_Fig4_HTML.jpg
Figure 29-4. TiMidity with Jack Rack

Customizing TiMidity Build

The version of TiMidity from the Ubuntu distro crashes if I try to dynamically load another interface. As the code is stripped, it is not possible to find out why. So, to add a new interface, you need to build TiMidity from source.

The commands I now use are as follows:

./configure --enable-audio=alsa,jack 
            --enable-interface=xaw,gtk
            --enable-server
            --enable-dynamic
make clean
make

An interface with a key, say “k,” can then be run with Jack output with the following:

timidity -d. -ik -Oj --trace  --trace-text-meta 54154.mid

Playing MP3+G with Jack Rack Pitch Shifting

The player VLC will play MP3+G files. Often the MP3+G is a zipped file containing both an MP3 file and s CDG file with the same root. This must be unzipped and then can be played by giving VLC the MP3 file name.

vlc file.mp3

This will pick up the CDG file and display the lyrics.

VLC can be used with Jack with the --aout jack option.

vlc --aout jack file.mp3

A common request for VLC is to have a “pitch control” mechanism. While it should be possible to add LADPSA pitch controls to VLC, no one has gotten around to it yet. But you can still add LADSPA effects through jack-rack.

The steps are as follows:

  1. You may need to stop PulseAudio temporarily with, for example, pasuspender cat.

  2. Start the Jack daemon running as usual with the following:

    jackd -d alsa
  3. Start qjackctl so you have some control over Jack connections.

  4. Start jack-rack. Using the + button, select Frequency ➤ Pitch shifters ➤ TAP Pitch Shifter. Don’t forget to enable it; it should look like Figure 29-5.

    A435426_1_En_29_Fig5_HTML.jpg
    Figure 29-5. Jack Rack with pitch shifter

    Note that in qjackctl, jack-rack shows as jack_rack (the minus has been replaced with an underscore), which is the proper Jack name of jack-rack. Connect the output of jack-rack to system.

  5. Now start vlc --aout jack so you can set up the correct configuration. Choose Tools ➤ Preferences, and in “Show settings” set the radio button to All. Then under Audio ➤ Output modules ➤ Jack, check “Automatically connect to writable clients” and connect to clients matching jack_rack (note the underscore). This should look like Figure 29-6.

    A435426_1_En_29_Fig6_HTML.jpg
    Figure 29-6. VLC selecting output client
  6. The next time you start vlc with, for example, vlc --aout jack BST.mp3, qjackctl should look like Figure 29-7.

    A435426_1_En_29_Fig7_HTML.jpg
    Figure 29-7. qjackctl with VLC connected to Jack Rack

The music should play through jack-rack where you can adjust the pitch.

Figure 29-8 shows the result of VLC playing MP3 audio through the pitch filter and also showing the CDG video.

A435426_1_En_29_Fig8_HTML.jpg
Figure 29-8. VLC playing through pitch shifter

Conclusion

This chapter discussed a number of ways of building Jack pipelines to add effects to MIDI and MP3+G files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset