Adding a compile button to the interface?
-
Is it possible to create a button on the interface to compile the script?...
and will that even work once exported to vsti?
(Looking for a solution for my “randomizing midi player” button)Once the tempo is changed via the host/daw my randomize button throws the midi sequence all off, but when I compile in the same scenario the midi sequence is randomized and still In sync with the host/daw. So that’s the reason for the question.
-
bump bump
-
Is it possible to create a button on the interface to compile the script?...
No
and will that even work once exported to vsti?
No
Once the tempo is changed via the host/daw my randomize button throws the midi sequence all off
Sounds like a problem with your script.
-
This post is deleted! -
@BWSounds You don't have brackets for your if statement, so only the line immediately after it will take the
if
into account, is that what you want?You're missing a semi-colon at the end of this line
note.setTransposeAmount(Math.random() > 0.5 ? 0 : -12)
> note.setTimestamp(note.getTimestamp()
What's with the
>
? -
This post is deleted! -
Let's get some brackets
{ }
for your if statement so we can make sure everything you want to be affected by it is.What is triggering your button when the tempo is changed?
-
This post is deleted! -
@BWSounds Does the tempo go off if you don't click the button?
-
@d-healey
if I dont click the button everything is ok.. but the button is the only way i can randomize the sequence. -
@BWSounds What happens if you remove this line
note.setTransposeAmount(Math.random() > 0.5 ? 0 : -12);
-
@d-healey
same thing, the sequence stays the same but the length of it is changed. -
@BWSounds So the only thing that is causing the problem is this
MIDIPlay.flushMessageList(list);
I guess it must be a bug or an intended behaviour. I haven't used the MIDI player myself so I'm not familiar with this function. @Christoph-Hart Will know the answer. -
@d-healey
Ahh, well thank you for your help! -
@Christoph-Hart
any insight would be greatly appreciated. -
@Christoph-Hart - any insight would be greatly appreciated.
Bump Bump :)
-
I'll try one more time :man_shrugging: ...Bump
(I've tried everything, just cant be done yet I guess) -
https://docs.hise.audio/hise-modules/midi-processors/list/midiplayer.html#using-the-midi-player
The timestamp will use the current tempo and samplerate to be consistent with the rest of the MIDI processing in HISE. So if you have quarter notes at 44,1kHz and 120BPM, you will get these timestamps for the first bar:
This is your problem right here. The timestamps in your
list
have the old tempo baked in. In order to solve it, recreate the list at each randomization (however then the randomization will "stack up"):inline function onButtonranControl(component, value) { list = MIDIPlay.getEventList(); for(note in list) { if(note.isNoteOn()) note.setTransposeAmount(Math.random() > 0.5 ? 0 : -12); } MIDIPlay.flushMessageList(list); }; Content.getComponent("Buttonran").setControlCallback(onButtonranControl);
-
@Christoph-Hart
Ahh oK.. I took a quick look, but im getting this error
Can't assign to this expression!I'll look deeper into this error and try to fix it.
-
You probably have declared the list as
const var
. Usereg
instead.