Closed jwaldmann closed 2 years ago
ah, is this https://github.com/musikinformatik/SuperDirt/issues/231#issue-804752898 ?
I still don't get it. I put this extra line (loadRelative ...)
) in startup.scd:
(
s.reboot {
...
s.waitForBoot {
~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
loadRelative("../../software/music/SuperDirt/hacks/adding-a-compressor.scd");
...
then when starting sclang
, I get
...
loading synthdefs in /home/waldmann/.local/share/SuperCollider/downloaded-quarks/SuperDirt/classes/../synths/zzzzz-core-modules-that-come-last.scd
ERROR: syntax error, unexpected '(', expecting $end
in interpreted text
line 19 char 1:
(
^
SynthDef("dirt_compressor" ++ ~dirt.numChannels, { |dryBus, effectBus, gate = 1|
-----------------------------------
ERROR: Command line parse failed
loading 217 sample banks:
...
Hi @jwaldmann, it is confusing, yes. I've added a bit of documentation (#260), please let me know if it is clearer and works for you …
Thanks! I was still getting the above syntax error. The file I wanted to include https://github.com/musikinformatik/SuperDirt/blob/develop/hacks/adding-a-compressor.scd has this structure
( ~dirt.orbits.do { ... }; )
( SynthDef ... )
( SynthDef ... )
( SynthDef ... )
The error message refers to the beginning of the second block. Are we just missing separators here? Adding semi-colons makes it work:
( ~dirt.orbits.do { ... }; ) ;
( SynthDef ... ) ;
( SynthDef ... ) ;
( SynthDef ... )
Well, "work" - at least it gives no syntax errors, so we can start thinking about semantics ...
The main thing is that the file (like all other files in the folder) are not meant to be used that way. It is not like a module system. I decided to use this "extension by example" style to encourage a more active involvement with the code. It is also a common way supercollider is organised: files which have many snippets of code that you can use, but not intended to be used all at once. This allows you to vary it in place, by writing series of minor modifications. It is more tedious out of the box, but more flexible to experiment with.
If you wanted to have a file you can load, you'd copy the variant you prefer in a file like this:
(
// add a compressor module
(
~dirt.orbits.do { |x|
x.globalEffects = [
GlobalDirtEffect(\dirt_delay, [\delaytime, \delayfeedback, \delaySend, \delayAmp, \lock, \cps]),
GlobalDirtEffect(\dirt_reverb, [\size, \room, \dry]),
GlobalDirtEffect(\dirt_leslie, [\leslie, \lrate, \lsize]),
GlobalDirtEffect(\dirt_rms, [\rmsReplyRate, \rmsPeakLag]).alwaysRun_(true),
GlobalDirtEffect(\dirt_monitor, [\limitertype]).alwaysRun_(true),
]
};
);
// now play with different variants while you listen to tidal:
// a dirty hyperbolic tangens
(
SynthDef("dirt_compressor" ++ ~dirt.numChannels, { |dryBus, effectBus, gate = 1|
var signal = In.ar(dryBus, ~dirt.numChannels);
signal = (signal * 5).tanh;
signal = signal * EnvGen.kr(Env.asr, gate, doneAction:2);
Out.ar(effectBus, signal);
}, [\ir, \ir]).add;
s.freeAll; // restart all synths
)
)
( ~dirt.orbits.do { ... }; ) ; ( SynthDef ... ) ; ( SynthDef ... ) ; ( SynthDef ... )
the syntax correction is correct, but the SynthDefs override each other (they all have the same name).
The main thing is that the file (like all other files in the folder) are not meant to be used that way. It is not like a module system. I decided to use this "extension by example" style ...
Yes, I see now. Perhaps make this intended usage more explicit in the README of that directory? Something like:
Thanks! Better now? https://github.com/musikinformatik/SuperDirt/pull/260/files
Yes, fine! - This issue was actually brought up by students (they wanted side chain compression for Tidal). I will point them to these improved instructions, and I'll forward any remaining complaints :-)
Yes, thanks, that would be good :) It is hard for me to un-understand these things.
please feel free to reopen this issue with suggestions.
It's recommended at https://github.com/musikinformatik/SuperDirt/blob/develop/hacks/README.scd but I don't see what to write where.
I am using this startup file https://github.com/musikinformatik/SuperDirt/blob/develop/superdirt_startup.scd
Do I put some "include" directive there? Or do I literally copy the code? In both cases- where? (before, inside, or after other declarations/statements?)