private IEnumerator SamplerCoroutine() { //Create Sampler module: SunVox.sv_lock_slot(0); int mod_num = SunVox.sv_new_module(0, "Sampler", "Sampler", 0, 0, 0); SunVox.sv_unlock_slot(0); if (mod_num >= 0) { log("New module created: " + mod_num); //Connect the new module to the Main Output: SunVox.sv_lock_slot(0); SunVox.sv_connect_module(0, mod_num, 0); SunVox.sv_unlock_slot(0); //Load a sample: var path = "Assets/StreamingAssets/flute.xi"; // This path is correct only for standalone SunVox.sv_sampler_load(0, mod_num, path, -1); //Send Note ON: log("Note ON"); SunVox.sv_send_event(0, 0, 64, 128, mod_num + 1, 0, 0); yield return(new WaitForSeconds(1)); //Send Note OFF: log("Note OFF"); SunVox.sv_send_event(0, 0, 128, 128, mod_num + 1, 0, 0); yield return(new WaitForSeconds(1)); } else { log("Can't create the new module"); } }