Old 08-27-2015, 05:08 AM   #1
Nixon
Human being with feelings
 
Nixon's Avatar
 
Join Date: Dec 2011
Posts: 407
Default Tap Tempo Script

Hey guys,
it would be cool to have a simple tap tempo script that works like the tap tempo in transport but without the changing of the timeline. Just the readout of the bpm.
Nixon is online now   Reply With Quote
Old 08-27-2015, 01:23 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Just made a quick and really dirty test...

look for
  • Tempo and Time Signature/X-Raym_Tap tempo.lua

It works by making an average of the 10 last left clicks entries.


It uses one of my unfinished GFX template (so there is unclickable scrollbars left in it).

Last edited by X-Raym; 08-27-2015 at 05:01 PM.
X-Raym is offline   Reply With Quote
Old 08-27-2015, 04:48 PM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Just updated without error message and a cleaner way to calc tap tempo...

and now works with any kind of keyboard input.

Last edited by X-Raym; 08-27-2015 at 05:00 PM.
X-Raym is offline   Reply With Quote
Old 08-27-2015, 05:27 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Code:
 * Changelog:
 * v0.6 (2015-08-28)
  + Deviation
  + Max
  + Min
  + Visual input
  + Keyboard input


Deviation at 1-2% is good


EDIT: just made a new version with text color as indicator : red = bad, yellow = nice, green = perfect


EDIT : it is possible that my math behind deviation and min-max BPM are wrong....
but it works great anyway, I'll check that later.
And maybe should I recall DEVIATIOn more like "precision" or something like that...

Last edited by X-Raym; 08-28-2015 at 03:40 AM.
X-Raym is offline   Reply With Quote
Old 08-28-2015, 04:44 AM   #5
SmajjL
Human being with feelings
 
Join Date: Nov 2013
Posts: 2,818
Default

Short version: Thx!

Medium v:
Thank you X-R! and this one is Brand New huh? because I looove the smell of new components.
And alternative to "Google" would be just to click on our most Famous Reaper coders name (or link and find good stuff.
Think I'll do that later this evening because I am Way! behind on this.

Long v: eum, not today.
__________________


Last edited by SmajjL; 08-28-2015 at 04:49 AM.
SmajjL is offline   Reply With Quote
Old 08-28-2015, 06:15 AM   #6
Pasajeromoronmoreno
Human being with feelings
 
Join Date: Nov 2013
Location: Argentina
Posts: 326
Default

When tap tempo while playing (with reaper built in tap tempo) the tempo gets all over the place, say you are at 120, and start taping at 130, before settles down in 130 (after two-three taps), goes to 36, 24, etc.
Just today I was using tap tempo and wishing for a way to take, lets say, the first four taps, make an average, and then, apply that averaged tempo.

Then, go to the forums, to see if i can find a script or something, and what i found? jajaja!! Tap Tempo Script by X-Raym!!! You did it Again!

You say it´s too difficult to transform this in an action, no GUI, nothing, that only takes the first 4 taps, or first 8, make an average, and then change the tempo with that value?

Try looking inside the script, but it's too complex for me yet, with all that GUI Stuff in the middle.

Thanks as always X-Raym!
__________________
Living la vida loca
Pasajeromoronmoreno is offline   Reply With Quote
Old 08-28-2015, 07:56 AM   #7
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

thanks X-Raym.... question though... should it work by tapping any key?

cuz for me it don't .... works only tapping the mouse, both left and right, either\or but not for any of the keyboard keys...

Is it me or ????
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 08-29-2015, 02:32 PM   #8
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Hi guys !
Thabks for your comments, I'm off for a couple of days but I'll get back to it soon !

@hopi
It should work with any keyboard input, at least I remember it works for CTRL.

@Pasajeromoronmoreno
It could be adpat in other forms but I like it with GUI, with all infos :P
We could imagine a button to set the average tempo as project tempo mais it may be overkill. We can simply set the tempo by double clicking on it on transport bar.

@SmajjL
New and still in dev !
X-Raym is offline   Reply With Quote
Old 09-01-2015, 02:34 AM   #9
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Hi !

Just installed this script, which , BTW, is insanely useful for me !

But:

- I can only tap with left or right mouse button, so it seems.
I tried a few keys like spacebar , W and Q, they don't work.

- Secondly, when tapping with mouse button, the estimated BPM is really way off.
For a 114 bpm track that i tap along with, i get readouts from about 230 BPM.
I do have a real good "tap along" skill, so that can't be the issue :0)

OSX 10.10.5
Reaper 5.02pre1 - 64bit.
vanhaze is offline   Reply With Quote
Old 09-01-2015, 04:07 AM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Code:
 * v0.7 (2015-09-01)
  + Better deviation Engine ?
  - Max
  - Min
  # Any keyboard output
I remove some displayed information what I think was not relevant or not mathematically correct.

The maths inside should be better but I still have some doubt about some value I would like to display... Still in progress...

(but again, it works :P)

WAIT FOR THE V8.

It will be far better.

Last edited by X-Raym; 09-01-2015 at 04:54 AM.
X-Raym is offline   Reply With Quote
Old 09-01-2015, 05:20 AM   #11
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Code:
 * v0.8 (2015-09-01)
  + New input engine based on BPM
  + min, Max, Deviation and Precision
Thise one should be nice :P
X-Raym is offline   Reply With Quote
Old 09-01-2015, 06:33 AM   #12
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

- Keyboard input now works for me : Great !!
- But .. the calculated tapped tempo is still way of:

Tapped along on space bar with a disco track with 127 bpm average.

Outcome: (in green): average bpm: 358, max bpm: 361 , min bpm: 333

To me it seems not only these values are way of, but also the others .. (deviation etc.)
vanhaze is offline   Reply With Quote
Old 09-01-2015, 06:56 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Hmmmm

average BPM seems pretty fine to me, you get "wrong" values because you tap the eigth notes, not the quarter notes. 358 / 2 = 129 (close to 127 you were looking for).
but yes min and max are a bit extreme, but is seems to be "statiscly" correct, I only used standards stats function such as variance and standard deviation from other libraries...



I think we can get the most precise tap tempo ever by caclulating the average of all the averages... An idea to digg :P
X-Raym is offline   Reply With Quote
Old 09-01-2015, 07:14 AM   #14
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Hi !

No, i definitely tap 1/4 notes here...
Can it be that it has something to do with Reaper's host tempo setting or maybe even samplerate
of Reaper project ?

(problaby not, just checking :0)
vanhaze is offline   Reply With Quote
Old 09-01-2015, 07:46 AM   #15
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@vanhaze
Absolutely not, it is just about key typing here

hmm...

I'm curious can you test with metronome only ?
set it to 1/4, tempo what you want, and see if average bpm match.
X-Raym is offline   Reply With Quote
Old 09-01-2015, 07:56 AM   #16
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Sure,

Here is a vid that i made, with only metronome and tapping with left mouse key.

https://www.youtube.com/watch?v=ogdSlRPTy6o
vanhaze is offline   Reply With Quote
Old 09-01-2015, 08:06 AM   #17
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Vanhaze
Hmmm... you on a Mac....
All typing is calculated with a function "os.clock", I wonder if this function may work differently on mac than on PC...

I'll have to check that on a Mac to see that, it may be the cause of the problem, because I you can see, I personnaly don't have any problem (here on Windows).

Just an idea, it may be something completly different.

Can someone else test it ?
X-Raym is offline   Reply With Quote
Old 09-01-2015, 08:33 AM   #18
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Thx for your reply !

Hope to see some mac users indeed, to test.
This is script will be of incredible value to me :0)
vanhaze is offline   Reply With Quote
Old 09-01-2015, 08:53 AM   #19
Sumalc
Human being with feelings
 
Join Date: Oct 2009
Location: France
Posts: 745
Default

Quote:
Originally Posted by X-Raym View Post
@Vanhaze
Hmmm... you on a Mac....
All typing is calculated with a function "os.clock", I wonder if this function may work differently on mac than on PC...

I'll have to check that on a Mac to see that, it may be the cause of the problem, because I you can see, I personnaly don't have any problem (here on Windows).

Just an idea, it may be something completly different.

Can someone else test it ?
OK but can't access to your download link
Sumalc is offline   Reply With Quote
Old 09-01-2015, 09:01 AM   #20
Nixon
Human being with feelings
 
Nixon's Avatar
 
Join Date: Dec 2011
Posts: 407
Default

Little bit late but thank you XRaym! This is what i was wishing for
Nixon is online now   Reply With Quote
Old 09-01-2015, 09:26 AM   #21
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Quote:
Originally Posted by X-Raym View Post
@Vanhaze
Hmmm... you on a Mac....
All typing is calculated with a function "os.clock", I wonder if this function may work differently on mac than on PC...

I'll have to check that on a Mac to see that, it may be the cause of the problem, because I you can see, I personnaly don't have any problem (here on Windows).

Just an idea, it may be something completly different.

Can someone else test it ?
Maybe Reaper devs can chime in on this ?!
vanhaze is offline   Reply With Quote
Old 09-01-2015, 09:27 AM   #22
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Sumalc
Thanks : Go to my script pack on my website (link on my signature), download my script pack and import Tap Tempo script in Tempo folder !

@Nixon
Hope it will work for you !

@vanhaze
Just added (not uploaded yet) a way to do the same stats anylisis on all the last 16 averages BPM calculated. It output more steady value than just looking at the input... Just testing.
X-Raym is offline   Reply With Quote
Old 09-01-2015, 09:52 AM   #23
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Hero !
vanhaze is offline   Reply With Quote
Old 09-01-2015, 12:02 PM   #24
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Vanhaze
Can you make a simple test ?
  • Open action window
  • ReaScript New
  • Create s cript called Clock test.lua
  • paste the code below in it
  • Press CMD+S
  • Check if the clock variable displayed on the right of the editor is increasing like seconds. (it should display a certain number of seconds, and increasing at regulary interval (1 unit = 1 seconds)
Code:
function main()
  clock = os.clock()
  reaper.defer(main)
end
main()

Thanks !
X-Raym is offline   Reply With Quote
Old 09-01-2015, 12:51 PM   #25
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Hi, many thx for helping me !!

I get an error when doing the step: CMD+S , see attachment...
Dunno what to do ..

Last edited by vanhaze; 01-09-2016 at 02:50 PM.
vanhaze is offline   Reply With Quote
Old 09-01-2015, 12:55 PM   #26
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Vanhaze
it is not .eel, but .lua
X-Raym is offline   Reply With Quote
Old 09-01-2015, 01:08 PM   #27
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Sorry mate, i gotcha haha :0)

So now, no error when doing what you stated.

Outcome:

I watched the clock variable : it's not increasing in seconds : it's increasing like in almost 2 seconds ...

So i think this is the culprit, don't you think ?
vanhaze is offline   Reply With Quote
Old 09-01-2015, 01:13 PM   #28
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Vanhaze
definitely, I really wonder why, and it is a bit disturbing as os.time is the most accurate way to benchmark Lua scripts as it can handle milliseconds.
I wonder if it is an Lua integration error or something wrong on a your personal config...

We need more testers.


@all

Can someone else with a Mac OSX test the clock.lua script ?
X-Raym is offline   Reply With Quote
Old 09-01-2015, 02:19 PM   #29
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
Default

Quote:
Originally Posted by X-Raym View Post
Can someone else with a Mac OSX test the clock.lua script ?
Sure. Here 1 clock unit seems to correspond to ~3 seconds.

EDIT: However, if I change it to this, then 1 clock unit seems to correspond to ~1 second:

Code:
function main()
  clock = os.clock()
  repeat until os.clock() >= math.ceil(clock)
  reaper.defer(main)
end
main()
I guess if I leave out reaper.defer(main) it would be exactly 1 second, but then of course I would not be able to see the results...

Last edited by Tale; 09-01-2015 at 02:30 PM.
Tale is offline   Reply With Quote
Old 09-01-2015, 02:28 PM   #30
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Tale
Thank you, it is all what I needed, I will report that in order to see if is it normal.

@all
More graphical experiment :
Display average of averages with small square, with grey level according to BPM (black = slow, white = quick tempo).
If you see a complete flat color rectangle on the average of averages display: you nailed it !
See how it is more homogeneous than simple averaging (for the same BPM output).



See how we can get from 0.97 to almost 100 precision :P


In this demo you will how I use it to find the tempo of a song, and then some experiment with different speed of typing.
Animated demo here

Last edited by X-Raym; 09-01-2015 at 02:57 PM.
X-Raym is offline   Reply With Quote
Old 09-01-2015, 02:36 PM   #31
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
Default

Quote:
Originally Posted by X-Raym View Post
@Tale
Thank you, it is all what I needed, I will report that in order to see if is it normal.
You're welcome. Have you seen the edit I did just before you answered? It would seem that reaper.defer(main) "steals" some of the script time, but I guess this is to be expected. But I don't know why this seems to have little impact on Windows (or at least at your end), and seems to have a lot of impact on OSX.
Tale is offline   Reply With Quote
Old 09-01-2015, 02:40 PM   #32
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Tale
Thanks for the infos !
Do you think I have to find another way to measure time that calling os.clock ?
I need milliseconds precision.
X-Raym is offline   Reply With Quote
Old 09-01-2015, 02:50 PM   #33
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
Default

Quote:
Originally Posted by X-Raym View Post
@Tale
Thanks for the infos !
Do you think I have to find another way to measure time that calling os.clock ?
I need milliseconds precision.
TBH this was my first experience ever with Lua, so I don't really know... That being said, I Googled os.clock(), and it seems that it does return the fractional time in seconds, but only while the script is running. So maybe on OSX the script gets paused during defer? I have no idea how to fix this though.
Tale is offline   Reply With Quote
Old 09-01-2015, 03:07 PM   #34
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Xenakios just suggest me to use Reaper function time precise().
http://forum.cockos.com/showpost.php...01&postcount=2

I think it is the way to go.
I will rewrite that and see if it works :P
X-Raym is offline   Reply With Quote
Old 09-01-2015, 03:18 PM   #35
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

v1.0 is out !

Code:
 * Changelog:
 * v1.0 (2015-09-02)
  + Mac user firendly
  + Graphical display
X-Raym is offline   Reply With Quote
Old 09-01-2015, 10:02 PM   #36
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Yes, you nailed it !

Working now perfectly in mac version Reaper :0)
Made a Toolbar Button in Arrange to call the script.

This made my day already and it's just starting, woohaa !!
vanhaze is offline   Reply With Quote
Old 09-01-2015, 11:26 PM   #37
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Vanhaze
Aaaah yeah it was quite experimental and uncertain, so seeing that the result is actually effective is pretty nice :P
X-Raym is offline   Reply With Quote
Old 09-02-2015, 01:08 AM   #38
Sumalc
Human being with feelings
 
Join Date: Oct 2009
Location: France
Posts: 745
Default

Thank you very much Raymond, it works fine on my mac.
Sumalc is offline   Reply With Quote
Old 09-03-2015, 01:43 PM   #39
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Some display fixes :

Code:
 * v1.1 (2015-09-03)
  # Precision is now Accuracy
  # Precision display fixed
Should be easier to understand. The more Accuracy you have, the more precise it is !
X-Raym is offline   Reply With Quote
Old 09-03-2015, 08:00 PM   #40
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Many thx for the update !!
vanhaze is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.