Examples
<Tease scriptVersion="v0.1" id="">
<Title>
</Title>
<Url>
</Url>
<Author id="">
<Name>
</Name>
<Url>
</Url>
</Author>
<MediaDirectory>TempTest</MediaDirectory>
<Settings>
<AutoSetPageWhenSeen>false</AutoSetPageWhenSeen>
</Settings>
<Pages>
<Page id="start">
<Text>
<div>Metronome test</div>
<div>1 beat per second 16 beats</div>
</Text>
<Metronome bpm="60" beats="4" loops="3" rhythm="1,5,9,13"/>
<Button target="Test2">Test 2</Button>
</Page>
<Page id="Test2">
<Text>
<div>Second test</div>
<div>2 beats per second 32 beats</div>
</Text>
<Metronome bpm="120" beats="4" loops="7" rhythm="1,5,9,13"/>
<Button target="start">Start</Button>
</Page>
</Pages>
</Tease>
Explanation of how beats work
the 4 inputs are
-
BPM: (60 = 1 per second, 30 = 1 per 2 seconds, 120 = 2 per second)
-
beats: (number of "sub" beats) 60,4 would give a sub beat every 0.25 seconds (30,8 plus 120,2 would give the same)
-
Loops: number of times to loop (1 would loop once i.e. play it twice)
-
Rhythm: a list of sub beats to trigger a sound so if we do overRide.setMetronome("60", "4", "0", rhythm) this gives us a base speed of 60 with 4 sub beats, so a sub beat every 0.25 seconds
to do 10 beats at 1 per second we can do any of the following
- "1,5,9,13,17,21,25,29,33,36"
- "2,6,10,14,18,22,26,30,34,37"
- "3,7,11,15,19,23,27,31,35,38"
- "4,8,12,16,20,24,28,32,36,39"
if we do overRide.setMetronome("30", "4", "0", rhythm) this gives us a base speed of 30 with 4 sub beats, so a sub beat every 0.5 seconds
we can still generate the same rhythm with "1,3,5,7,9,11,13,15,17,19"
To generate a more useful rhythm let's say 5 slow beats (1 per 3 seconds) then 20 faster (2 per second), 6 times
For overRide.setMetronome("60", "4", "5", rhythm)
For the first 5 we need 1 per 12 sub beats ("1,13,25,37,49")
For the next 20 we need 1 per 2 sub beats ("51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89")
so overRide.setMetronome("60", "4", "5", "1,13,25,37,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89") would generate our desired rhythm
If we get two beats close together when it loops, we can offset the start of the sequence so starting 5,17 would force a 4 sub beat pause (1 second) between loops
This has kind of evolved whilst I was coding it rather than by design . So if anyone wants to come up with a friendlier way of setting the rhythm I am open to suggestions.