You are not logged in.

#1 2009-05-06 09:46:31

calle
Member
From: Germany
Registered: 2008-11-14
Posts: 45

Keycodes of USB Piano

Hey there,

i got myself a little USB MIDI Keyboard (M-Audio), and have problems getting it to work properly. I can actually play but the sound comes with about half a second delay. As I don't have the time and patience and knowledge to build myself a realtime kernel (which i thought my be helpful), i thought, maybe it could be a solution to use a virtual piano and use the hardware piano plainly as a keyboard sending keycodes to the virtual piano that is then producing the sound. Unfortunately I have no idea how to achieve this as xev doesn't return any keycodes for the piano. Is there a way to do this, or do i have to go into kernel customizing?

thanks in advance

Offline

#2 2009-05-06 10:01:38

jochen
Member
From: Germany
Registered: 2004-06-01
Posts: 102

Re: Keycodes of USB Piano

Hi Calle,

you don't need build a new kernel, the stock kernel should provide you with a latency much below half a second (p.e. 10ms). It's just a matter of the right setup. What application are you using with your midi keyboard? Are you using jackd -- what parameters?

Offline

#3 2009-05-06 16:23:33

calle
Member
From: Germany
Registered: 2008-11-14
Posts: 45

Re: Keycodes of USB Piano

hi,
yes i am using jackd. in the setup it predicts a latency of 5.33 msec. setup is: 128 frames/period, priority 89, realtime is checked, midi-driver: seq.
of the other options i don#t know what they do and whether they change anything. any further help would be appreciated.

interestingly i noticed that the latency is lower if the jack server is not started, but in the connections window ALSA-MIDI a connection between the keyboard and timidity is established. this seems strange to me, as i can disconnect the two and then hear nothing. how can jack control anything if it is not running?

Offline

#4 2009-05-06 17:47:03

denisfalqueto
Member
From: ES, Brazil
Registered: 2006-03-24
Posts: 197

Re: Keycodes of USB Piano

Hello Calle.

I have this same problem, but with a normal musical keyboard and a cheap usb midi cable. I've even compiled a real time kernel, but it was not enough. Just telling so you don't waste your time too smile

In fact, the jackd latency is not very important for the midi processing (of course, the lesser, the better) but there should be some way to achieve some decent midi performance with the usb interface. What I have now is that I can't play more than two notes at the same time and they get stuck very easlily. I think that usb midi handling in Arch is a little problematic, so I'll try to install UbuntuStudio as soon as possible to see if they handle it better. I'll report back when I have any important result.


Satisfied users don't rant, so you'll never know how many of us there are.

Offline

#5 2009-05-07 06:16:19

jochen
Member
From: Germany
Registered: 2004-06-01
Posts: 102

Re: Keycodes of USB Piano

calle wrote:

yes i am using jackd. in the setup it predicts a latency of 5.33 msec. setup is: 128 frames/period, priority 89, realtime is checked, midi-driver: seq.

ok, that looks good.


My recommendation is: don't use timidity but rather qsynth (fluidsynth). Then:

* start jackd with qjackctl
* start qsynth
* load a soundfont and start the synth
* use qjackctl to connect your midi keyboard to qsynth

Offline

#6 2009-05-07 08:30:23

calle
Member
From: Germany
Registered: 2008-11-14
Posts: 45

Re: Keycodes of USB Piano

hi,

thank you a lot jochen! i now use fluidsynth ( qsynth started with an error about not being able to initialize the midi-driver or something like that) and it works fine! that is there is no noticeable latency anymore. denisfalqueto, maybe you should try this first, before considering using ubuntu instead.

however there are still some issues. biggest: i am not able to load big soundfonts. fluidsynth prompts me an "out of memory" error on those, and i cannot find a solution to that. any ideas?
and still i'm having a lot of xruns in jackd (83 within half an hour). again any clue?

thank you so far!

EDIT:

when running jack and fluidsynth as superuser, i can load big soundfonts and interestingly i don't get a single xrun. Why is that? i usually don't like running applications as superuser and i am sure that in this case there is some way to get the same result as ordinary user. problem is, i have no clue how

Last edited by calle (2009-05-07 14:53:21)

Offline

#7 2009-05-07 15:27:41

calle
Member
From: Germany
Registered: 2008-11-14
Posts: 45

Re: Keycodes of USB Piano

got it now.

for everyone who's interested (denisfalqueto maybe): the solution was simple, as it is so very often, and hasn't been found earlier because of my blindness.
for the jack performance i had to raise the rt-priority in /etc/security/limits.conf to 99 (which i now remembered) and for the big soundfonts in fluidsynth i had to raise the memlock in the same file. both for the audio group that is. et voila! works now. i can even use qsynth now.

thank you jochen for your pointing in the right direction

Offline

#8 2009-05-07 19:32:19

denisfalqueto
Member
From: ES, Brazil
Registered: 2006-03-24
Posts: 197

Re: Keycodes of USB Piano

Ah, good to know that you solved it, Calle. I'll try that too, but I suspect that my usb midi cable is Pure Crap (TM). That's why I want to test it in another environment. May the gods want that it is only a configuration issue, but something inside me just tells that the cable is the culprit. I am away from my system right now, so I can't confirm if the rt limits are right.

Thank you.


Satisfied users don't rant, so you'll never know how many of us there are.

Offline

Board footer

Powered by FluxBB