You are here

Problem with "MIDI xruns"

Dear Rui,

sorry for 'spammimg the wrong list äh blog' and that it takes 10 days to open the topic in this List, but here we go:

(I have attached an archive session file,) I hope all information is included. I'm running the head version and update regulary.
Sorry, attaching does not work: "warning: Parameter 2 to mollom_form_alter() expected to be a reference, value given in /srv/www/vhosts/rncbc/drupal-6.20/includes/common.inc on line 2892." can I send it to pmail?

Jackd parameter:
usr/bin/jackd -v -p128 -dfirewire -r44100 -p256 -n2

Version: jackdmp 1.9.7

The MIDI files and the audio files are recorded with Rosegarden.
I have then exported the MIDI from Rosegarden, imported it in the Qtractor file manager and drag-droped the three tracks into the mail window.
The audio files are copied from one directory to the other. Imported in the QTracor file manager and drag-dropped to the arrange window.

The problem: If I cycle the 16 bars, usually the first loop is ok, but when beginning the second loop, MIDI and audio timing is completely broken or audio has a lot of xruns and/or stops.

When I disable the MIDI-Tracks!!!, everything works fine. When I disable the audio tracks, even the MIDI Track timing is corrupted in the second loop.

Isn't it strange?

AttachmentSize
Binary Data Clicky.qtz2.88 KB
Forums: 
rncbc's picture

please send the archive/zip (.qtz) via pmail then--without some evidence i'm afraid i cannot help you the slightest bit, although i find the whole situation a very strange one indeed :/

seeya

That's what I did but I get an:

rncbc@rncbc.org
SMTP error from remote mail server after MAIL FROM: SIZE=10900968:
host mail.rncbc.org [x.x.x.x]: 552 5.3.4 Message size exceeds fixed limit

:-(

Holger

rncbc's picture

well that's huge :) any chance on getting rid of that lengthy audio stuff and still reproduce the issue?

after all, you're reporting a midi related trouble ain't you?

otherwise, you could have some dropbox/cloud somewhere and hand-over the file in some other way but mail or this blog (which have a 2mb attachment/upload file size limit btw, iirc)

cheers

Rui you are perfectly right. I removed all audio stuff but still get XRuns... .

Yeah I'm a wizard;-)

I have sent the snippet via pmail.
I hope you can reproduce the behaviour.

So far: Thanks for you assistance.

Holger

rncbc's picture

for general evidence, your file (Clicky.qtz) is now listed (attached) on this forum topic.

however, as i suspected, i cannot reproduce the reported behavior and i am already looping it for ages now :)

just out of curiosity, what midi interface(s) are you using? i see there's a "MTPAV on parallel port" but is that on a parallel (old printer) port actually? do that things still exist any longer? :) how old is your hardware/system? :))

what happens after you try some other queue timer resolution (in View/Options.../MIDI/Playback ... ) than the current or default one ?

byee

didn't I mention you have to loop it 3684759 times - before you go mad...

Ok, thank you for checking this out.

Yes, I'm still using this old MOTU MIDI Express XT parallel interface. And I'm happy to have exactly this one, otherwise I had given up and switched to Windows. (There is no Win7 driver for the parallel version, so I have to stick to Linux;-)

My other hardware is everything between old (LXP1/5, K2000) and recent (Mackie FireWire mixer).

My workststion has an AMD Athlon(tm) 64 X2 Dual Core Processor 5200, which should be powerful enough for 3 MIDI tracks;-)

Other timer resolution makes the situation worse.
There seems to be no MIDI 'feedback' anywhere.

I will try to invatigate even more.

Again: Thanks for your help so far, Rui!

Holger

rncbc's picture

which is your system timer resolution?

nb. lesser than 1000hz is not here recommended, although most distro supplied kernels have lousy values eg. 250hz or even 100hz, in an attempt to save some battery wattage for the laptops and mobile stuff which is pretty marginal if not b.s :)

did you try the hrtimer (high-resolution timer)? depending on your kernel version, it should be available through the snd-hrtimer alsa module. load it with

modprobe snd-hrtimer

as root and try to select it on qtractor options.

take note that the slave pcm timers are only good enough when the audio pcm period is short as well (ie. 256x2 might not be enough) and given that you're using a firewire device, well, it kind of makes it into a gray area to me--there's no alsa firewire driver per se, so it might not get tied to a pcm interrupt timer at all (thus the lousy results you get) . last time i saw it plugs directly into jackd through its ffado backend and stack.

do you experience the same behavior with any other audio device you can get your hands to? any but firewire, i ask.

did you said it works fine on rosegarden?

one other question, which i forgot to ask in first place: what are in fact those "xruns" you're talking about, which tend to occur on each loop turn-around? are those notes being playing out of tempo or dropped out entirely? is there a tempo variation or is it actually jackd reporting "xruns" instead?

seeya

Rui,

your support is great and very welcome!

snd-hrtimer is loaded and I use the high resolution. 10.000Hz when I remember right. (I'm at work...)

The XRun(s) occur immediatly at the beginning of the loop and are reported by jackd. Then the timing is completely gone (midi output is delayed and notes are 'bouncing' around.), audio is disturbed from that point (and maybe stops...)

Yes, it works in Rosegarden.

Yesterday night I investigated one more thing:
I have two MIDI devices, a synthy and an e-piano. When I only enable the e-piano, everything works smooth, when I enable the synthy, the problem occurs (I have disconnected MIDI out from the synth to avoid possible MIDI-through loops).
The difference is: I have no instrument definition for the piano (yes yes, one of these old devices which only have one sound;-).
This means: no program change at the beginning of the sequence. (There might be the difference to rosegarden, I don't think they add the programm change to the sequence, as it is done in qtractor - but I'm not sure)

It could be 'bad vibes' between my 'vintage MIDI controller' and theese progranm changes... .
BTW - when I started testing with qtractor I tried to get rid of the programm changes and sometimes it seemed that they are added mor than once at the beginning of sequence - could this be?

I'm sorry, I have not tested all this with my alsa audio device - I will try it tonight. Unfortunatly I don't have another MIDI controller.

Thanks again Rui!

Holger

rncbc's picture

i really can't see how all this happens.

but you can try a few shots in the dark, one by one, exclusive and/or inclusive:

  1. update from latest svn trunk.
  2. build for debug (./configure --enable-debug), start from a terminal console and watch for the verbose output.
  3. enable dedicated MIDI control ports but don't connect them at this time (View/Options.../MIDI/Dedicated MIDI control input/output = On).
  4. disable all MIDI transport/sync master/slave related options (View/Options.../MIDI/MMC = None, SPP = None, Clock = None).
  5. disable all JACK transport/sync master/slave related options (View/Options.../Audio/Transport mode = None).
  6. move all the clips away from absolute 0 location eg. move all of them to beginning of bar 2; reset loop points accordingly.
  7. remove any MIDI connections (yes, you won't hear any sound but this is for testing purposes right?).

please, test && tell
cheers

Rui,

here are the results:

1: The problem IS connected to the FireWire device. I when I test with my Delta 44, there does not seem to be this problem.

2: Debug-Output
I did as you told me, started the song with all midi tracks muted and activated the MIDI tracks one by one. See log below
(Everything after *** are my comments)

3: After I have seen theese sendAllControllers(0) immediatly before the problem, I commented it it out in the source and recompiled. It does not solve the problem but prevent if from occuring immediatly.

Here we go:

*** Starting qtractor

Warning: no translation found for 'de_DE' locale: /usr/share/locale/qtractor_de_DE.qm
qtractorPluginPath[0x7fff39699ff0]::open() paths="/usr/local/lib64/lv2:/usr/lib64/lv2" typeHint=4
qtractorLv2PluginType::slv2_open()
librdf warning - Model does not support contexts ( *** 3 times ***)
qtractorMainForm::loadSessionFile("/home/dehnhardt/QTractor/Default Session.qtr", 1)
qtractorMainForm::updateSession()
qtractorMidiManager::createMidiManager(0x2f4ba30)
qtractorMidiManager::createMidiManager(0x7f9b90000d30) *** 9 more addresses

--snip

qtractorMidiEngine::resetDrift()
qtractorMidiManager::createMidiManager(0x7f9b9026c5a0) *** 4 more addresses

--snip

qtractorMainForm::viewRefresh()
qtractorAudioBus[0x2ee8ad0]::updateConnects(1): jack_connect: [firewire_pcm:000ff20400001d98_Unknown_in] => [Qtractor:Master/in_1]
qtractorAudioBus[0x2ee8ad0]::updateConnects(1): jack_connect: [firewire_pcm:000ff20400001d98_Unknown0_in] => [Qtractor:Master/in_2]
qtractorAudioBus[0x2ee8ad0]::updateConnects(2): jack_connect: [Qtractor:Master/out_1] => [firewire_pcm:000ff20400001d98_Unknown_out]
qtractorAudioBus[0x2ee8ad0]::updateConnects(2): jack_connect: [Qtractor:Master/out_2] => [firewire_pcm:000ff20400001d98_Unknown0_out]
qtractorAudioBus[0x2e66ab0]::updateConnects(1): jack_connect: [firewire_pcm:000ff20400001d98_Unknown_in] => [Qtractor:Mackie 1/in_1]
qtractorAudioBus[0x2e66e60]::updateConnects(1): jack_connect: [firewire_pcm:000ff20400001d98_Unknown_in] => [Qtractor:Mackie 2/in_1]

*** Naming of the ports is not finished in ffado, therefore these 'unknown...' names

qtractorMidiBus[0x2e67720]::updateConnects(1): snd_seq_subscribe_port: [130:1:Master] => [20:MTP direct 8]
qtractorMidiBus[0x2ee9890]::updateConnects(2): snd_seq_subscribe_port: [130:2:K2000] => [20:MTP direct 2]
qtractorMidiBus[0x2eea040]::updateConnects(2): snd_seq_subscribe_port: [130:3:P30] => [20:MTP direct 8]
qtractorMidiBus[0x2ee9890]::setPatch(9, "Kurzweil K2000", 0, 0, 4)
qtractorMidiBus[0x2ee9890]::setPatch(1, "Kurzweil K2000", 0, 0, 6)
qtractorMidiControl::sendAllControllers(0)
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3

*** Load Song

qtractorMidiManager::deleteMidiManager(0x2f4ba30) *** 14 times

-- snip

qtractorLv2PluginType::slv2_close()
qtractorMainForm::loadSessionFile("/home/dehnhardt/QTractor/Clicky Neu/Clicky Neu.qtr", 0)
qtractorLv2PluginType::slv2_open()
librdf warning - Model does not support contexts *** 3 times
qtractorMainForm::updateSession()
qtractorAudioBuffer[0x302cc70]::seek(151200) pending(0, 151200) wo=282271 ro=1537181
qtractorAudioBuffer[0x30a6320]::seek(302400) pending(0, 302400) wo=433471 ro=1884489
qtractorMidiManager::createMidiManager(0x2e24770) *** 10 times

-- snip

qtractorMidiEngine::resetDrift()
qtractorMidiManager::createMidiManager(0x7f9b9037ddb0) *** 4 times 

-- snip

qtractorMainForm::viewRefresh()
qtractorMidiBus[0x3021f90]::updateConnects(2): snd_seq_subscribe_port: [130:3:P30] => [20:MTP direct 8]
qtractorMidiBus[0x3087c40]::setPatch(9, "Kurzweil K2000", 0, 0, 84)
qtractorMidiBus[0x3087c40]::setPatch(9, "Kurzweil K2000", 0, 0, 84)
qtractorMidiBus[0x3021f90]::setPatch(0, "", 0, -1, 0)
qtractorMidiControl::sendAllControllers(0)

*** Song loaded -> play

qtractorMainForm::transportPlay()
qtractorMidiEngine::resetDrift()
qtractorAudioBuffer[0x302cc70]::inSync(0, 128) (0)
qtractorAudioBuffer[0x30a6320]::inSync(0, 128) (0)
qtractorMidiEngine::drift(): iAudioTime=7841 iMidiTime=7833 (8) iTimeDrift=8 (0.1%)
qtractorMidiEngine::drift(): iAudioTime=28002 iMidiTime=28013 (-11) iTimeDrift=-3 (-0.012%)
qtractorMidiEngine::drift(): iAudioTime=38086 iMidiTime=38094 (-8) iTimeDrift=-11 (-0.029%)
qtractorMidiEngine::drift(): iAudioTime=48164 iMidiTime=48169 (-5) iTimeDrift=-16 (-0.034%)
qtractorMidiEngine::resetDrift()
qtractorMidiEngine::drift(): iAudioTime=27040 iMidiTime=27039 (1) iTimeDrift=1 (0.0031%)
qtractorMidiEngine::drift(): iAudioTime=37124 iMidiTime=37123 (1) iTimeDrift=2 (0.0046%)
qtractorMidiEngine::drift(): iAudioTime=47202 iMidiTime=47199 (3) iTimeDrift=5 (0.0092%)
qtractorMidiEngine::drift(): iAudioTime=57285 iMidiTime=57282 (3) iTimeDrift=8 (0.014%)
qtractorMidiEngine::resetDrift()

*** Now unmuting a first MIDI Sequence

qtractorTrack[0x3217800]::stateChangeNotify(1, 0)
qtractorMidiEngine::trackMute(0x3217800, 0)
qtractorMainForm::contentsChanged()
qtractorMidiEngine::drift(): iAudioTime=5923 iMidiTime=5921 (2) iTimeDrift=2 (0.034%)
qtractorMidiEngine::drift(): iAudioTime=16000 iMidiTime=16002 (-2) iTimeDrift=0 (0%)
qtractorMidiEngine::drift(): iAudioTime=46246 iMidiTime=46244 (2) iTimeDrift=2 (0.0031%)
qtractorMidiEngine::drift(): iAudioTime=56323 iMidiTime=56322 (1) iTimeDrift=3 (0.0046%)
qtractorMidiEngine::resetDrift()
qtractorMidiEngine::drift(): iAudioTime=4961 iMidiTime=4958 (3) iTimeDrift=3 (0.06%)
qtractorMidiEngine::drift(): iAudioTime=15045 iMidiTime=15048 (-3) iTimeDrift=0 (0%)
qtractorMidiEngine::drift(): iAudioTime=25122 iMidiTime=25124 (-2) iTimeDrift=-2 (-0.0092%)
qtractorMidiEngine::drift(): iAudioTime=35206 iMidiTime=35207 (-1) iTimeDrift=-3 (-0.0092%)
qtractorMainForm::contentsChanged()
qtractorMidiBus[0x3087c40]::setPatch(9, "Kurzweil K2000", 0, 0, 84)
qtractorMidiBus[0x3087c40]::setPatch(9, "Kurzweil K2000", 0, 0, 84)
qtractorMidiBus[0x3021f90]::setPatch(0, "", 0, -1, 0)

*** Start of sequence!

qtractorMidiControl::sendAllControllers(0)
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3

*** What does this mean??? Here the timing is already instable

qtractorMidiEngine::resetDrift()
qtractorMidiEngine::resetDrift()
qtractorMidiEngine::resetDrift()

*** activating a second track

qtractorTrack[0x30c0470]::stateChangeNotify(1, 0)
qtractorMidiEngine::trackMute(0x30c0470, 0)
qtractorMainForm::contentsChanged()

*** and now everything gets out of sync.
*** What does JackActivationCount... means?

JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
qtractorMainForm::transportStop()
JackActivationCount::Signal value = 0 ref = 3
JackActivationCount::Signal value = 0 ref = 3
rncbc's picture

*** What does JackActivationCount... means?
beats me :) those are jackdmp (aka jack2) generated messages... not qtractor's.

Dear Rui,

guess what I did the last two evenings? I was making music using qtractor, my good old MIDI express XT and my FireWire interface... yeah.
The setup is still not as stable as I want it to, but in 9 of ten 10 cases I don't have any xruns.

What I did:
1.) Assuming that qtractor is not the cause of trouble;-)
2.) Installing a different realtime-kernel - I was using a Liquorix kernel because it was running with the NVidia driver - now I'm using the one from pengutronix and the nv video driver...
3.) lowering the priority for the MOTU in the hope that it does not disturb the audio interface
4.) Setting a very high priority for the FireWire

Thank you for all your help!

Holger

rncbc's picture

well that is good news but doesn't quite dismiss the case :)

truth is i've been told that a real-time (preempt_rt) kernel has been the top recommendation for dealing with firewire audio devices--i don't have any experience with those myself, just heard on the interwebs:)--in fact it used to be more of a sine qua non condition. however i have been just assuming that recommendation wears out as far the latest stock kernels (and ffado stack) have been catching up to the task. i guess it's not still a closed deal, at least for some setups ;)

have you tried any the above a. to g. steps already, the so called shots in the dark ?

byee

Dear Rui,

both were RT-Kernels (afaik), I never had dared to file this bugreport without having a rt-kernel;-)
But the pengutronix kernel has some modifications which made the rtirq-script failing, so I had to set priorities with my own script....

"...have you tried any the above a. to g. steps already, the so called shots in the dark ?"
Sorry for not being clear here: My lengthly post with the logfile was after doing all points from a to g. My plan was enable all backwards when it works in the 'g-state'. But due to tha fact that it did not change a lot, in my eyes there was no reason to investigate any further.

BTW: There are still program changes at the beginning of the sequences which cause the trouble (I tried to delete them but they are inserted again) - are they necessary or is the program change instruction send with the 'sendAllControllers()' function...

Holger

Add new comment