musikinformatik / SuperDirt

Tidal Audio Engine
GNU General Public License v2.0
519 stars 75 forks source link

Add DirtFreqScale UGen #244

Closed telephon closed 3 years ago

telephon commented 3 years ago

This fixes #240

ndr-brt commented 3 years ago

I tried but don't know if I did it correctly:

SynthDef(\supermandolin, {|out, sustain=1, pan, accelerate, freq, detune=0.2, speed=1|
        var env = EnvGen.ar(Env.linen(0.002, 0.996, 0.002, 1,-3), timeScale:sustain, doneAction:2);
        var sound = Decay.ar(Impulse.ar(0,0,0.1), 0.1*(freq.cpsmidi)/69) * WhiteNoise.ar;
        var pitch = freq * DirtFreqScale.kr(speedFreq: 1, speed: speed, accelerate: accelerate, sustain: sustain);
        sound = CombL.ar(sound, 0.05, pitch.reciprocal*(1-(detune/100)), sustain)
        + CombL.ar(sound, 0.05, pitch.reciprocal*(1+(detune/100)), sustain);
        Out.ar(out, DirtPan.ar(sound, ~dirt.numChannels, pan, env))
    }).add

I get this error:

ERROR: Message 'flop' not understood.
RECEIVER:
   nil
ARGS:

PROTECTED CALL STACK:
    Meta_MethodError:new    0x562dee0fcb80
        arg this = DoesNotUnderstandError
        arg what = nil
        arg receiver = nil
    Meta_DoesNotUnderstandError:new 0x562dee0feb40
        arg this = DoesNotUnderstandError
        arg receiver = nil
        arg selector = flop
        arg args = [  ]
    Object:doesNotUnderstand    0x562ded0c5fc0
        arg this = nil
        arg selector = flop
        arg args = nil
    DirtEvent:sendSynth 0x562dedff9e00
        arg this = a DirtEvent
        arg instrument = supermandolin
        arg args = nil
        var group = 1120
    DirtModule:value    0x562def935880
        arg this = DirtModule('sound')
        arg orbit = a DirtEvent
    ArrayedCollection:do    0x562def3360c0
        arg this = [ DirtModule('sound'), DirtModule('invert'), DirtModule('diffract'), DirtModule('binscr'), DirtModule('vowel'), DirtModule('ring'), DirtModule('ringshape'), DirtModule('tantanh'), DirtModule('tanh'), DirtModule('shape'), DirtModule('hpf'), DirtModule('bpf'), DirtModule('crush'), DirtModule('coarse'), DirtModule('lpf'), DirtModule('pshift'), DirtModule('envelope'), DirtModule('grenvelo'), DirtModule('tremolo'), DirtModule('phaser'), DirtModule('waveloss'), DirtModule('squiz'), DirtModule('fshift'), DirtModul...etc...
        arg function = a Function
        var i = 0
    a FunctionDef   0x562dedffb8c0
        sourceCode = "<an open Function>"
    a FunctionDef   0x562def5e5940
        sourceCode = "<an open Function>"
    Function:prTry  0x562dee3a1f40
        arg this = a Function
        var result = nil
        var thread = a Thread
        var next = a Function
        var wasInProtectedFunc = true
    Function:try    0x562dee3a1a00
        arg this = a Function
        arg handler = a Function
        var result = nil
    Server:makeBundle   0x562def5e5580
        arg this = localhost
        arg time = 0.19925048337007
        arg func = a Function
        arg bundle = nil
    DirtEvent:playSynths    0x562dedffb380
        arg this = a DirtEvent
        var cutGroup = nil
    a FunctionDef   0x562def4fd180
        sourceCode = "<an open Function>"
    Function:prTry  0x562dee3a1f40
        arg this = a Function
        var result = nil
        var thread = a Thread
        var next = nil
        var wasInProtectedFunc = false

CALL STACK:
    DoesNotUnderstandError:reportError
        arg this = <instance of DoesNotUnderstandError>
    Nil:handleError
        arg this = nil
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError
        arg this = <instance of Thread>
        arg error = <instance of DoesNotUnderstandError>
    Object:throw
        arg this = <instance of DoesNotUnderstandError>
    Function:protect
        arg this = <instance of Function>
        arg handler = <instance of Function>
        var result = <instance of DoesNotUnderstandError>
    Environment:use
        arg this = <instance of Event>
        arg function = <instance of Function>
        var result = nil
        var saveEnvir = <instance of Environment>
    DirtEvent:play
        arg this = <instance of DirtEvent>
    OSCFuncRecvPortMessageMatcher:value
        arg this = <instance of OSCFuncRecvPortMessageMatcher>
        arg msg = [*13]
        arg time = 21.41012336337
        arg addr = <instance of NetAddr>
        arg testRecvPort = 57120
    OSCMessageDispatcher:value
        arg this = <instance of OSCMessageDispatcher>
        arg msg = [*13]
        arg time = 21.41012336337
        arg addr = <instance of NetAddr>
        arg recvPort = 57120
    Main:recvOSCmessage
        arg this = <instance of Main>
        arg time = 21.41012336337
        arg replyAddr = <instance of NetAddr>
        arg recvPort = 57120
        arg msg = [*13]
^^ The preceding error dump is for ERROR: Message 'flop' not understood.
RECEIVER: nil
telephon commented 3 years ago

Ah that is strange, I've made an issue in supercollider:

https://github.com/supercollider/supercollider/issues/5468

In the meantime, I suppose we have to pass the parameters explicitly, as you did (but currently, DirtFreqScale doesn't take any!).

telephon commented 3 years ago

OK, try again.

But in general, don't set speedFreq: 1, just leave it out. You can then set it on an event basis from tidal (# speedFreq 1) or globally in sclang (~dirt.set(\speedFreq, 1).

ndr-brt commented 3 years ago

Ok, now that works, thanks!