Tape delay emulation issues

Hi!

I spent some time searching for answers to this specific question but I didn’t find any. I’m sorry if I missed any relevant posts.

I want to create a tape delay emulation that behaves exactly like an actual tape delay (e.g. space echo) when the delay time is modulated during performance. Here is an example (things like multitap aside):

  1. Set the delay time to 0.5 secs and the feedback to something between 0.9 and 0.95.
  2. Play some high notes.
  3. Within about 0.5 secs, modulate the delay time to 5 secs. You hear a short chirp, as the high notes get pitched down.
    When the modulation is done, the notes drone along, now with low pitch. This is because the distance between the write head and the read head is static and the modulation is done by reducing the tape speed. Write and read speeds are coupled.
    Any implementation that modulates the delay time by adjusting the time delta between the write head and the read head behaves differently: The short chirping sound that is created by modulating the read speed gets fed into the feedback loop and is played back repeatedly, because the write speed didn’t change along with the read speed.

So I thought I could model the desired behaviour by using a Buffer, BufRd, BufWr and modulating the delaytime via the rate of a Phasor that drives both the read and write positions. But this doesn’t work. I suppose, the problem is that BufRd has interpolation and BufWr doesn’t. Not sure though…

Any help would be very much appreciated. Thanks in advance!

(
// tapedelay
// instantiate and play annoying test signal through delay
r = Routine({
    SynthDef(\tapedelay1, {
        var in, send, buf, numChan, bufSize, writePos, write, readPos, read, time, sig;

        in = Saw.ar({LFNoise0.kr(0.25, 24, 72).round.lag(0.4).midicps}!4)
        * Decay2.ar(Impulse.ar(0.25), 0.5, 2)
        * -18.dbamp;
        in = in.sum;

        send = BLowShelf.ar(in, \loShlv.kr(300), 1, -6);
        send = BHiShelf.ar(send, \hiShlv.kr(1500), 1, -6);

        numChan = 1;
        bufSize = (s.sampleRate * 10);
        buf = LocalBuf(bufSize, numChan);
        //buf = Buffer.alloc(s, max, numChan);
        buf.clear;

        //time = (10 / \time.kr(2)).lag(0.4).round;
        time = (5 / \time.kr(1)).lag(0.4);
        writePos = Phasor.ar(0.0, time, 0.0, bufSize).poll;

        readPos = (writePos + (bufSize * 0.5)).wrap(0, bufSize).poll;
        read = BufRd.ar(numChan, buf, phase: readPos, loop: 1, interpolation: 4);

        send = send + (read * \fb.kr(0.5));

        write = BufWr.ar(inputArray: [send], bufnum: buf, phase: writePos, loop: 1.0);

        sig = in + read;
        sig = sig!2;
        Out.ar(0, sig);
    }).add;

    s.sync;

    v = Synth(\tapedelay1);
});
r.play;
)

// then modulate the delay time and enjoy the artifacts
v.set(\time, 10);
v.set(\time, 8);
v.set(\time, 5);
v.set(\time, 3);
v.set(\time, 1);
v.set(\time, 0.75);
v.set(\time, 0.5);
v.set(\time, 0.4);
v.set(\time, 0.2);
v.set(\time, 0.1);
v.set(\time, 0.05);
v.set(\time, 10);
v.set(\fb, 0.0);
v.set(\fb, 0.95);

I think that’s exactly it.

A forum search turned up an interpolating buffer write UGen:

I haven’t used this myself so I can’t offer any specific support, but it’s good that some code exists for this. (Not 100% sure it meets your needs – edit: it probably does! – but it’s worth a look.)

hjh

Thanks a lot for your instant response!

Your suggestion might indeed be exactly what I need.

However, I am facing some issues that are beyond my experience level: The binaries are five years old and don’t work on my M1 mac with SC 3.13.0-rc1. Since I have no experience with compiling from source on a mac, let alone an M1, I’ll need some time to figure it out, so I won’t mark this as the solution (yet).

I’m not on Mac so I can’t help with details of that, but some users here are on M1 and have built UGens before… hoping one of them will chime in.

hjh

I don’t have an M1 but as it is my code I can probably do a compile for you on my ‘old’ i9. I might as well compile for the other platforms.

I’ll do that this afternoon. I won’t codesign it as I don’t know how (it wasn’t me who did that on FluCoMa) but I should probably do a CI implementation on this as well one day. But for now I’ll compile the binaries.

more soon

p

1 Like

Can you please try this compile to see if it works on M1? If not I’ll need to change stuff in the cmake so I’ll need to dig a bit.

No, it does not work on my system.

After replacing the old file ~/Library/Application Support/SuperCollider/Extensions/IbufWr/plugins/IbufWr.scx, recompiling the class library and several relaunches of SC, running my test code or the audio example from the IBufWr help file yields an error message:

exception in GraphDef_Recv: UGen ‘IBufWr’ not installed.
*** ERROR: SynthDef temp__3 not found
FAILURE IN SERVER /s_new SynthDef not found

Syntax highlighting in SCIDE works.

Thank you for getting into this!

hmmmm - I’ll try to see the difference in the CMake that supports M1 then. The compile works here but as I’m not on that hardware I probably have to build far somewhere or remove some vector optimisation at least…

ok thanks to this thread I’ve been able to find in this other thread how to make it work :slight_smile:

Can you please confirm that this works on M1?

If it does I’ll add that to my CMake and publish as an update.

It works =)

Didn’t try it with my test file, but the audio example from the helpfile runs flawlessly.

Since the binary is unsigned, I had to do the following to be able to run it:

  1. Open SC
  2. Boot the server → mac os complains about unsigned binary
  3. In System settings>Privacy & Safety>General, confirm you want to allow IBufWr.scx to run
  4. Relaunch SC and boot the server
  5. Confirm again in the dialog that pops up
  6. From now on, it will run as usual

(setting
spctl --add ~/Library/Application\ Support/SuperCollider/Extensions/IBufWr/plugins/IBufWr.scx
in the shell didn’t work on my system running 12.6.1 Monterey.)

IBufWr/HelpSource/Guides/BufferWritingGuide.schelp is broken btw:

ERROR: In ~/Library/Application Support/SuperCollider/Extensions/IBufWr/HelpSource/Guides/BufferWritingGuide.schelp:
At line 247: syntax error, unexpected end of file

Thanks again Pierre and James, you made my day! =)

1 Like

ok I’ll try to make signed binaries and publish - I should be able since I am the holder of the FluCoMa Apple account - but it doesn’t mean I have the knowledge.

More soon, but in the meantime this fat unsigned will be on WeTransfer for a week.

p

OK I think I managed to codesign notarize and staple it all.

Can anyone on MacOS try this and see if they get it to work as is (aka without removing the checks)

thanks

It runs on my system without any confirmation dialogs whatsoever. However, I don’t know how relevant this is, since I already validated last week’s version.
I tried to reset gatekeeper with

sudo spctl --master-enable

, but I’m not sure if it worked as expected.
Does anybody know how to reliably reset gatekeeper on mac os monterey?

I’m told by other sources that it worked :slight_smile:

So I went full release including Linux and Windows updates too

I’m doing my other set later today and was planning to make a very grand announcement including Rhiana singing at the white house, or something a little more ambitious :smiley:

Good thing I checked - it seems I published at the wrong place!