-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Vivid to work with Tidal and SuperDirt #3
Comments
There are two issues:
The panning is another thing, but let's see if that works for you. |
For this:
I get If I do
And then |
ok, I don't know how vivid works: all you need is a synth that has a control name called If |
@telephon can you point to where @jarmitage to solve the first half of the problem (making defineSD $ sdNamed "foooo" (0 ::I "out") $ do
s <- sinOsc (freq_ 440)
out (V::V "out") [s, s] |
It's in |
@telephon I'm very close to getting this working but still hitting an issue. My Server.supernova;
s.options.numBuffers = 1024 * 16;
s.waitForBoot{
Routine{
include("Vowel");
include("SuperDirt");
2.wait;
~dirt = SuperDirt.start;
5.wait;
postln(~dirt.soundLibrary);
// This seems to work!:
~dirt.soundLibrary.addSynth(\foo4);
}.play
} (I then boot with I then open d1 $ sound "~ bd"
:set -XDataKinds
import Vivid
-- This is just on one line so we can easily eval it:
let s' = sdNamed "foo4" (0::I "out") $ do { s <- sinOsc (freq_ 440) ~* percGen none ~* 0.1 ; out (V::V "out") [s,s] } :: SynthDef '["out"]
defineSD s'
-- Neither of these lines work:
d2 $ s "foo4"
d2 $ sound "foo4" The SynthDef is defined properly: I can open The complete error SuperDirt gives is:
|
It at least appears that If I add this to the end of the SynthDef(\foo4, {|out=0|
Out.ar(out, DC.ar(0))
}).add; (I.e. I add a totally empty ...and then I run all the stuff above, things work as expected (I'm able to re-define the SynthDef in Haskell to my heart's content). So @jarmitage here's your answer for now, although I'd love to know (cc @telephon @yaxu ) if there's a way to do this more cleanly. |
PS: by "at the end of the
|
Yes, we currently assume that your SynthDef is registered in the SynthDescLibrary, so that we know which arguments it takes. What you can do is just modify your default sound module. You can even do this on the fly and play around with it. Please note that you may need the (
var argNames = [\out];
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
if(~instrument.isNil) {
"instrument not found: %".format(~sound).postln
} {
// here, we just derive the arguments as necessary from the environment
dirtEvent.sendSynth(~instrument, argNames)
}
}
}
});
) Much better is this, I'll also add this to superdirt. I haven't tested this, so let us know if it works. (
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
if(~instrument.isNil) {
"instrument not found: %".format(~sound).postln
} {
// here, we just derive the arguments as necessary from the environment
dirtEvent.sendSynth(~instrument, ~argNames)
}
}
}
});
)
// then add your synth arguments for each synth separately:
~dirt.soundLibrary.addEvent(\foo4, (argNames: [\out])); |
@telephon I tried those two code snippets (on the |
Can you describe? Did they post any error message? Have you tried adding a |
Thanks @vivid-synth I'm going to try the workaround and will post any results here... |
My SynthDef(\foo4, {|out=0|
Out.ar(out, DC.ar(0))
}).add;
~dirt.soundLibrary.addSynth(\foo4); After SuperDirt had launched, and got: ERROR: tried to add Nil to synth event library
CALL STACK:
Exception:reportError 0x118e11058
arg this = <instance of Error>
Nil:handleError 0x118e11688
arg this = nil
arg error = <instance of Error>
Thread:handleError 0x118e11528
arg this = <instance of Thread>
arg error = <instance of Error>
Object:throw 0x118e11898
arg this = <instance of Error>
DirtSoundLibrary:addSynth 0x1189cd5f8
arg this = <instance of DirtSoundLibrary>
arg name = 'foo4'
arg event = nil
arg appendToExisting = true
Interpreter:interpretPrintCmdLine 0x1189cb978
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "~dirt.soundLibrary.addSynth(..."
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine 0x118e11e18
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: tried to add Nil to synth event library I'm on the SuperDirt 1.0-dev branch. |
maybe you could instead try the code I suggested above? |
@telephon when I run your 2nd snippet above, the ERROR: Message 'addEvent' not understood.
RECEIVER:
Instance of DirtSoundLibrary { (0x1132810e8, gc=F8, fmt=00, flg=00, set=03)
instance variables [7]
server : instance of Server (0x110818278, size=32, set=5)
numChannels : Integer 2
buffers : instance of IdentityDictionary (0x1107dc848, size=5, set=3)
bufferEvents : instance of IdentityDictionary (0x11327c1d8, size=5, set=3)
synthEvents : instance of IdentityDictionary (0x11327cc28, size=5, set=3)
fileExtensions : instance of Array (0x11147b840, size=4, set=2)
verbose : false
}
ARGS:
Symbol 'foo4'
Instance of Event { (0x11805c888, gc=F4, fmt=00, flg=00, set=03)
instance variables [5]
array : instance of Array (0x1139ae7a8, size=4, set=2)
size : Integer 1
proto : nil
parent : nil
know : true
}
CALL STACK:
DoesNotUnderstandError:reportError 0x11805bd88
arg this = <instance of DoesNotUnderstandError>
Nil:handleError 0x11805b968
arg this = nil
arg error = <instance of DoesNotUnderstandError>
Thread:handleError 0x11805c048
arg this = <instance of Thread>
arg error = <instance of DoesNotUnderstandError>
Object:throw 0x11805bac8
arg this = <instance of DoesNotUnderstandError>
Object:doesNotUnderstand 0x11805e098
arg this = <instance of DirtSoundLibrary>
arg selector = 'addEvent'
arg args = [*2]
Interpreter:interpretPrintCmdLine 0x117474ac8
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "~dirt.soundLibrary.addEvent(..."
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine 0x11805ce08
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Message 'addEvent' not understood.
RECEIVER: a DirtSoundLibrary |
@telephone did you mean to write I tried this below now, no errors but I got (
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
if(~instrument.isNil) {
"instrument not found: %".format(~sound).postln
} {
// here, we just derive the arguments as necessary from the environment
dirtEvent.sendSynth(~instrument, ~argNames)
}
}
}
});
)
SynthDef(\foo4, {|out=0|
Out.ar(out, DC.ar(0))
}).add;
~dirt.soundLibrary.addSynth(\foo4, (argNames: [\out])); If I change this to the below, I get (
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
dirtEvent.sendSynth(~instrument, ~argNames)
}
}
});
)
SynthDef(\foo4, {|out=0|
Out.ar(out, DC.ar(0))
}).add;
~dirt.soundLibrary.addSynth(\foo4, (argNames: [\out])); I get (
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
// if(~instrument.isNil) {
// "instrument not found: %".format(~sound).postln
// } {
// here, we just derive the arguments as necessary from the environment
dirtEvent.sendSynth(~instrument, ~argNames)
// }
}
}
});
)
SynthDef(\foo4, {|out=0, freq=440|
Out.ar(out, DC.ar(0))
}).add;
~dirt.soundLibrary.addSynth(\foo4, (argNames: [\out, \freq])); |
If I change my (
s.options.numBuffers = 1024 * 32;
s.options.memSize = 8192 * 64;
s.options.maxNodes = 1024 * 32;
s.options.numOutputBusChannels = 16;
s.options.numInputBusChannels = 2;
s.options.device = "SuperCollider";
s.waitForBoot {
Routine{
include("Vowel");
include("SuperDirt");
2.wait;
~dirt = SuperDirt(2,s);
~dirt.start(57120, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
SynthDef(\foo4, {|out=0, freq=440|
Out.ar(out, DC.ar(0))
}).add;
~dirt.soundLibrary.addSynth(\foo4, (argNames: [\out, \freq]));
}.play
}
) |
Usually when you use a wrong synth/sample name in SuperDirt you get the message no synth or sample named 'blahblahblah' could be found.
instrument not found: nil But in this case it's just |
|
So the corrected code, to be added to the startup file after the (
~dirt.addModule('sound',
{ |dirtEvent|
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
if(~instrument.isNil) {
"instrument not found: %".format(~sound).postln
} {
// here, we just derive the arguments as necessary from the environment
dirtEvent.sendSynth(~instrument, ~argNames)
}
}
}
});
);
// dummy synth def, this is just for now, until you have a synthdef in vivid.
SynthDef(\foo4, {|out=0| }).send(s);
// add your synth arguments for each synth separately:
~dirt.soundLibrary.addSynth(\foo4, (instrument: \foo4, argNames: [\out])); untested, let me know how it goes … |
Ok, so @telephon that seems to work, i.e I can add a synth from Vivid without using This might be because I don't know what I'm doing with Vivid. @vivid-synth do you have some more example Vivid code to try? Output from SC post window after running the block and SuperDirt: listening to Tidal on port 57120
-> a SuperDirt
-> a DirtSoundLibrary
[ "/d_recv", DATA[414], DATA[16] ]
[ "#bundle", 15980408986180207021,
[ 12, 1003, 1 ],
[ 15, 1003, "delayAmp", 0, "lock", 0, "cps", 1 ],
[ 12, 1002, 1 ],
[ 15, 1002, "dry", 0 ],
[ "/g_new", 1064, 1, 2 ],
[ "/s_new", "foo4", -1, 1, 1064, "out" ],
[ "/s_new", "dirt_gate2", -1, 1, 1064, "in", 18, "out", 20, "amp", 0.4, "sample", 0, "sustain", 0.999, "fadeInTime", 0, "fadeTime", 0.001 ]
]
[ "#bundle", 15980408990475178535,
[ 12, 1003, 1 ],
[ 12, 1002, 1 ],
[ "/g_new", 1065, 1, 2 ],
[ "/s_new", "foo4", -1, 1, 1065, "out" ],
[ "/s_new", "dirt_gate2", -1, 1, 1065, "in", 18, "out", 20, "amp", 0.4, "sample", 0, "sustain", 0.999, "fadeInTime", 0, "fadeTime", 0.001 ]
] |
Maybe you have to add the |
Currently I am testing with ~dirt.soundLibrary.addSynth(\foo4, (instrument: \foo4, argNames: [\out, \freq, \note])); And :set -XDataKinds
import Vivid
let s' = sdNamed "foo4" (0::I "out") $ do { s <- sinOsc (freq_ 440) ~* percGen none ~* 0.1 ; out (V::V "out") [s,s] } :: SynthDef '["out"]
defineSD s'
d2 $ s "foo4" # note "1" # freq "440" But I just get clicks |
With the new code, I'm able to repro the just clicks/no music behavior (yay!) -- I'll try and identify the difference between it and my working code. The error I get is:
Which I bet is the supernova equivalent of @jarmitage 's
|
Ok, new error:
if I use the synthdef: s' :: SynthDef '["out", "freq"]
s' = sdNamed "foo4" (0::I "out", 440::I "freq") $ do
env <- percGen none ~* 0.5
s <- sinOsc (freq_ (V::V "freq")) ~* env
out (V::V "out") [s,s] (which, note, has and I add SynthDef(\foo4, {|out=0,freq=440| }).send(s);
~dirt.soundLibrary.addSynth(\foo4, (instrument: \foo4, argNames: [\out, \freq])); |
@telephon this is what I'm seeing:
The first It also seems not to have any of the arguments I'm sending. E.g. here's the line I'm using to call it: d2 $ s "foo4*8 " # note "[1 3 2 5]*2 " # gain "1.2 0.8" |
@vivid-synth I just retested with the below setup and got the same clicks, no errors SynthDef(\foo4, {|out=0,freq=440| }).send(s);
~dirt.soundLibrary.addSynth(\foo4, (instrument: \foo4, argNames: [\out, \freq])); :set -XDataKinds
import Vivid
s' :: SynthDef '["out", "freq"]
s' = sdNamed "foo4" (0::I "out", 440::I "freq") $ do
env <- percGen none ~* 0.5
s <- sinOsc (freq_ (V::V "freq")) ~* env
out (V::V "out") [s,s]
defineSD s'
d1 $ s "foo4*8 " # note "[1 3 2 5]*2 " # gain "1.2 0.8" |
@jarmitage does your |
(Oops, forgot to mention: to get the full OSC message you need to boot with |
Here's the full output with
|
@telephon looks like the same problem I saw. Is this a problem with the |
That is wrong. OK, I see (sorry, I don't currently have a tidal that works so I can't test). You could try this next: (
~dirt.addModule('sound',
{ |dirtEvent|
var args;
if(~diversion.value.isNil) {
if(~buffer.notNil) {
// argumets could be omitted using getMsgFunc, but for making it easier to understand, we write them out
dirtEvent.sendSynth(~instrument, [
bufnum: ~buffer,
sustain: ~sustain,
speed: ~speed,
endSpeed: ~endSpeed,
begin: ~begin,
end: ~end,
loop: ~loop,
pan: ~pan,
out: ~out
])
} {
if(~instrument.isNil) {
"instrument not found: %".format(~sound).postln
} {
// here, we just derive the arguments as necessary from the environment
if(~argNames.notNil) {
args = currentEnvironment.getPairs(~argNames);
};
dirtEvent.sendSynth(~instrument, args)
}
}
}
});
);
// dummy synth def, this is just for now, until you have a synthdef in vivid.
SynthDef(\foo4, {|out=0| }).send(s);
// add your synth arguments for each synth separately:
~dirt.soundLibrary.addSynth(\foo4, (instrument: \foo4, argNames: [\out])); |
@telephon still just clicking sounds Example:
|
@jarmitage this is not the right solution long-term (and @telephon can I help in some way digging into this?) but - for the time being: simplest seems to be best. This works for me: boot.scd: Server.supernova;
s.options.numBuffers = 1024 * 16;
s.waitForBoot{
Routine{
include("Vowel");
include("SuperDirt");
// In other words, we define all the SynthDefs, with their args, *before* calling SuperDirt.start:
SynthDef(\foo4, {|out=0, freq=440|
Out.ar(out, DC.ar(0))
}).add; // .send might(?) be better here but I don't want to mess with what works
SuperDirt.start;
}.play
} foo.tidal: :set -XDataKinds
import Vivid
-- Use C-c C-e in emacs to eval the whole definition:
s' :: SynthDef '["out", "freq"]
s' = sdNamed "foo4" (0::I "out", 440::I "freq") $ do
env <- percGen none ~* 0.5
s <- sinOsc (freq_ (V::V "freq")) ~* env
out (V::V "out") [s,s]
defineSD $ s'
d2 $ s "foo4*8 " # note "[1 3 2 5]*2 " # gain "1.2 0.8" |
@vivid-synth yes that works - you don't need to add the synth before Thanks both for looking into this. I can just define |
yes, that's also a good way.
No, you need. A safer alternative might be to load the SynthDesc from the file you generate in vivid:
|
I tried to get Vivid and Tidal + SuperDirt working together based on this post:
http://lurk.org/groups/haskell-art/messages/topic/46bqOK1iOsiMy0fgOWMZa4
But it's not recognised by SuperDirt:
Most SuperDirt synths have this kind of format:
So maybe it's the difference in output destination that's causing the issue?
Would love to get this to work! Thanks for making Vivid.
The text was updated successfully, but these errors were encountered: