You are here

Qtractor source - Metronome function

Hi.

I want to try to make a private addition to the Qtractor source.
In Qtractor main window there is the button to activate/deactivate the metronome.

Where to find the related functions/code to this button?

Thanks

Forums: 
rncbc's picture

hi,

for the UI part:

qtractorMainForm::transportMetro()

for the audio and MIDI metronomes resp. it follows from:

qtractorAudioEngine::setMetronome(bool) ...
qtractorMidiEngine::setMetronome(bool)
...

may I ask whet kind of additions are you up to?

seeya

TAERSH's picture

In the early days I used Hydrogen for the Drums. In 2009/2011 I created Hydrogen drum kits from samples recorded of my huge Sonor Force 3007 drum kit. Last year I created a .sf2 sound file from that samples, so I'm using Hydrogen now for the metronome only. I want to get rid of the use of Hydrogen. So, by now I have added a small line (using command "system()") to the source code in function "transportMetro()", calling a script "qtractor_SwitchKlick". Within this script I'm switching program "klick" for the use of the metronome.

The script is either calling "klick -j -P" to enable the metronome, make it following JACK transport and auto-connect to JACK or calling "killall klick" to disable the metronome. Works good so far. The only problem by now is: when I'm accidentally exiting Qtractor with Metronome enabled, "klick" will run on disabling the Metronome and revert. But I can live with that for now.

Though, I got a warning when compiling about something unused (return value?) on the "system()" command. But it doesn't seem to have any negative effect.

Thanks a lot!!!

rncbc's picture

why don't you just use the audio sample files for the bar/beats in View > Options... > Audio > Metronome?
would save you a lot of hassle, I suppose :)

cheers

TAERSH's picture

Like many others already mentioned overall in the web, the audio-metronome has lots of problems to stay synchronized during a song. I tried to use it, but it doesn't really satisfy, even though I'm using a real-time kernel 5.0.21-rt15. Without the real-time kernel it's really trouble and completely unusable.

That's why I kept using the MIDI-metronome. By now using "klick -j -P" works great so far. Also it's just a single line I have to add to the source code, it's no trouble for me to do so at each new compiling. The only thing I would like to know: how would I check (in C) if the option/metronome is active/de-active.

rncbc's picture

what exactly are the problems you're facing with the audio metronome that requires a real-time kernel to mitigate ??

puzzled

TAERSH's picture

It goes out of sync and it doesn't play the samples exactly to the beat. With real-time kernel it seems to be a little behind the beat.
I'm a drummer, I know when something goes out of sync or is not exactly on the beat. I played for years in bands playing to loops and programs like Ableton Live playing complex rhythms and sequences.

rncbc's picture

does it drift? or is it just a fixed delay/latency to it that you can compensate with the audio metronome "latency" setting to account for the system and acoustic delay ?

of course, you can also take the "systemic" latency to a bearable low on the JACK side of settings, like the buffer-size set to a bearable minimum of at least 128 (frames/period) or can't you?

cheers

TAERSH's picture

My JACK settings is 44100 sample rate and 1024 frames/period with 2 buffers/period. When I'm changing any of these settings I'm getting lots of XRUNS. I tried 48000 sample rate, I tried also 2048 frames/period as well as 512 frames/period in different combinations. With my current settings I get XRUNS only one time directly after Qtractor started and is ready for a use.

To try to compensate by changing latency settings for the audio metronome would be much more hassle to me than to just add this one-liner to the source code. The "klick" metronome is good to hear/listen and very stable following the JACK transport.

On songs with long duration the audio metronome gets completely out of sync, so it drifts to be syncopated to the beat.

rncbc's picture

with a barely tuned PREEMPT_RT kernel you ought to be running @48000/128/2 (or 3), no xruns, no sweat... and this is the minimum sane and (trust me) conservative system spec you should ever consider as a baseline on modern GNU/Linux... anything above that is, erm. yeah you get what I mean :)

otoh. you could just have klick running standalone, responding to JACK transport at large, I don't really see the need to hack the qtractor source to launching it inline, or am I missing the point?

cheers
cheers

TAERSH's picture

Ok, may I ask again:

How would I check inside the function "transportMetro()" if the option/metronome is active/de-active?

Pages

Add new comment