You are here

How to set tempo to match recorded midi-sequence or audio track

Hello Rui

I often leave Qtractor running in record mode when experimenting on a keyboard rather than starting the metronome and trying to cramp whatever I am playing to the metronome. Is there a way to adjust the tempo to match the recording after the event?

Best regards, Simon

Forums: 
rncbc's picture

Answer is, well, no. Not yet at least :)

Metronome is a blank-sheet helper, most certainly not the tool you're asking for. Truth is, if you're recording something as a digital audio signal stream, which goes with no western music rhythm metrics whatsoever, by definition, you're left to do all tempo matching later by hand. Manually that is.

Ah, please (hint, hint:), take care to turn off this View/Options.../Audio/Automatic time-stretching option before you do any manual adjustment after any audio recording. If not, every time you change tempo the whole recorded material will be stretched to match the new time scaling, and most sure that is NOT what you want :/

Never mind that. Please, tell me what you are thinking about, what we IT freaks call a..., use case ?

Eagerly waiting for an idea :)

sl's picture

Hi Rui

I have an idea I want to capture (before I forget it..!), it could be a melody or a rhythm pattern, something I would like to build upon or reuse later.

I will play this on a keyboard (in my case a stage piano hooked to a laptop). Qtractor is set-up to record the keyboard's midi-output in one track and the audio-output in a second track. Maybe the audio will be the final sound I use - more probably I will resequence the midi through another instrument to get the sound I want.

In either case I will have a series of notes (midi) or envelopes (audio). The notes or envelopes repeat in time but will not be exactly equally spaced. The (wanted) mistakes give the piece a certain feeling or liveliness.

Never-the-less I would like to match an "average" tempo to the recorded tracks. The timing marks (the bar and beat marks) can then be used to add percusion and/or I can cut-up the recorded tracks and repeat sections, aligning the sections to the timing marks.

Regardless whether audio or midi I would like to enter a mode whereby I can, for example, click on positions in the track (midi - the start of the notes / audio - the start of the envelops), the clicked positions being where the bars start. I will probably start clicking at the 3rd or 4th or 5th as the first few recorded notes will be where I am getting up to speed.

Qtractor would then:
- calculate the tempo based on a clicked positions and the previously (manually) entered signature
- show the timing marks (calculating back from first clicked position as required)

Does this make sense?

Best regards, Simon

rncbc's picture

Makes practical sense yes.

A thought follows, a twist from a twisted mind :)

How about adjusting current tempo (and probably clip onset position as well) to horizontal extent of the current selection (width) ? That is, when you select a clip range that you believe is your recorded beat length (a quarter note if in 4/4), tempo may then be adjusted from that beat length. As tempo is expressed in beats per minute (BPM), it's just a matter of simple visual arithmetic, obviously :)

This way, it kind of works as the inverse or complementary of the shift-click time-stretching method that you already have on adjusting a clip length to current metronomic grid, by dragging one of its edges. It won't need any additional timing markers or the specific visual interaction you suggest, but picking on current (spartan) ergonomics with less effort from my part, that is -- uber-procrastinator does it again ;)

Now's my turn to ask whether this makes sense?

Cheers.

sl's picture

Hi Rui

The simplest solutions are mostly the best solutions... I agree keep the code changes minimal - as soon as the other Qtractor-Users use this feature you will have the feedback you need to perfect the code.

If possible, I would prefer to make the selection with a horizontal extent in the range 4 to 10 bars in length, and then manually enter the number of bars to which the tempo has to adjust - that way the many imperfections in my playing are averaged out...

By "timing markers" I mean "metronomic grid" - sorry I didn't know the correct name for the grid and so invented "timing marks".

I also have another case you may like to consider...

In this case I would like to set the tempo / grid to a complex piece of music - some commercial programs allow the user to tap along to the beat on a midi-keyboard and then the "tapped" midi-track is used to set the tempo / grid start.

Best regards, Simon

...but this has always been a function I have searched fruitlessly for in Midi sequencers and DAWs ever since the demise of my AtariST running Cubase 3, which at least attempted a 'Human Sync' function.

If I understand correctly, Rui has it sussed programatically with

"when you select a clip range that you believe is your recorded beat length (a quarter note if in 4/4), tempo may then be adjusted from that beat length."

and Simon has it nailed from a live performer perspective with

"I would prefer to make the selection with a horizontal extent in the range 4 to 10 bars in length, and then manually enter the number of bars to which the tempo has to adjust".

Combine the two and the high standard of ergonomics of Qtractor would be maintained.

Back to reality, probably the actual coding (auto-quantising the selected range of pre-specified number of bars to calculate new bpm?) could be a nightmare, especially if we're diddling around with 16th triplets ;-). I guess the input would have to be simple and clear cut for this to work, but oh, what a release it would be for building upon impromptu inspiration! At present, with all DAWs I've tried, the programs insists you switch from right to left brain activity to such an extent that inspiration often gets swamped in technicality.

rncbc's picture

Let me make some more assumptions about (my) suggested new adjust-tempo function:

It should ask how many beats or bars do correspond precisely to the current selected range and it might also give default values based on that selected length, tempo and time signature. It would also ask some other options in the same dialog box, like whether you wish to adjust the current clip start time, all clips in current track or whole session. etc.

The selection for this purpose (to adjust-tempo) is inherently a visual process: you click-and-drag starting from the onset of the first beat (or where you think it is) and ending right before the onset of the last beat. Of course this can be made obvious if taking a recorded percussion track as reference or a tapped MIDI one. Remember, it's a visual process and it might be an iterative one too: you won't make it right first time, always :)

Of course, you may well take advantage from the snap-to-grid feature but for precision sake the selection procedure (setting the left/edit-head and right/edit-tail edges) are best done with snap quantization set to "None".

Cheers

sl's picture

Hi Rui

Sounds good - yes the process is visual, the selection of the onset of the first and last beats is "artistic" judgement.

Best regards, Simon

rncbc's picture

FWIW, I'm working on this subject ATM... (ellipsis galore ahead!)

Expect to see something under Transport/Tempo... in a few days, SVN trunk of course (wannabe Qtractor 0.4.6.3+:)

not there yet, but... hmm... introspectively, I'm also getting fed up of all those "but"s, but...:)

Cheers

sl's picture

Sounds good - any particular "but"?

rncbc's picture

any particular "but"?
Of course there's a but, there's always one or two :)

And there it is: the tempo adjust tool will migrate right away from the Transport menu into the Clip menu: sorry for the inconvenience, but (there it is) I find more... uh, ergonomic? to place this tool under the Edit/Clip/Tempo... tree ;)

Showing up as Qtractor 0.4.6.4+ in a few minutes... done :)

OK. Basically this tool barely works like this:

1) You select a region or clip which you know has the right length and integral number of beats that correspond to the estimated tempo.

2) Hit Edit/Clip/Tempo... (F7) and the (new) Tempo dialog appears...

3) Check Range Length and Range Beats suggested values. Change as you see fit, specially the number of beats that should correspond to that length, in your own estimation.

4) Press Adjust. A new tempo is computed and shown. If you're happy with the result, just press OK and that's it.

You may also notice there's this new Tap button. Yep, it does the obvious. Alas, at this time, it might not be the best of tempo tapping device you can find around these days, but (omg) it's a start ;)

Cheers

sl's picture

Hello Rui

Just found a few minutes to test the new function.

I checked out svn version 1578, builds perfectly as 0.4.6.4

Importing a pre-recorded midi file I did the following:

View menu; set Snap to none
Right click menu: select Mode; set to range
Mark clip range with mouse
Right click menu: select Clip/Tempo; set Tempo to 6/8, set no of beats to 24 (4 bars 6 beats), click adjust

The calculated tempo speed seemed to be slightly to high, the grid starts from clip 0 position. The latter is tricky as ideally the tempo adjust function should pad out the start position so that the grid marks align with the selected range. I guess the adjust function needs to calculate back the number of bars from the range start to clip 0 and then round up to the next whole number.

Best regards, Simon

rncbc's picture

hi Simon,

the tempo Adjust function takes the range length and the number of beats in effect and calculates the corresponding tempo (BPM). Simple as that :)

The initial number of beats are given by the inverse calculation: current tempo and selected range length. Have a note that current selected clip range takes precedence.

I know it's not perfect but I am planning to include a beat onset detector and/or analyzer to help this out a little bit and do some more perhaps :)

Another side note goes like that svn trunk is numbered 0.4.6.7+ already, ATOTW ;)

Cheers

sl's picture

hi Rui

just built svn 1589 alias 0.4.6.10

The results are the same, namely the calculated tempo is too high - I am trying to sync to a piece recorded in 6/8 time...

My guess is the rate is calculated too high by a factor of 1.333 (8/6)

Cheers, Simon

rncbc's picture

Maybe I'm doing something fundamentally flawed.

Care to show some evidences of your case? A screen-shot would be worth a thousand posts, they say ;) If a screen-shot is not an option, please give us the numbers shown on the dialog when it first appears (Tempo, Range Start, Length and Beats), then after you change any of those and press the Adjust button.

One note of caution against red herrings :): The time-signature (6/8) is only relevant for tapping. The numerator (6) gives the number of beats for the moving average (6 taps) that will evaluate to tapped tempo. In no other way the time-signature figure gets used.

Cheers

Hi Rui

Screen-shots uploaded under http://www.rncbc.org/drupal/node/222

With best regards, Simon

Hi, sorry to bump in. I don't get the option "tempo" on the clip menu (I have: New, Edit, Split, Merge, Normalize, Quantize, Import and Export). I can't find the dialog with the "tap" option you show on the second screenshot in http://www.rncbc.org/drupal/node/222. What am I doing wrong?

Thanks

rncbc's picture

I don't get the option "tempo" on the clip menu (I have: New, Edit, Split, Merge, Normalize, Quantize, Import and Export)... What am I doing wrong?

this new feature is not available on latest release (qtractor 0.4.6). you may find it only on current svn trunk (qtractor 0.4.6.42+ attow)

Cheers

I see, thanks Rui. I'll stick with 0.4.6 though, I don't have enough expertise to be building stuff. I'll eagerly wait for next release!

Thanks Rui

rncbc's picture

fine, but please, keep in mind that building the stuff from latest source (svn trunk) and complaining about old and new issues and bugs and what else is the best way to help making a good enough or better new/next release :))

after all, it's not that hard or is it?

cheers

Yes, you have a good point there. I just have to follow this instructions, right? http://qtractor.sourceforge.net/qtractor-downloads.html#SVN

I'm gonna give it a try.

rncbc's picture

nb. you won't need to do the last install step (make install) avoiding a probable override of any existing installed release. Just run it as src/qtractor from the same command line after a successful make and you'll be walking right down the bleeding edge ;)

cheers

I'm following this guide (https://help.ubuntu.com/community/CompilingEasyHowTo) and the one on the qtractor page but I'm failing big time. This is what I've done, pardon my noobness:

sudo apt-get install build-essential checkinstall
sudo apt-get install cvs subversion git-core mercurial

Then I didi this, not really sure what for

sudo chown $USER /usr/local/src
sudo chmod u+rwx /usr/local/src

Then
/usr/local/src# svn co https://qtractor.svn.sourceforge.net/svnroot/qtractor/trunk qtractor-svn
A long list loaded and in the end it outputed:
Obtained revision *translated by me*: 1636

/usr/local/src# make -f Makefile.svn
make: Makefile.svn: The file or directory does not exist
make: *** There's no rule to build the objective`Makefile.svn'. Stop.

So I tried:
/usr/local/src# cd qtractor-svn
root@matias-desktop:/usr/local/src/qtractor-svn# make -f Makefile.svn
make: autoheader: The program wasn't found
make: *** [configure] Error 127

So I failed. I'll keep looking I haven't got much time though. I'll get there eventually. BTW if the answer is RTFM I'll take it!

Thanks Rui

rncbc's picture

You'll need to (pre)install a plenty of development related packages and all their dependencies.

Try this (package names taken from memory):

sudo apt-get install autoconf
sudo apt-get install libqt4-dev
sudo apt-get install libasound2-dev
sudo apt-get install libjack-dev
sudo apt-get install libsndfile-dev
sudo apt-get install libsamplerate-dev
sudo apt-get install libvorbis-dev
sudo apt-get install libmad0-dev
sudo apt-get install ladspa-sdk
sudo apt-get install dssi-dev
sudo apt-get install liblo0-dev
sudo apt-get install librubberband-dev
sudo apt-get install lv2core
sudo apt-get install libslv2-dev

Cheers

I just compiled a program for the first time, awesome. You were right, it isn't hard (with the right help! ; )). Thanks Rui, now I'll give it a try and if I have any suggestions I'll let you know.

Hi Rui, I can't run qtractor svn from the terminal. I get an error message:

The audio/MIDI engine could not be started. Make sure the JACK audio server (jackd) and/or
the ALSA Sequencer kernel module (snd-seq-midi) are up and running and then restart the session.

I have jack running, I start Qjackctl always when beggining a new audio session. I've tried both, starting jack from terminal and from qjackctl but no luck. What am I overlooking here?

Thanks

rncbc's picture

and do the (previously) original qtractor run from the same terminal?

maybe there's some packaging mismatch between original jackd and recent libjack-dev?

what is the contents of .jackdrc file located on your users home directory?

byee

Maybe it's me doing something wrong but I run this command and now Qtractor opens, unrecognized by jack, giving me the same error but I realize it's not the svn version because I have no "tempo" option in the clip submenu. I did yesterday, I couldn't use it but I saw it.

root@matias-desktop:/usr/src# qtractor

The 0.4.6 Qtractor opens and run fine. I open it from its icon on my launch dock.

My .jackdrc is:
/usr/bin/jackd -P70 -p128 -dalsa -r96000 -p256 -n3 -D -Chw:default -Phw:NVidia -S -Xseq

Thanks

rncbc's picture

You must run all client applications under the same user as jackd is running and configured. You seem to be root ffrom the terminal command line but obviously someone else when launching from the desktop environment, that being your regular user to which you usually login.

Please, try staying always under the realm of your regular user even when doing things on the terminal command line.

Cheers

Hi, I tried running programs under the same user, which did not cause any problems, which is good. But still, I notice it's not 0.4.6.50+ version, but the same old 0.4.6.

What I do is open a terminal, type "qjackctl", then open another terminal, go to src directory (cd /usr/src) and then type qtractor. Do I have to build it everytime I want to use it? Man, I hate to ask this things but I haave zero time to research this days, sorry and thanks for the patience!

PS: I'll rebuild it (if there's anything called like that) and post my results.

Thanks Rui

rncbc's picture

the newer executable must be found under the qtractor-svn build directory: invoke it with src/qtractor or, if already under the src sub-directory , with ./qtractor

otherwise, if you just type qtractor, it surely will run the old system installed executable like /usr/bin/qtractor or /usr/local/bin/qtractor -- when in doubt, type which qtractor

seeya

Pages

Add new comment