Hello, I tried out your “Time ot of mind” code. But I don’t know what Iam doin wrong. Allways when i try to compile it I get the following message: Rackspace (Rackspace) - Semantic error in “Main”: Line 2, Col 4: Variable not found: trackCount
On NoteEvent(m : NoteMessage) Matching [C0…D0], B-1 from Keyboard
var
notes : MidiMessage Array
aNote : MidiMessage
index : integer
trackIndex : integer
if IsNoteOn(m)
then
if MidiSequence_EndOfSong(cs) or m.GetNoteNumber() == B-1
then MidiSequence_ResetToStart(cs)
end
MidiSequence_CollectEventsNow(cs);
notes = MidiSequence_GetCurrentEvents(cs, 3) // Lead synth
//Print(Size(notes))
for index = 0; index < Size(notes); index = index + 1 do
aNote = notes (index)
//Print{aNote)
LeadSynth.SendNow(aNote)
end
end
End
On NoteEvent(m : NoteMessage) Matching A-1 from Keyboard
MidiSequence_ResetToStart(cs)
AllNotesOff (LeadSynth)
end
I never scripted before I am total new to that. Perhaps you can help me?
Thx
This script looked very interesting. I tried re-creating it with the updates and also got a semantic error on the line after initialization. Looks like an undeclared object?
var Keyboard : MidiInBlock
LeadSynth : MidiInBlock
trackCount : Integer
cs : MidiSequence
initialization
trackCount := MidiSequence_LoadMidiFile(cs, "/Volumes/mds/seq1.mid")
Print(trackCount)
MidiSequence_Quantize(cs, 2)
MidiSequence_MapOutputChannel(cs, 2, 4)
end
on NoteEvent(m : NoteMessage) matching [C0..D0], B-1 from Keyboard
var
notes : MidiMessage Array
aNote : MidiMessage
index : integer
trackIndex : integer
if IsNoteOn(m)
then
if MidiSequence_EndOfSong(cs) or m.GetNoteNumber() == B-1
then MidiSequence_ResetToStart(cs)
end
MidiSequence_CollectEventsNow(cs);
notes = MidiSequence_GetCurrentEvents(cs, 3)
for index =0; index < Size(notes); index = index + 1 do
aNote = notes[index]
LeadSynth.SendNow(aNote)
end
end
end
Thank you. Now the script compiles. How has the midi sequence has to be set up? What track number is meant? I still try to understand the code… there’s cs, 2,4 and 3
…
sorry for beein’ such a noob