I'm writing a program that sequences music out of a bunch of stems differently each time. I now have a basic GUI with buttons that trigger resequencing, playing and bouncing of the track.
So, on execution, the program triggers the resequencing function once, and returns the output value ready for playback. This can be played using the play function, but to receive output within the function, the initial function has to be retriggered, which is not right.
I do not want to retrigger the sequencing function each time the user wants to replay the track, I just need to access the initial return data. I cannot assign the returned data outside the resequence function, as it would only be saved once, and only the first sequence would be available to play.
The below code example is what I have, and it doesnt work for me.
what I need is a way to save a variable each time resequencing occurs, and make it accessible to the play function. Play should not retrigger resequencing just in order to get the value.
:::
Resequence():
blah blah, sequencing.
return output
Play():
output=Resequence() # the value shouldnt change on each play.
play(output)
:::
Output is an Audio segment from PyDub. I tried saving it in a text file, which obviously did not work.
Please help :(