Tag Archives: JACK

Guitar pedal in Gentoo

No updates in a while, I’ve been lazy. Here is a guide to setting up a Zoom G2.1u guitar pedal with JACK under Linux.

First thing you want to do is compile usb_snd_audio support in your kernel. I have already discussed how to do this, as it’s the same module you maybe have used to run a USB MIDI keyboard. Here is a post showing you how to do this: Gentoo and MIDI keyboard

Next, plug your guitar pedal in. Now to check everything is working as expected you need to cat /proc/asound/cards

$ cat /proc/asound/cards 
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xd2000000 irq 16
 1 [default        ]: USB-Audio - USB Audio CODEC 
                      Burr-Brown from TI               USB Audio CODEC  at usb-0000:00:1d.3-2, full s
 2 [K88            ]: USB-Audio - Keystation Pro 88
                      Evolution Electronics Ltd. Keystation Pro 88 at usb-0000:00:1d.1-1, full speed

Here we can see my Intel sound card (0), Zoom G2.1u pedal (1) and M-Audio Keystation Pro 88 (3). If yours is similar to this, you’re on the right track!

Now we need to start alsa_in. Basically, your guitar pedal is acting a sound card with only an input. We want to take this input, and redirect it straight to our main sound card (the one with the speakers connected!). In the this example, 1 is the Zoom G2.1u and 0 is my main sound card (as seen above). We start alsa_in like this:

$ alsa_in -j zoom -d hw:1 -c 1 -q 1

In this example, I have called the port zoom, using device 1, with one channel (since guitars are monotone anyway) and set the sample rate quality to 1. You can fiddle with these arguments, they work well for me.

Finally all we have to do is connect alsa_in to our output device. For this, we use jack_lsp to list all our JACK ports.

$ jack_lsp 
system:capture_1
system:capture_2
system:playback_1
system:playback_2
zoom:capture_1

We want to connect zoom:capture_1 to system:playback_1 and system:playback_2. For this we use jack_connect.

$ jack_connect zoom:capture_1 system:playback_1
$ jack_connect zoom:capture_1 system:playback_2

And with any luck, now when you play your guitar sound comes out your speakers! :)

JACK and Fluidsynth, the command line way!

I posted an entry about using Gentoo with a MIDI keyboard. In this post I used GUI apps to run jackd and fluidsynth… here is how to do it without these pesky GUI apps.

Follow the other post’s instructions for installing and setting up JACK and the snd_usb_audio kernel module. There is no need to install qjackctl or qsynth! I am using the init script on the Gentoo wiki to start JACK (here), as well as some other configurations to use JACK for all other sound (which I have posted here).

Now you have JACK started without qjackctl, it’s time to start Fluidsynth and connect everything together.

First start Fluidsynth with this command:

fluidsynth -a jack -g 1 -j ~/path/to/soundfont.sf2

“-a jack” makes fluidsynth use JACK.

“-g 1″ sets the gain to 1. This’ll boost the volume a bit. Play around, you may not need it. On my system it’s very quiet without this option set!

“-j” will automatically connect fluidsynth and JACK together.

Your soundfont will be loaded. Pay attention to any warnings about sample rates mismatching, this will cause tuning issues!

And finally we must connect your keyboard to fluidsynth. We will use ‘aconnect’, which comes with ALSA.

First get a list of all your input ports.

$ aconnect -i -l
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
	Connecting To: 15:0
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'Keystation Pro 88' [type=kernel]
    0 'Keystation Pro 88 MIDI 1'
    1 'Keystation Pro 88 MIDI 2'
$

And a list of all your outputs.

$ aconnect -o -l
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'Keystation Pro 88' [type=kernel]
    0 'Keystation Pro 88 MIDI 1'
client 128: 'FLUID Synth (22449)' [type=user]
    0 'Synth input port (22449:0)'
$

We can see our keyboard input on port 20 and fluidsynth output on port 128, so we connect them together using the command

$ aconnect 20 128

And we’re done! Enjoy.