Play an Audio File?
-
Is it possible to drag and drop (then play) an audio file on the interface? I can't find anything about it in the documentation or the forums, but I seem to remember being able to do it while I was experimenting with samples-- unfortunately I did not save that project.
-
Yes is the answer
@veryveryhaps said in Play an Audio File?:
(then play)
Do you want it to play automatically?
-
@David-Healey
Either one would work, I think. Thank you for the quick response! -
@veryveryhaps You can add an audio waveform component to your UI which has built in drag n drop. Connect it to a sampler or audio loop player. Then add a callback for the drop action and trigger the note from there.
-
Thank you, that works perfectly!
-
Sorry, but is there a way to pause and continue it inside the interface? I tried adding a button to trigger it, but it doesn't seem to be a property in the looper.
-
@veryveryhaps I haven't really used the loop player much so I'm not sure what's possible with it. I think there is some documentation for it though.
-
@veryveryhaps The Audio Loop Player responds to MIDI like any other sound generator.
If you only want to trigger it from the UI try
playNoteFromUI. It's meant for triggering sound generators from UI elements. It simulates pressing a key on the virtual keyboard.There's also the cunningly-slightly-differently-named
noteOffFromUIto stop playback.As for pausing playback and continuing from the same point, I'm not sure.
const var loopNote = 60; const var channel = 1; inline function onPlayButton(component, value) { if (value) // button ON Synth.playNoteFromUI(channel, loopNote, 127); else // button OFF Synth.noteOffFromUI(channel, loopNote); } Content.getComponent("Button1").setControlCallback(onPlayButton);