Akai APC Mini saple with tempo

147 views
Skip to first unread message

Igor Roberti Foc

unread,
Jul 15, 2017, 5:16:34 PM7/15/17
to Lightjams
Hello,
I attach a file that use APC mini for manage scenes, 
i try to include a tempo management (beat, detected tempo, tap tempo, ...) and is think to create scenes syncronised every 16 beats (you can move betweens scenes and not loose the position of beat).

If someone is interested, please post .. we can share idea and maybe optimize some formula.

I would like to find automatically the begin of 1/16 ( I program a button that reset, but it's manually), someone has an idea how to do? I suppose to check if a beats doesn't appear for 5 second is the start, but I don't know how to write in a formula. 

Bye 
Akai apc mini - scene and tempo 32 beats.PNG
Akai apc mini - scene and tempo 16beats.ljp

Mathieu

unread,
Jul 16, 2017, 9:03:45 AM7/16/17
to ligh...@googlegroups.com
Hi,

Nice project! Thanks for sharing.

Many things are going on. One formula in the Akay_TempoMaker grid seems to be selecting a y position based on the latest received midi note:

switch(midi.note.latest(1),89,30,88,40,87,50,86,60,85,70,84,80,83,90,99,60)

One tip to avoid having to manually calculate the percent value corresponding to each y position is to use the yToPercent function. You can simplify the formula this way, by using the y positions directly (I've used arbitrary positions in the example):

ytopercent(switch(midi.note.latest(1),8,7,8,4,7,4,3,6,5,7,8,8,8,9,9,6))

Another tip is to use the lastNoteIndex parameter of the midi.note.latest function. In the Akay_Scene_Selector grid:

IF(midi.note.latest(1) < 65,mem(0,(midi.note.latest(1)-1)%8)+1,last)

can become something like:

mem(0,(midi.note.latest(1, 1, 64)-1)%8)+1

And for the other sources using the result as their x position, the xToPercent function comes handy. So instead of:

IF(recall(1)>3 & recall(1)<9,recall(0)/8*100,last)

the formula becomes:

IF(recall(1)>3 & recall(1)<9, xtopercent(recall(0)),last)

The benefit is that if you resize the grid, it will still work since the width of 8 isn't hardcoded anymore. Also if you need the percent offset corresponding to one horizontal cell, you can use xToPercent(1).

As for the detection of start of the 1/16, maybe the timeout or the timeoutOrActive functions can help. Something like resetting a counter when there's a timeout of 5 seconds. So the formula in the Akay_TempoMaker grid becomes: 

gmem(50,counter(1,16,onbeat(grid.powerat(x-2, y)),0,onbeat(midi.note(1, 90) | timeout(5,onbeat(grid.powerat(x-2, y))))  )/16*100-1)

The counter function resets when pressing the midi note 90 or if there's no beat detected for 5 seconds.

Igor Roberti Foc

unread,
Jul 16, 2017, 3:22:03 PM7/16/17
to Lightjams
Thank you for the advices. I will use xToPercent next time, I spend 1 evening for this layout and I don't won't spend 1 evening for make corrections :) 

for the reset function I used 
trigger(music.1.low.beat, 5, 20,50, 0.30), it's a bit better because when detect the beat after 5 second of no-beat, it do the 0->100% (And it work, maybe not for some strange music). 


My problem now is detect a reliable tempo, it's so difficult because I have some "false-positive".  For this I create on right-bottom corner a group of tap-tempo that iterate every 3-4 second, and if I found the same bpm on 2 I will use.
--> Not work very weel... Do you have an Idea how to do better?
Akai apc mini - scene and tempo 16beats.ljp

Mathieu

unread,
Jul 16, 2017, 6:59:30 PM7/16/17
to Lightjams
The taptempo function was made to be used with a midi keyboard or another manual input. So it needs a clear input to be useful. With music with clear and constant beats, it work nicely. I'll try to improve the taptempo function to be more stable with fuzzy inputs.

Mathieu

unread,
Jul 17, 2017, 9:02:04 AM7/17/17
to Lightjams
Another observation. If you want to move one step each time there's a music beat, instead of using the taptempo, it may be better to just use the music beat. So use something like onbeat(trigger(music.1.low.beat, 0.01, 30,60, 0.30)) to increment a counter.

This will more closely follow the music and when there's a sudden slow section, the counter will not get incremented like when using a taptempo.

So for your project file, you could have a way to select whether you want to manually set the tempo with the taptempo or use the music beat directly. Maybe you can use a MIDI button with the toggle function.

Mathieu

unread,
Jul 17, 2017, 12:25:25 PM7/17/17
to Lightjams
The beta version 420 has an improved taptempo function: http://www.lightjams.com/history.html

Igor Roberti Foc

unread,
Jul 18, 2017, 3:34:33 PM7/18/17
to Lightjams
Thank you very much Mathieu, the grid work like you said (you can choose which tempo you want to use with toggle buttons)..
I'm not an expert but I think that tap tempo work very well because if I tap with my finger the tempo it's work very accurate and for 2 minutes is still precise.
I think is the beat detection that shift a little bit the begin of the beat and then tap tempo doesn't catch the accurate value.
I think your function "beat" is something like music.1.low.beat>smooth(0.3,music.1.low.avg) + trigger or is more sophisticated?


Do you understand the language of this article :) ?

Thank you

Mathieu

unread,
Jul 18, 2017, 4:27:54 PM7/18/17
to Lightjams
Sorry, I'm not sure to understand the question. Is the updated taptempo working well? 

The onBeat function computes the average and the standard deviation. It fires when the current value is well over the average. 

The music.1.low.beat already does the heavy beat computation. So when it's over 0, there's a beat. The amplitude varies though. So if you want only big beats, you can do music.1.low.beat > 50. What the onBeat function does is to pulse at the start of the beat, which is handy sometimes. The taptempo function doesn't really need it though as it is already detecting the start of the beats.

Igor Roberti Foc

unread,
Jul 19, 2017, 9:49:05 AM7/19/17
to Lightjams
Sorry, is difficult write these technical things on English for me :)
I tested the new tap tempo but there is always some difference. You can check on my grid "tempomaker" on the right . There are 4 taptempo source and 1 source "music.1.low.beat' that move on y axis every 4 second between the 4 sources taptempo. Even if the music is very regular the 4 taptempo are not synchronised.

but, How i wrote, for me is not the taptempo function that is the cause. The cause is the "music.1.low.beat' that doesn't catch the beat (maybe is impossibile to catch, I don't know).
For this reason I ask you how "music.1.low.beat" work and I attach a webpage that use some calculation on array of music for detecting the beat in a better way. Yesterday I tryed to design a grid with the formula described on the webpage but is quite difficult manage a stack. 


Thank you

Mathieu

unread,
Jul 19, 2017, 1:46:09 PM7/19/17
to ligh...@googlegroups.com
I don't think you need two taptempos and then comparing the two. There's no real precision gain and only more complexity. Make sure the music volume is well adjusted and that the beats are visible when using a formula like music.1.low.beat > 40. 

Also, you need to be aware that the taptempo has a delay as it needs to first detect the tempo over a certain period. So when you want to follow the music beats closely, don't use the taptempo with the music input and use the music beats directly.
Reply all
Reply to author
Forward
0 new messages