play_note return
-
- KVRer
- Topic Starter
- 19 posts since 29 Dec, 2015
Does play_note return immediately after being called, or after the note it is playing ends? What does it return?
If I want to have a second Play_note start after the first play_note begins, but before the first played note ends (so they overlap mid way) how is that achieved?
If I want to have a second Play_note start after the first play_note begins, but before the first played note ends (so they overlap mid way) how is that achieved?
-
- KVRAF
- 4683 posts since 16 Mar, 2004 from Columbia, MD
If you set a variable to play_note, the variable stores the event ID generated. For example..
$e := play_note(60,60,0,-1)
This would play MIDI note 60, at velocity 60, with no sample offset (0), and release the note when the triggering key is released (-1). If you set -1 to 0, the note will sustain indefinitely. If you set it to >0, the note will sustain for a set length of time before releasing.
$e then is set to the unique ID of the generated note.
You can run as many play_notes as you like regardless of how many active voices there are. (Well, there's probably a limit somewhere, but that's beside the point.) You can even play the same MIDI note multiple times and the voices will just stack.
Besides the release behavior set by play_note itself, you can manipulate the events however you would like. For example, by using fade_out and note_off, combined with custom logic for the 'on release' callback.
$e := play_note(60,60,0,-1)
This would play MIDI note 60, at velocity 60, with no sample offset (0), and release the note when the triggering key is released (-1). If you set -1 to 0, the note will sustain indefinitely. If you set it to >0, the note will sustain for a set length of time before releasing.
$e then is set to the unique ID of the generated note.
You can run as many play_notes as you like regardless of how many active voices there are. (Well, there's probably a limit somewhere, but that's beside the point.) You can even play the same MIDI note multiple times and the voices will just stack.
Besides the release behavior set by play_note itself, you can manipulate the events however you would like. For example, by using fade_out and note_off, combined with custom logic for the 'on release' callback.
Shreddage 3 Stratus: Next generation Kontakt Player guitar, now available!
Impact Soundworks - Cinematic sounds, world instruments, electric guitars, synths, percussion, plugins + more!
Impact Soundworks - Cinematic sounds, world instruments, electric guitars, synths, percussion, plugins + more!
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
Only in case the sample is looped. The more correct statement is "if length parameter is set to 0, it will play the sample back in its entirety"zircon wrote:If you set -1 to 0, the note will sustain indefinitely.
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
Use wait() command.
- KVRAF
- 4655 posts since 1 Aug, 2005 from Warszawa, Poland
You get it wrong, there is no return. The note starts to play after callback is finished or during wait time invoked by wait command. Use play_note command, do whatever else calculations you need to do, execute wait command, and note starts at wait command.gwhiz wrote:But does the first play_note return after 8 beats, or immediately? How do I wait two beats after the first play_note begins (not ends)
-
- KVRer
- Topic Starter
- 19 posts since 29 Dec, 2015
ZQ,
We are trying to play two notes, one immediately that lasts for 8 beats, another after two beats of rest. So, in the on note, we call play_note to play the first note, then wait ($DURATION_BEAT * 2) the play_note for note two?
So play_note #1 continues to play for 8 beats, and the #2 start after the two beat wait?
We are trying to play two notes, one immediately that lasts for 8 beats, another after two beats of rest. So, in the on note, we call play_note to play the first note, then wait ($DURATION_BEAT * 2) the play_note for note two?
So play_note #1 continues to play for 8 beats, and the #2 start after the two beat wait?
- KVRAF
- 4655 posts since 1 Aug, 2005 from Warszawa, Poland