Go / sleep

Anyone working with sapf playing around with go / sleep ? and have a very simple example you can share… this plays the fist square but not the sine in the function.

\[
	[110 55] .5 1 steps 0 square .1 * 
 	\[1 sleep [330 550] .2 1 steps 0 sinosc .1 *] go
] ! play

this works

\[
	"this" pr cr
	\[1 sleep "that" pr cr ] go

] ! 

sorry for the Im sure very simple question

The sleep function performs a side effect – sleeping the current thread. The go function spawns a thread that runs the argument function. go returns no value. The functions like steps, sinosc etc. compose lazy lists producing audio. The audio functions and thread functions don’t compose with each other. But, if you add a play into the inner function this example can work.

\[
	[110 55] .5 1 steps 0 square .1 * 
 	\[1 sleep [330 550] .2 1 steps 0 sinosc .1 * play] go
] ! play
1 Like

Thank you so much, I understand it better now