Discussion:
[Wine] Kontakt doesn't respond to Akai USB MIDI Keyboard
Cosmo Lee
2010-08-18 21:09:48 UTC
Permalink
Ubuntu 10.4, Wine 1.1.42, Native Instruments Kontakt 4, Akai MPK88

I've installed Kontakt (sampled musical instruments). Sound is working OK with the OSS driver, but the program doesn't respond to the USB keyboard. :-
( The keyboard shows up in `winecfg` under "Audio", OSS, MIDI In/Out devices.

I checked the MIDI options for the Kontakt program and it DOES show the Akai keyboard - so the program knows the keyboard exists. I've got it set so that
device "Midi 1" is set to "Port A". I've also tried setting to ports b,c,d, but no luck.

I don't have jack or ASIO running yet as I want to troubleshoot one thing at a time.

Is there something additional that needs to be done for USB MIDI keyboards to work under Wine?

TIA,
Cosmo
jordan johnston
2010-08-19 01:09:23 UTC
Permalink
Post by Cosmo Lee
Ubuntu 10.4, Wine 1.1.42, Native Instruments Kontakt 4, Akai MPK88
I've installed Kontakt (sampled musical instruments).  Sound is working OK with the OSS driver, but the program doesn't respond to the USB keyboard. :-
( The keyboard shows up in `winecfg` under "Audio", OSS, MIDI In/Out devices.
Why aren't you using ALSA???? you will want to expose Kontakt/wine to
the alsa driver,
snd-usb-audio. This driver is plug and play with the AKAI MPK. I own the MPK49.
OSS is sort of a dying driver, ALSA/Jack is what you will want.
Also, i am not sure if OSS even would implement midi for our devices....
Post by Cosmo Lee
I checked the MIDI options for the Kontakt program and it DOES show the Akai keyboard - so the program knows the keyboard exists.  I've got it set so that
device "Midi 1" is set to "Port A".  I've also tried setting to ports b,c,d, but no luck.
I don't have jack or ASIO running yet as I want to troubleshoot one thing at a time.
You will want to get both Jack running, probably jack2 (1.9.5) and the
Latest WineASIO code
compiled and installed. Kontakt works great in linux.
Post by Cosmo Lee
Is there something additional that needs to be done for USB MIDI keyboards to work under Wine?
Nope, just use alsa, and select it in winecfg as your audio driver.
from there everything
should work perfect. The usb midi will work fine, just make sure your
keyboard is plugged in before you open your wine app, otherwise it may
not show up. In the end you will want to use jack for audio apps like
this, just so you know!

I use All of my Native Instruments plugins under Linux.

jordan
iliverez
2010-09-07 10:34:45 UTC
Permalink
Hi Jordan,

I can use kontakt with wine (wineasio, etc), but it is difficult to achieve
low latency for playing with a midi keyboard without pops and clicks. I have
even tried wine with the wine-rt patch. Could you provide some information
about your system (cpu, memory, audio interface) and jack and kontakt/wine
configuration?

Also, when using larger buffers and driving kontakt from a software
sequencer, e.g. tuxguitar, I usually get distortions when playing chords.

I use a dual core Athlon 5200+, 3gb ram, M-Audio 2496 with 32 bit real time
kernel PAE (AV Linux 4). I mostly run kontakt as a VST plugin with vsthost,
since I cannot "see" the midi inputs when running as standalone.

Could you also post which instruments/libraries/NI plugins you use and work
fine?

Thanks,
Yiannis
--
View this message in context: http://wine.1045685.n5.nabble.com/Kontakt-doesn-t-respond-to-Akai-USB-MIDI-Keyboard-tp2640128p2805914.html
Sent from the Wine - Users mailing list archive at Nabble.com.
jordan
2010-09-08 00:15:29 UTC
Permalink
Hello,
Post by iliverez
I can use kontakt with wine (wineasio, etc), but it is difficult to achieve
low latency for playing with a midi keyboard without pops and clicks. I have
even tried wine with the wine-rt patch. Could you provide some information
about your system (cpu, memory, audio interface) and jack and kontakt/wine
configuration?
The clicks and pops could be caused by poor irqbalancing, shared IRQs
or something is getting higher priority
than your audio stuff, and causing interference. one of your
schedulers might need some adjusting, depending.
how about your alsa.conf??? any of your own configurations.
One that might be important in this context is:

"options snd_usb_audio nrpacks=1" - usb runs at full speed (if your
midi-keyboard/audio device is using USB).

Do you use anything in /etc/fstab to speed up your HD, as well as
minimizing disk-writes? this may affect Kontakt,
as it can potentially be accessing your harddisk, quite a bit. are you
using DFD in Kontakt, or running samples from memory (from memory is
often better, although it will eat up your RAM) I minimize my DFD
usage...

as i do not own m-audio, i am not sure of the best settings there, i
would experiment, or look around forums for the ideal settings. i
would use lower quality settings, with lowest latency and work my way
up from 44100-16bit to 96-24bit.

Right now, i am using; ( i say right now, because i am building a
much faster, rackmount PC )

Dell Inspiron 6400, 1.6 CoreDuo, 1gig DDR2 ram. 320gig SATA.
I have an IntelHDA(STAC9200) and an Edirol FA-101(firewire).
(Not very high-specs but works just fine, this was my testing ground
before i bought my rack.)

Fedora 13 (with Planet CCRMA packages, minus the CCRMA kernel)
my kernel: 2.6.34-zen2.i686 (Zen-kernel compiled,
customized/optimized by me) with some CFLAGS for optimizations, like
compiling native to my CPU only, and i select only modules my system
requires ("make localmodconfig") I also use some fairly harsh
optimizations, which i can't recommend. i have to modify kernel code,
before compiling, so that it doesn't break and not boot, and so my
wireless driver works properly. lol.

-kernel with preemption enabled, but I do NOT use igno-molnar's
rt-patches, nor rtirq.
-I do NOT use Irqbalance ( i balance them manually, and save my
configuration in /etc/rc.local for startup)
-I use the "BFS cpu-scheduler", finely-tuned for low-latency. (again
tuning saved in rc.local for startup)
-I use BFQ IO-scheduler, tuned for optimal IO operation on a SMP
system. (again rc.local)

Jack 1.9.6 (compiled myself)
-"classic Jack", as in no jackdbus or ladish...
- I use Jack-midi always, unless i am using wineASIO with a standalone
app. wineASIO uses ALSA-midi.
which is usually fine if i am playing keyboard live, just keep
jack's frames small.
- start jackd/qjackctl with: "/usr/bin/jackd -P89 -p128 -t8000 -dalsa
-dhw:0 -r44100 -p128 -n2 -P -Xseq" (intelHDA).
(i also disable audio in, in alsamixer, as if i am recording
audio-in i won't be using IntelHDA anyway)
- i'll have get back to you on my firewire startup (it's not in front
of me, right now).
- * I also run Qjackctl with the command 'schedtool -I -e qjackctl'.
what this does is use a feature in BFS, that will give jackd and all
of it's threads a higher priority. it is called SCHED_ISO. Jack's main
thread will use FIFO, but all others will use SCHED_ISO, which has a
global setting of "75" on my machine.

In my kernel config, for Zen-kernel(www.zen-kernel.org), there is a
setting to SCHED_ISO on X(xorg). I DONT use this setting, as my audio
needs priority above everything. this way i experience smooth audio,
no interference from my system. I can even use wireless while making
music, without it causing xruns.(which is known to happen).

*** Wine 1.3.1 (compiled by me, standard version/not RT-wine)
- i only select features i am using. ie: no pulseadio, ISDN, etc.
- Useful Registry Keys: AlsaDriver--->UseDirectHW
- Only ALSA selected in winecfg
- all debugging turned off. either in the registry or "WINEDBG=-all".
- Winetricks, when needed too.
-other performance tweaks, i can't think of off-hand.

My setup, isnt exactly run of the mill or the standard for RT,
pro-audio in Linux. But on this machine, my method works awesome. I do
know how to optimize the standard schedulers + RT, and i still do
compare the two, but the way i am doing it, seems to be best for me. I
can make music for hours and hours without problems, and i can record
tracks in ardour just great...
Post by iliverez
Also, when using larger buffers and driving kontakt from a software
sequencer, e.g. tuxguitar, I usually get distortions when playing chords.
interesting, i've never used tux-guitar. I do experience distortion on
chords if alsamixer is set higher than about 75-80% (80% is actually
100% gain, so above and beyond that, is actually over-driven in ALSA).
i would try lowering your gain, and also the gain in Kontact, until it
doesn't distort anymore. if that isn't the case, use smaller frames.
I always use 128, even when running 3-4 synths with FX, or editing
12tracks in ardour, while recording a synthline..
I only use larger frames, when doing "post-production", like FX,
automation and mastering.
my "craptop" with "the dreaded intelHDA"(so they say) almost is always
happy with 128frames. I keep mentioning the IntelHDA, because i
actually use it more than Firewire. As carrying around the FA-101 to a
jam, isn't really required. it is only handy for recording multiple
audio tracks at once.
I use a combination of "jacker" - a small midi-tracker for some
sequencing (it's very lite) and i use seq24 sometimes as well. then, i
just record right into ardour, with some cut and paste techniques,
bouncing tracks.
the kind of thing you do on slower machines. (like i used to do in
Protools on my old G4 mac)
Post by iliverez
I use a dual core Athlon 5200+, 3gb ram, M-Audio 2496 with 32 bit real time
kernel PAE (AV Linux 4). I mostly run kontakt as a VST plugin with vsthost,
since I cannot "see" the midi inputs when running as standalone.
Nice hardware :)

as Standalone with WineASIO - you need to have midi-seq enabled in
Jackd. then you will see midi, under the ALSA tab in Jack.
Yiannis Liverezas
2010-09-08 13:05:08 UTC
Permalink
Post by jordan
Hello,
Post by iliverez
I can use kontakt with wine (wineasio, etc), but it is difficult to achieve
low latency for playing with a midi keyboard without pops and clicks. I have
even tried wine with the wine-rt patch. Could you provide some information
about your system (cpu, memory, audio interface) and jack and kontakt/wine
configuration?
The clicks and pops could be caused by poor irqbalancing, shared IRQs
or something is getting higher priority
than your audio stuff, and causing interference. one of your
schedulers might need some adjusting, depending.
I will check this further. In fact, I use two soundcards at the same
time, the motherboard's one at irq22 and the M-Audio at irq19. However,
when dealing with audio production, I use jack only with M-Audio. The
intelHDA just rests idle. First step will be to completely disable the
MB soundcard from the BIOS. I will investigate if the relative irqs are
shared with other devices.
Post by jordan
how about your alsa.conf??? any of your own configurations.
"options snd_usb_audio nrpacks=1" - usb runs at full speed (if your
midi-keyboard/audio device is using USB).
I will check this also, although the only physical midi connection I
have currently is from the Roland-TD4 Vdrum midi-out to the midi-in
socket of the M-Audio, no USB device. However, in the past, when running
Fedora 11 with CCRMA packages and using an ESI USB->midi cable,
performance was awful. For keyboards, strings or whatever else I use
VMPK or a sequencer, until I get a real keyboard ;)
Post by jordan
Do you use anything in /etc/fstab to speed up your HD, as well as
minimizing disk-writes? this may affect Kontakt,
as it can potentially be accessing your harddisk, quite a bit. are you
using DFD in Kontakt, or running samples from memory (from memory is
often better, although it will eat up your RAM) I minimize my DFD
usage...
If available, I use the sampler mode. Are you aware of specific tweaks
in /etc/fstab that I could use?
Post by jordan
as i do not own m-audio, i am not sure of the best settings there, i
would experiment, or look around forums for the ideal settings. i
would use lower quality settings, with lowest latency and work my way
up from 44100-16bit to 96-24bit.
I will continue experimenting. Currently, I have got the best results
with 96000 16bit and 256 frames. However, using vsthost (dssi-vst) with
superior drummer works flawlessly in many other combinations, even when
using large samples (totalling ~1.2GB).
Post by jordan
Right now, i am using; ( i say right now, because i am building a
much faster, rackmount PC )
Dell Inspiron 6400, 1.6 CoreDuo, 1gig DDR2 ram. 320gig SATA.
I have an IntelHDA(STAC9200) and an Edirol FA-101(firewire).
(Not very high-specs but works just fine, this was my testing ground
before i bought my rack.)
So my hardware should be adequate for running Kontakt.
Post by jordan
Fedora 13 (with Planet CCRMA packages, minus the CCRMA kernel)
my kernel: 2.6.34-zen2.i686 (Zen-kernel compiled,
customized/optimized by me) with some CFLAGS for optimizations, like
compiling native to my CPU only, and i select only modules my system
requires ("make localmodconfig") I also use some fairly harsh
optimizations, which i can't recommend. i have to modify kernel code,
before compiling, so that it doesn't break and not boot, and so my
wireless driver works properly. lol.
-kernel with preemption enabled, but I do NOT use igno-molnar's
rt-patches, nor rtirq.
-I do NOT use Irqbalance ( i balance them manually, and save my
configuration in /etc/rc.local for startup)
-I use the "BFS cpu-scheduler", finely-tuned for low-latency. (again
tuning saved in rc.local for startup)
-I use BFQ IO-scheduler, tuned for optimal IO operation on a SMP
system. (again rc.local)
Could you post or send me your configurations for rc.local?
Post by jordan
Jack 1.9.6 (compiled myself)
-"classic Jack", as in no jackdbus or ladish...
- I use Jack-midi always, unless i am using wineASIO with a standalone
app. wineASIO uses ALSA-midi.
which is usually fine if i am playing keyboard live, just keep
jack's frames small.
- start jackd/qjackctl with: "/usr/bin/jackd -P89 -p128 -t8000 -dalsa
-dhw:0 -r44100 -p128 -n2 -P -Xseq" (intelHDA).
(i also disable audio in, in alsamixer, as if i am recording
audio-in i won't be using IntelHDA anyway)
- i'll have get back to you on my firewire startup (it's not in front
of me, right now).
I tried these settings, both with the intelHDA and the M-Audio, but no
real progress was achieved.
Post by jordan
- * I also run Qjackctl with the command 'schedtool -I -e qjackctl'.
what this does is use a feature in BFS, that will give jackd and all
of it's threads a higher priority. it is called SCHED_ISO. Jack's main
thread will use FIFO, but all others will use SCHED_ISO, which has a
global setting of "75" on my machine.
I will try this tonight. Should I suppose that this is connected with
the above mentioned configurations in rc.local?
Post by jordan
In my kernel config, for Zen-kernel(www.zen-kernel.org), there is a
setting to SCHED_ISO on X(xorg). I DONT use this setting, as my audio
needs priority above everything. this way i experience smooth audio,
no interference from my system. I can even use wireless while making
music, without it causing xruns.(which is known to happen).
Interesting, I will check the AVLinux kernel build options
Post by jordan
*** Wine 1.3.1 (compiled by me, standard version/not RT-wine)
- i only select features i am using. ie: no pulseadio, ISDN, etc.
This may make a difference, I use wine 1.2
Post by jordan
- Useful Registry Keys: AlsaDriver--->UseDirectHW
Tried this, but had no obvious effect
Post by jordan
- Only ALSA selected in winecfg
- all debugging turned off. either in the registry or "WINEDBG=-all".
I also use this option. With debug enabled, I noticed that moving
Kontakt in a separate workspace or minimizing its window improves
performance. Actually when the window is not actively rendered most of
the debug messages are not generated anymore.
Post by jordan
- Winetricks, when needed too.
-other performance tweaks, i can't think of off-hand.
My setup, isnt exactly run of the mill or the standard for RT,
pro-audio in Linux. But on this machine, my method works awesome. I do
know how to optimize the standard schedulers + RT, and i still do
compare the two, but the way i am doing it, seems to be best for me. I
can make music for hours and hours without problems, and i can record
tracks in ardour just great...
Post by iliverez
Also, when using larger buffers and driving kontakt from a software
sequencer, e.g. tuxguitar, I usually get distortions when playing chords.
interesting, i've never used tux-guitar. I do experience distortion on
chords if alsamixer is set higher than about 75-80% (80% is actually
100% gain, so above and beyond that, is actually over-driven in ALSA).
i would try lowering your gain, and also the gain in Kontact, until it
doesn't distort anymore. if that isn't the case, use smaller frames.
I always use 128, even when running 3-4 synths with FX, or editing
12tracks in ardour, while recording a synthline..
I only use larger frames, when doing "post-production", like FX,
automation and mastering.
I noticed this morning that when this distortion happens, I instantly
get high cpu usage, from 60% to 100% and then back to normal. This is
more evident when I use two instruments at the same time with a
sequencer, e.g. rosegarden, even if those instruments are really small
(both in sampler mode less than 20MB).
Post by jordan
my "craptop" with "the dreaded intelHDA"(so they say) almost is always
happy with 128frames. I keep mentioning the IntelHDA, because i
actually use it more than Firewire. As carrying around the FA-101 to a
jam, isn't really required. it is only handy for recording multiple
audio tracks at once.
I use a combination of "jacker" - a small midi-tracker for some
sequencing (it's very lite) and i use seq24 sometimes as well. then, i
just record right into ardour, with some cut and paste techniques,
bouncing tracks.
the kind of thing you do on slower machines. (like i used to do in
Protools on my old G4 mac)
Post by iliverez
I use a dual core Athlon 5200+, 3gb ram, M-Audio 2496 with 32 bit real time
kernel PAE (AV Linux 4). I mostly run kontakt as a VST plugin with vsthost,
since I cannot "see" the midi inputs when running as standalone.
Nice hardware :)
as Standalone with WineASIO - you need to have midi-seq enabled in
Jackd. then you will see midi, under the ALSA tab in Jack.
jordan
2010-09-08 23:28:17 UTC
Permalink
Hey Yiannis,

You are correct, your hardware should be able to handle this stuff, no problem.
and It isn't a problem with Wine.(i highly doubt it). although
compiling it yourself, you can slightly optimize it.

So you can email me personally, instead of on the wine list. We are
straying, and actually talking more about
Jack, kernels and audio stuff.

You shouldn't require jack to be setup in winecfg. I don't have it
setup that way.

Also, when using standalone apps with wineasio, you control midi from
within the app not through Jack.
for example, if i am running a sequencer and i want to use NI Massive,
i would go into the "audio midi options" and select the desired midi
in. ie: midi-thru or the specified application, i can see linux apps
that use alsa in Massive.

Kontakt you must run as standalone.

Are you using a compositing window manager?

jordan

(remember, just email me, this isn't wine related anymore, as i know
that Wine isn't the problem)
Cosmo Lee
2010-08-19 04:03:17 UTC
Permalink
Jordan:

Thanks much for your reply! I actually tried using ALSA, but I couldn't get it to work. But since you wrote that you got it working, I went back and
started rooting around in winecfg and playing with it some more. It turns out the problem was that the bit setting in the "DirectSound" pane was on 8
by default. I set it to 16 and bam, Kontakt worked! (I wonder why it would work w/ OSS @ 8 bits but not ALSA...)

I also played with the sample rate. Sound with Kontakt seems to work with winecfg set to either 22050 (the default) or 44100. I notice that within
Kontakt itself, it is set for a sample rate of 44100. Kontakt works either if winecfg is set to 22050 or 44100. Is there a reason to prefer one over
the other? I don't know much about these things, my guess would be that they should match - the winecfg rate & the Kontakt rate - but Kontakt seems to
run the same either way.

I know that Jack and WineASIO are things I should use eventually, but I wanted to troubleshoot as simply as possible and get one thing to work at a
time. OK, WineASIO and JACK next...

I see there's also a Jack audio driver under winecfg. Why isn't that the one to use instead of ALSA if you're running Jack?? Although, I noticed that
the Jack driver doesn't have any MIDI devices show up - only "wave in" and "wave out" devices.

I'm just getting into this Linux Audio stuff, since you seem to know something about these things, is there a resource(s) for things Linux Audio that
you can recommend?


Thanks a bunch,
Cosmo
Post by jordan johnston
Post by Cosmo Lee
Ubuntu 10.4, Wine 1.1.42, Native Instruments Kontakt 4, Akai MPK88
I've installed Kontakt (sampled musical instruments).  Sound is working OK with the OSS driver, but the program doesn't respond to the USB
keyboard. :-
Post by jordan johnston
Post by Cosmo Lee
( The keyboard shows up in `winecfg` under "Audio", OSS, MIDI In/Out devices.
Why aren't you using ALSA???? you will want to expose Kontakt/wine to
the alsa driver,
snd-usb-audio. This driver is plug and play with the AKAI MPK. I own the MPK49.
OSS is sort of a dying driver, ALSA/Jack is what you will want.
Also, i am not sure if OSS even would implement midi for our devices....
Post by Cosmo Lee
I checked the MIDI options for the Kontakt program and it DOES show the Akai keyboard - so the program knows the keyboard exists.  I've got it set so
that
Post by jordan johnston
Post by Cosmo Lee
device "Midi 1" is set to "Port A".  I've also tried setting to ports b,c,d, but no luck.
I don't have jack or ASIO running yet as I want to troubleshoot one thing at a time.
You will want to get both Jack running, probably jack2 (1.9.5) and the
Latest WineASIO code
compiled and installed. Kontakt works great in linux.
Post by Cosmo Lee
Is there something additional that needs to be done for USB MIDI keyboards to work under Wine?
Nope, just use alsa, and select it in winecfg as your audio driver.
from there everything
should work perfect. The usb midi will work fine, just make sure your
keyboard is plugged in before you open your wine app, otherwise it may
not show up. In the end you will want to use jack for audio apps like
this, just so you know!
I use All of my Native Instruments plugins under Linux.
jordan
jordan johnston
2010-08-19 04:16:34 UTC
Permalink
hi Cosmo,

I will explain a few things quickly, that might help your
understanding a little.

OSS - is the old sound drivers for linux

ALSA - is the newer implementation, and default linux-audio drivers.

Jack - is the low-latency driver. It is cross-platform. On linux, you
will either run OSS or ALSA as Jack's backend.
While on a Mac, you would use "core audio" for the backend. So that
being said, You will still require ALSA for jack to work. As ALSA is
communicating with your hardware and provides alsa-midi, as well.

Jack is like ASIO and REWIRE in windows. (sort of) it also can provide midi

As far as sound quality goes, you will want to use 44100, as that is
CD quality. 22100 is fairly low-quality, don't use that. there is
your answer!

As far as recommended reading, there is a ton of it. First, i would
ask what Linux Distro do you use?
what are you trying to accomplish, ie: a DAW, or a "live type environment", etc.

If you can get back to me on this, however, this strays big-time from
the wine-dev list, so i would ask
you to just send ME a message, rather than having it posted on this list.
But yes, i will take a look through my bookmarks, i am sure there is
some goodies in there for you.
get back to me, and i will have a look.

jordan
cosmolee
2010-09-22 02:21:42 UTC
Permalink
I wanted to follow up with the things I did to get things working. Maybe it
will be of help to others...

Install WineASIO drivers for your distribution.
Register the WineASIO drivers using a command such as:
I actually forgot what command I used, but you can Google it...

WINE: run `winecfg`, choose Audio tab>
Select Alsa driver
DirectSound pane: Default Sample Rate: 44100, Default Bits Per Sample: 16

Note: "Test Sound" test may fail if Jack is already running, but sound may
still eventually work. If I tried to run the test, it locked up winecfg.
The way to unlock it is to quit Jack.


Run Jack: Setup> Settings>
MIDI Driver: seq
Restart Jack for settings to take place.


Run Kontakt: `wine 'kontakt 4'`
Options>
Audio> set Driver to "ASIO", set Device to "Wine ASIO Driver"
MIDI> Inputs> Akai MPK88 Midi 1 to Port A

Go to Jack "Connections", in Audio tab, connect "ASIO_Kontakt 4" to "system"
Note: if you make changes to the audio drivers in winecfg, this may reset
the MIDI options in Kontakt, and you will have to redo them.

Hope that helps!

-Cosmo
--
View this message in context: http://wine.1045685.n5.nabble.com/Kontakt-doesn-t-respond-to-Akai-USB-MIDI-Keyboard-tp2640128p2849080.html
Sent from the Wine - Users mailing list archive at Nabble.com.
jordan
2010-09-22 02:44:10 UTC
Permalink
HI Cosmo,
I wanted to follow up with the things I did to get things working.  Maybe it
will be of help to others...
Glad to hear it's working for you now, Cosmo.

Great stuff ;)

jordan

Loading...