>bpmは実際の表示の32拍とは異なる144.0
bpmは1分間に四分音符を置ける数
>元の音声ファイル6min29secで60000は関連性の分からない謎の数値
60000は1分をミリ秒(ms)にしてるだけ
> fbt = bpm * ms / 60000 - 4
1分間の四分音符数*経過時間/1分=現在の譜面進行度
fbtが1で四分音符分の時間が進んだ事になる
0.5なら八分音符分となる
シンプルにしたやつ
mci "open vijore.wma alias snds type MPEGVideo"
if stat = -1 : mci "open vijore.wma alias snds type MPEGVideo2"
if stat = -1 {
dialog "サウンド再生エラー\n終了します", , "error"
end
}
onexit *exit
mci "status snds position"
ms = stat
st_pos = 666 ; start offset; ms
bpm = 144.0
bt_len = 928 ; length; beat (386.66 sec)
mci "set snds time format milliseconds"
mci "seek snds to " + st_pos
mci "play snds"
repeat
redraw 0
mci "status snds position"
ms = stat
fbt = bpm * ms / 60000 - 4
ibt = int( fbt )
if fbt < 0 : await 1 : continue ; 始まるのを待つ
if ibt >= bt_len : break ; 終わり
if ibt_bak ! ibt{// 1 beat 進行
color
boxf 0,0,640,100
color rnd(256),rnd(256),rnd(256)
ibt_bak=ibt
boxf 0,100,320,480
if (ibt\2)=0 {// 2 beat 進行
color rnd(256),rnd(256),rnd(256)
boxf 320,100,640,480
}
}
fb=(fbt-ibt)
if (fb>=0.20 and fb<=0.25) or (fb>=0.45 and fb<=0.50) or (fb>=0.70 and fb<=0.75) or (fb>=0.95) {// 1/4 beat 進行
color fb*255,255.0-fb*255,0
btline=(int(fb*100)\5)*10
line 320.0-fb*320,50+btline,320.0+fb*320.0,50-btline
line 320.0-fb*320,50-btline,320.0+fb*320.0,50+btline
}
if (ibt\32)=0 {// 32 beat 進行
color 255,255,255
circle -fb*320+320,-fb*320+240,fb*320+320,fb*320+240
}
await 2
redraw 1
loop
*exit
mci "close snds"
end