Midi input over jack capture on Linux

• Jun 5, 2011 - 19:39

Hello all.

The idea:
Use a midi input musescore connect to midi capture. To do this we will use alsarawmidi driver from jack server.
This is a great feature that Musescore must have too.
For understand better look the images they can speak more that im writing.

I will describe the goal, through of information from the terminal and some screens pictures.

This is a example of session initiated from terminal:

List of ports when jack session is started:

$ jack_lsp
system:capture_1
system:capture_2
system:playback_1
system:playback_2
system:midi_capture_1
system:midi_playback_1
midi-monitor:input

Observation To start jack using alsarawmidi you can do this:

$ jackd --sync -Xalsarawmidi -dalsa -r48000 -p256

At moment im using jackdmp 1.9.8.

What we want is connect system:midi_capture_1 to MuseScore inputs.

Example: having connection like in zynaddsubfx (Just a explain how musescore will work.)

List of ports using zynaddsubfx:

$ jack_lsp
system:capture_1
system:capture_2
system:playback_1
system:playback_2
system:midi_capture_1
system:midi_playback_1
midi-monitor:input
ZynAddSubFX:out_1
ZynAddSubFX:out_2
ZynAddSubFX:midi_input

The ZynAddSubFX:out_1 ZynAddSubFX:out_2
are connect to CASIO USB-MIDI IN (a system:midi_capture). And logically the zynaddsubfx audio output will connect
to system input audio. To understand better take a look in the image:


http://i55.tinypic.com/2u4uj54.png
This scenario state is simple: You play notes using midi keyboard and the zynaddsubfx will make the audio output.

OK
The musescore scenario

midi-input-musescore
http://i54.tinypic.com/2zz0xfs.jpg

This is the **better** scenario. With this we can insert notes through the midi keyboard into MuseScore using jack server. At the moment Musescore 1.0 offers only audio output, this feature will be used to reproduce the audio in the system sound.


$ jack_lsp -p
system:capture_1
properties: output,physical,terminal,
system:capture_2
properties: output,physical,terminal,
system:playback_1
properties: input,physical,terminal,
system:playback_2
properties: input,physical,terminal,
system:midi_capture_1
properties: output,physical,terminal,
system:midi_playback_1
properties: input,physical,terminal,
ZynAddSubFX:out_1
properties: output,terminal,
ZynAddSubFX:out_2
properties: output,terminal,
ZynAddSubFX:midi_input
properties: input,terminal,
Mscore1:left
properties: output,
Mscore1:right
properties: output,
Mscore1:mscore-midi-1
properties: output,
Mscore1:mscore-midi-2
properties: output,

The new Mscore:midi-input will connect to system:midi_capture_1 (in this examples are CASIO USB-MIDI 1 in) .

People, jack audio connection kit is a big friend to Linux Musicians and Audio Developers, musescore will add a great and fun feature in the future ;-)

Actually we do the midi input over alsa capture. This work, but some applications need wait MS release free the use of ports to work correctly, and using jack this will not happen anymore, with jack we can use another applications ( hmmm e.g: flash player, some audio player, etc), this is the goal: use musescore through jack with all power of musescore.

________________________
Now this is the actual scenario using alsa:

List of alsa input ports before to start MS:

$ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'CASIO USB-MIDI' [type=kernel]
0 'CASIO USB-MIDI MIDI 1'

List of alsa output ports before to start MS:

$aconnect -o
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'CASIO USB-MIDI' [type=kernel]
0 'CASIO USB-MIDI MIDI 1'
client 128: 'TiMidity' [type=user]
0 'TiMidity port 0 '
1 'TiMidity port 1 '
2 'TiMidity port 2 '
3 'TiMidity port 3 '

Here you have two options offered by the system. A physical keyboard midi CASSIO USB MIDI OUTPUT and the TIMIDITY OUTPUT PORT. The timidity is a service start automatically when system was started.

The goal is use midi capture , the CASIO USB-MIDI OUT connect to MUSESCORE INPUT. So we start the mscore.

List of alsa inputs after start musescore:

$ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'CASIO USB-MIDI' [type=kernel]
0 'CASIO USB-MIDI MIDI 1'
client 130: 'MuseScore' [type=user]
2 'MuseScore Port-0'
3 'MuseScore Port-1'
client 131: 'MuseScore' [type=user]
2 'MuseScore Port-0'
3 'MuseScore Port-1'

List of alsa outputs after start musescore:

$ aconnect -o
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'CASIO USB-MIDI' [type=kernel]
0 'CASIO USB-MIDI MIDI 1'
client 128: 'TiMidity' [type=user]
0 'TiMidity port 0 '
1 'TiMidity port 1 '
2 'TiMidity port 2 '
3 'TiMidity port 3 '
client 130: 'MuseScore' [type=user]
1 'MuseScore Port-0'
client 131: 'MuseScore' [type=user]
1 'MuseScore Port-0'

Image Musescore IO connections:

http://i56.tinypic.com/1zydhcn.png

These MuseScore inputs 130 and 131, will be connected to port 20 Cassio USB MIDI output.
A image of this state is most clear:

http://i52.tinypic.com/14jmhyc.png
This is a little confused but the image explain well. The system audio output is automatically connected by MS. I expect that im not change the words.

The midi is connected to ms and we can hear when we insert notes in score. And lets us hear how the music is going.

Attachment Size
jackconnections-midi-musescore.jpg 69.95 KB

Comments

I didn't test yet but next major of version of MuseScore (known as 2.0) should support JackMIDI as input and output. So what you describe here would be possible. If you are able to do so, you can compile MuseScore trunk on your computer and try it.

Do you still have an unanswered question? Please log in first to post your question.