21

I have a Korg Nanokey, and I'd like to make it produce sound in ubuntu. I've read that means I should be using Rosegarden, and that Rosegarden uses JACK, but does not install it. (Although checking out Ubuntu Software Center, apparently some components of JACK are installed by default?)

I understand there can be a lot of work setting up JACK without it fighting the default sound server. Can someone give me a step-by-step method for what I need to do to plug in my midi machine and hear music when I press keys as simply as possible (without messing up pulseaudio, ie, so I can still access Skype and ordinary desktop stuff)? I'm fine installing JACK, but I'd like to sandbox it a little if it has the chance of messing up regular desktop.

I've looked through a couple resources, but I'm not sure what's outdated, but the following looked helpful...

21

If you just want to get your keyboard to play sound, this is very simple, and you won't need JACK nor Rosegarden for that. These tools are great if you want to record MIDI signal, write notes, and route audio between separate applications, but you don't need that to play sound with your keyborard.

My step-by-step would be to:

  1. Plug in your MIDI device to your computer. If that's a USB MIDI keyboard, just plug the USB, if it has only MIDI plug, you may want to use a MIDI to USB device.

  2. Download/Install a synthesizer. There is a large variety of sound synthesing applications for Ubuntu. You may like ZynAddSubFX (really powerful one), FluidSynth or QSynth (support soundfonts), AMSynth, AMS. Make sure to browse Ubuntu Software Center for synthesizer that will grab your interest.

  3. Launch the synthesizer. Of course it has to be running to produce sound.

  4. Tell the system to pass data from your keyboard to the synthesizer. You need to create a link between your keyboard and your synthesizer, so that MIDI signal is passed to it. You can either use aconnect tool, or one of it's graphical backends (which are simpler to use), like aconnectgui or kaconnect. While aconnect is installed by default, you can get the other two from Software Center. Once you connect your keyboard, and synthesizer, follow to the final step...

  5. Press a key on your keyboard. You will hear some sound! If not, make sure if your system sound is not muted, and that our speakers are connected. Also, some synthesizers require you to choose an instrument before they produce any sound.

  6. Fine tune your synthesizer settings. You will most likely not enjoy the initial sound of the synthesizer. In case of ZynAddSubFX, this will be a plain sine wave, boring! However, you can easily browse a great collection of timbres, and you can customize them fully. All synthesizers provide you lots of customisation, it's worth to spend some time choosing what you like most.

  7. Proceed to play. Good luck and have fun!

I have also once written an article on general workflow for music production with external keyboard on Ubuntu, it should be useful in your case. Here's the link.

  • How do I set the links for aconnectgui? I accidentally connected a bunch of things together, I want to reset the links. – answerSeeker Mar 26 '15 at 2:55
  • @TatakaiWasumi Select the scissors tool and then left-click on a connection. It will 'cut' (i.e., delete) the connection. – holocronweaver Sep 3 '15 at 1:26
  • If you choose to qjackctrl, you can use the connections tab to route the synthesizer to output to the speakers (if it doesn't by default) and the USB MIDI input into the synth input. I had to do this when ZynAddSubFX failed to connect to the speaker output, and aconnectgui could not make this connection. – holocronweaver Sep 3 '15 at 1:28
  • I had to also add qjackctl in the pipeline to make qsynth produce actual sound. qjackctl can also perform step4 so aconnect is not needed in that case. Additional step in that case is to configure input/output devices in qjackctl by going setup->settings->advanced – chefarov Jun 10 '17 at 17:07
5

I don't know about Rosegarden, but you can run qjackctl from the package manager. Amsynth is an easy little way to make sound midi->jack.

I don't know how to run jack and pulseaudio at the same time - ie running chrome through jack (looking into it right now, actually). My experience in 12.04 is easy so far to make sound.

  • Install qjackctl and amsynth from the package manager
  • Shut down any web browsers or other pulseaudio things that could be taking the sound hardware
  • Start qjackctl (you may have to fiddle with params in settings but I didn't-this time)
  • Start Amsynth
  • In the ALSA tab of qjackctl (why is it not the midi tab ?!?!) connect your usb midi device (hopefully detected automatically) to Amsynth ...
  • Make sure amsynth is connected to the audio out ...
  • Play!
  • 1
    It's qjackctl not qjackctrl – answerSeeker Mar 26 '15 at 2:38
3

MIDI on Linux is highly modular and, as a result, initially overwhelming. It's nice to have a low-complexity solution working before you bother with optimizations, but unfortunately Ubuntu doesn't come with a default working configuration. Here's the simplest way that I have found...

sudo apt install qsynth vmpk ## install components
qsynth & vmpk ## launch
  • Qsynth -> Setup -> Sountfonts -> Open : FluidR3_GM.sf2
  • Virtual MIDI Piano Keyboard -> Edit -> Connections ->
    • Enable MIDI Thru on MIDI Output : (checked)
    • Input MIDI Connection : (Your Controller)
    • Output MIDI Connection : FLUID Synth

At this point, you should be able to play notes from either your external MIDI controller or from the virtual piano GUI (the GUI works even if you don't have an external controller).

From the Keyboard GUI you can select different instruments (see Program). From the Qsynth GUI you can manipulate the volume (see Gain) as well as Reverb/Chorus effects. There is also a Panic button in case the reverb goes off the rails.

This was specifically tested on clean install of Ubuntu Studio 18.04, but similar steps worked for Ubuntu MATE 16.04, with a notable automatic configuration difference being that Qsynth -> Setup -> Audio -> Audio Driver defaulted to jack in Ubuntu Studio but to alsa on Ubuntu MATE.


Glitchy static with ALSA [SOLVED]

On both 16.04 and 18.04, I have experienced weird static when Qsynth initially starts working with alsa. This static seems to affect all audio sources, but it somehow works itself out in a minute or two (at least partially).

I later tried this setup on a less powerful CPU and noticed a similar static that did not seem to resolve over time. [As an aside, I noticed that this static correlated with the ALSA plug-in [qsynth] line glitching in and out in the Applications tab of Sound Preferences].

This led me to play around with some Qsynth Settings, and I found something that seems to solve both static/glitch problems (maybe with a trade-off of a minor latency increase):

  • Qsynth -> Setup -> Audio -> Buffer Size : 128
  • Qsynth -> Setup -> Audio -> Buffer Count : 8

Apparently, the CPU can't always keep up with the required burst rate, so a little extra buffering is needed to prevent underruns. Presumably the are other settings that could also affect this.


vmpk loses its connection to Qsynth when the settings are changed. The quickest way to experiment with changing settings is to close and restart vmpk to force a reconnect.

  • After you have a basic setup working, you might be interested in some of the many options described here: Ted's Linux MIDI Guide – nobar Jun 17 '18 at 18:49
  • Note to self: Some controllers need to be powered on before you can use them. – nobar Jul 7 '18 at 19:18
  • Now if I could just figure out how to transpose the controller... – nobar Jul 9 '18 at 2:39
  • When using Ubuntu MATE, I've had best luck using 'alsa' rather than 'jack'. From Qsynth: Setup -> Audio -> Audio Driver -> alsa. – nobar Nov 18 '18 at 4:31
  • On both 16.04 and 18.04, I experienced weird static when Qsynth initially starts working with alsa -- but it somehow works itself out in a minute or two. – nobar Nov 18 '18 at 4:34
1

Find out about your sound card:

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC3235 Analog [ALC3235 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

We will be using card1, device0, thus hw:1,0

My pipeline scenario that finally worked, using jack-control (qjackctl) and qsynth was:

  1. Install jack-tools, jack-server, qsynth
  2. Open up qsynth and go to Setup. In MIDI tab, I select Midi Driver: alsa-seq. In Audio tab I select Audio Driver: jack.
  3. Fire up jack server with

    jackd -R -d alsa -d hw:1,0

  4. Open qjacktctl and:

4.1 Go to Connect -> ALSA. In the left column find out your keyboard and connect it to qsynth that lies in the right column. Also make sure that in the first column (AUDIO), qsynth is connected to your speakers (right column).

4.2 Back in the main qjackctl window Go to setup->settings->advanced and in the right column, choose Output Device (speakers) and Input Device (Midi keyboard)

By this step I was able to hear my keyboard. An overall screenshot of the setup follows

enter image description here

PS: In this scenario no other application can use the speakers at the same time.

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.