Possibility to start a buffer from another buffer

#1

Hello,

Sometimes it can be useful to distribute parts of the program over multiple buffers and run the buffers simultaniously. Practically this means that each time every buffer has to be started (run) manually. This also means that the time-code at the events in the log are different for events in different buffers, that in real-time take place at the same moment.

Does it make sense to introduce a new Sonic Pi command to start a buffer from another buffer, so that these buffers run synchronized and the time-codes are equal for the events, in these synchronized buffers, that happen at the same time?

Ruber.

1 Like
#2

Hi,

just as a quick (and not at all exhaustive) reply: You might want to have a look at run_file and run_code in the lang doc. I use run_file to run code (synchronized) within my live looper. Admittedly this is not exactly an answer to your proposal. But it might serve the same purpose.

#3

I was also wondering about this, specifically for live coding purposes where I would be mixing or blending together code from two separate buffers, sort of like a DJ switching from one record to another while integrating parts from both buffers and taking away parts from one buffer while adding parts to another until eventually one is no longer playing anymore.

#4

Hi,
if i would use run_file i had to save the content of every used “editorbuffer” into a file to use it.
I think it would be great to get direct access. Something like: "run_editorbuffer 9"
additional to that, Is there a way to start/stop recording?
With that i could do somthing like that:

record_start("/tmp/test.asd")
run_editorbuffer 3 #only defines/paths/…
run_editorbuffer 7
sleep sample_duration(editorbuffer 7)
run_editorbuffer 9
record_stop

#5

Have a look at with_fx :record

Eli…

1 Like
#6

Oh, never thought of it as an effect.
Thanks, i will have a look!

#7

hm…is there a way to save the recorded sounds? Cant find that.

#8

Sorry, not at present. What kind of code would you like to be able to write and what should it do?

#9

Hi,
maybe something like

with_fx :record, buffer: “a”, output: “/tmp/test.wav” do
play 80
sleep 4
end

And on reaching the end, SP will save the recorded buffer on the disk.
If i stop manually before the end is reached, nothing is saved? hm. good question. :smiley:
I would save it on manual stop either.

Second thing was the possibility of starting another “editorbuffer” (dont knowhow to call it). To get more structure in my code. Is this possible? run_file is a good workaround but not the same…

Thank you very much!