How to retain an instrument, wipe song, start a new song and add the instrument in?

Hi, I used to have this nice little script that would take the first sample of the instrument (yep, most of my instruments are 1 sample only), create a new renoise song, paste it in. But it no longer works.

function WipeRetain()
local tmpvariable=os.tmpname("wav")

s.instruments[s.selected_instrument_index].samples[1].sample_buffer:save_as(tmpvariable, "wav")

if not renoise.tool().app_new_document_observable:has_notifier(WipeRetain_) then
       renoise.tool().app_new_document_observable:add_notifier(WipeRetain_) else

function WipeRetain_()


I’m wondering what would be required to make this work again in 3.1.1?

Have you looked at the API changes posted on the forum by taktik? Some things are renamed, changed or added.

From the top of my head, I think active_middle_frame was changed sometime. Do you get an error and what does it say?

Hi joule, long time!

Ok, so, there is no error that is shot. It just appears like the “clipboard” is written to, but then there’s nothing when the new document is started. Feels strange