As Single x
, y
, xv
, yv
, w
, h
, lastPlayed
size = 40
initialX = 0
box(i).w = size
box(i).h = size
box(i).x = initialX
box(i).y = initialY
box(i).xv = map(i, 1, 13, .5, 2.5) 'going right
box(i).yv = map(i, 1, 13, -.5, -3) 'going up
box
(i
).
color = hsb
(map
(i
, 1, 13, 0, 180), 255, 127, 255) fileName$
= "./24-piano-keys/key" + Right$("0" + LTrim$(Str$(note
)), 2) + ".ogg"
notes:
'notes files are named key##.ogg, ranging from
'01 (F) to 24 (E, two octaves up); these are
'the desired notes, but you can change the
'scale to play here, if you know what you're
'after.
Data 1,3,5,6,8,10,12,13,15,17,18,20,22
this = box(i)
Line (this.x
+ this.w
/ 2, this.y
+ this.h
/ 2)-(box
(i
+ 1).x
+ box
(i
).w
/ 2, box
(i
+ 1).y
+ box
(i
).h
/ 2), _RGB32(0)
this = box(i)
If timeElapsedSince
(this.lastPlayed
) < 1 Then ripple = map(timeElapsedSince(this.lastPlayed), 0, 1, 1, 15)
rippleAlpha = map(ripple, 1, 15, 127, 0)
Line (this.x
- ripple
, this.y
- ripple
)-Step(this.w
+ ripple
* 2, this.h
+ ripple
* 2), _RGB32(255, rippleAlpha
), B
ripple = map(timeElapsedSince(this.lastPlayed), 0, .5, 1, 15)
rippleAlpha = map(ripple, 1, 15, 64, 0)
Line (this.x
- ripple
, this.y
- ripple
)-Step(this.w
+ ripple
* 2, this.h
+ ripple
* 2), _RGB32(255, rippleAlpha
), B
this.x = this.x + this.xv
this.y = this.y + this.yv
bump = 0
If this.x
+ this.w
> _Width Then this.x
= _Width - this.w: this.xv
= this.xv
* -1: bump
= -1 If this.x
< 0 Then this.x
= 0: this.xv
= this.xv
* -1: bump
= -1 If this.y
< 0 Then this.y
= 0: this.yv
= this.yv
* -1: bump
= -1
box(i) = this
Function map!
(value!
, minRange!
, maxRange!
, newMinRange!
, newMaxRange!
) map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
H = map(__H, 0, 255, 0, 360)
S = map(__S, 0, 255, 0, 1)
B = map(__B, 0, 255, 0, 1)
hsb~&
= _RGBA32(B
* 255, B
* 255, B
* 255, A
)
fmx = B - (B * S) + S
fmn = B + (B * S) - S
fmx = B + (B * S)
fmn = B - (B * S)
H = H - 360
H = H / 60
H
= H
- (2 * Int(((iSextant
+ 1) Mod 6) / 2))
fmd = (H * (fmx - fmn)) + fmn
fmd = fmn - (H * (fmx - fmn))
If startTime!
> Timer Then startTime!
= startTime!
- 86400 timeElapsedSince!
= Timer - startTime!