monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
630 stars 147 forks source link

Tape breaks when used from script #1478

Open catfact opened 2 years ago

catfact commented 2 years ago

from https://llllllll.co/t/norns-scripting/14120/1032 :

function init()
  file = "/home/we/dust/audio/tape/0000.wav"
  audio.tape_play_stop()
  audio.tape_play_open(file) 
  audio.tape_play_start()
end

"Playback works initially; however if I then go to Tape and select Play or run audio.tape_play_stop() in matron I am no longer able to hear any audio from tape even after rerunning my script or playing a wav file with the Tape app."

i can reproduce this. almost certainly it is a bug in the crone::Tape state machine. only recoverable by restarting crone process.

strongly suspect that adding delays would avoid the bug: such that, e.g. the stop envelope completes before the next file is opened, etc.

this is another reason to perform/complete a full rewrite of the Tape module.

eethann commented 2 years ago

I just encountered this working on a tape operator for Orca, definitely interested in it to enable timed triggering of tapes for use during performance, etc. Not sure how useful I can be on debugging, but happy to help how I can.

catfact commented 2 years ago

gave this a minute of thought. there isn't really an easy bandaid. what i wish i could do is make all the tape API functions just do nothing if the module is busy (instead of corrupting state) and return a bool to the caller indicating whether the action was taken or not. (of course this is not very convenient for API user but would at least provide some sort of non-borking workaround.)

however even this kind of weak solution would be convoluted and tricky to implement right now because tape commands are just OSC messages and can't return anything (can only echo responses on a separate return channel.) so i don't think there is much point in addressing this in a useful way before we land the converged branch, whereupon lua and the Tape module will live in the same process.