Understanding stacks and arrarys

Ran into something basic that I don’t seem to get. I have two tones that want to play in a sequence using steps

[697 1209] 0 sinosc .1 * play

[770 1477] 0 sinosc .1 * play

but not sure how to play nested arrays

this plays the last item on the stack as expected

[697 1209] [770 1477] .5 2 steps 0 sinosc .1 * play

This dose not play… not sure why guessing the extra brackets

[[697 1209] [770 1477]] .5 2 steps 0 sinosc .1 * play

This plays the second sound

[697 1209] [770 1477] @ .5 2 steps 0 sinosc .1 * play

Plays only 770 1477 in a sequence, like the first just using what’s was last put on the stack

\[[697 1209] [770 1477]] = pitches pitches .5 2 steps 0 sinosc .1 * play

also just the last two freqs are played

\[
	\a b [ a b .5 2 steps] = pat
[697 1209] [770 1477] pat 0 sinosc  .1 * 
] play

So I guess how do you add nested arrays onto the stack or maybe how do you sequence items deeper in the stack…

maybe its each2 or 2ple but not catching it

Have you developed an approach for this? I’ve been using ola, which works. but seems kind of "“under the hood”… I’d prefer an overt method… I’m guessing something with seq or gate and an impulse train… There’s also expand, wseg, and some triggered windows that might have something to do with it… But once I figured out how to do ola I got lazy and just used that. (as does JM in most of his examples).

1 Like
0 everz 2X = 2quiet

2quiet ZP = 2plugA = 2outA
2quiet ZP = 2plugB = 2outB

2outA play    ;this does leak memory, but not too fast
2outB play    ;the idea is to keep two pipewires opened
              ;to Ardour

\[440 0 sinosc 0 0 impulse .75 decay * .75 * 2X .9 T] = tick
\[220 0 sinosc 0 0 impulse .75 decay * .75 * 2X .9 T] = tock

`tick R = tickRef  `tock R = tockRef

[\[tockRef get ! ] \[tickRef get !]]  cyc  1 1 2 ola 2plugA set 

;execute the block above
;then tinker with sounds and insert them:

\[.1 .9 rand pink 1/2 T 2X] = pinkSound  `pinkSound tockRef set   ; or just
\[100 880 xrand = f [f f 1.04 *] 0 sinosc .3  quadenv * .5 *]  tickRef set

2quiet 2plugA set   ; now just sending zeroes to Ardour or whatever

This is a harness I've been using to test short sounds..  I have a more elaborated version with references to sequences and rhythms as well as sounds, which can be switched out while ola runs.   (hope I formatted this right)




1 Like

Wow, this is interesting. Thanks for posting. I’m gonna play with this today

I really enjoy sapf. Just like you stated it ola is the way I presume James would do it. But I’m trying to get a deeper understanding of how things work so I’m avoiding it. 2ple might be what I need to employ… when I get snagged on something seeming small my brain starts to get fixated. I can simply make two step sequences and then stack them together, but it’s not very elegant. Would rather find a simpler way that works, and also helps my understanding of sapf arrays. It seems that it doesn’t want to look into double brackets…

Looks Events are also not totally flushed out. It’s out of scope for me now but it’s something I’m really interested in as well.

One oddity with the Zplug thing, if you send anything finite through them it leaves them in a bad state… that’s why I had to start them with a stream of zeros. On my box it will go about a half hour before crashing from no more memory, so I just keep an eye on it with top and kill and restart sapf every so often. Probably you can just run one ola through regular play… I use this method because I want to do reverb etc externally.

1 Like