Meine erste Produktion mit Midilib bleibt schlecht, aber tut nicht mehr weh. Ich weiss sogar was in der ersten Version schief gegangen war.
Warnung: ab hier wird es wieder ungemein technisch!
Im 3. Track, voices, hatte ich Polyphonie eingeführt. Das ging so:
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 127, 0)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, 0)
Also: 2 NoteOnEvents, die Gleichzeitig anfingen. Der 1. Ton ging bis zum Ende des Taktes, der 2. nach eine Achtelnote lang. Ich werde diese 2 Töne zusammenbringen, und einige Zeilen auslassen.
# now add the voice
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 127, 0)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, 0)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, eighth_note_length)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 200, note_length)
Die letzte Zahl im Aufruf von NoteO[n|ff]Event.new ist jetzt wichtig: hier wird der Zeitunterschied zum letzten Event angegeben. Ich müsste also von note_length noch die Länge des 2. Tones abziehen, um auf genau eine ganze Note auszukommen! Würde ich also genau diese 2 Töne nebeneinander spielen wollen, müsste die letzte Zeile so läuten:
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 200, note_length - eighth_note_length)
Hier dann wie es jetzt aussieht:
# now add the voice
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 127, 0)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, 0)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, eighth_note_length)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 7, 127, 0)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 7, 127, eighth_note_length)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 9, 127, 0)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 9, 127, eighth_note_length)
# and sometime put on and off an effect
# I'm not sure yet that this works
voices.events << Controller.new(VOICE_CHANNEL, CC_SUSTAIN, 133)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 7, 127, eighth_note_length)
voices.events << NoteOnEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, quarter_note_length)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 4, 127, quarter_note_length)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE + 7, 127, 0)
voices.events << Controller.new(VOICE_CHANNEL, CC_SUSTAIN, 0)
voices.events << NoteOffEvent.new(VOICE_CHANNEL, tone + 2 * OCTAVE, 200, 0)
So langsam fange ich an, etwas zu verstehen. Auf auf, zu neuen Ufern.

