stuck on on note

Options
pule_puje
pule_puje Member Posts: 2 Newcomer

Hi everybody,

I'm working on a script and I'm kinda stuck on the range of notes played.

on init
declare %CMaj[29] := (48,50,52,53,55,57,59,60,62,64,65,67,69,71,72,74,76,77,79,81,83,84,86,88,89,91,93,95,96)
declare $key_count

on note
if($EVENT_NOTE = 36)
	while ($NOTE_HELD=1)
		play_note(%CMaj[random(0, 28)]+$key_count, random(10, $Force), 0, -1)
		if ($key_count # 0 and in_range($EVENT_NOTE, 36, 96))
		play_note((%CMaj[random(0, 28)]+$key_count)-12, random(10, $Force), 0, -1)
		end if
		wait ($Speed)
	end while
	end if 
end on

$key_count is a counter that increments with different key signatures (C=0, C#=1, D=2, ecc) so that I can randomly play notes within the chosen key signature. My target is that, if the note that comes out of the playnote is over 96 (the limit I've setted for the samples), that note must be played an octave lower, so that it stays within the range. But I can't figure out how to do this. Any help would be really appreciated.

Comments

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    Options
    random(0, 28)]+$key_count, random(10, $Force)
    

    This should be stored to a variable first, then test that value if it's above 96 and subtract -12 from it if it is.

Back To Top