Skip to content
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

sharing synth and using by superdirt #38

Closed
lisongx opened this issue Dec 26, 2016 · 4 comments
Closed

sharing synth and using by superdirt #38

lisongx opened this issue Dec 26, 2016 · 4 comments

Comments

@lisongx
Copy link

lisongx commented Dec 26, 2016

hi @telephon,

I'm having a little problem about sharing synth to used with superdirt, maybe you could give some guide on this

I'm using some custom server to sharing sc sytndef with my frined. We are using some like

SynthDef(\test, {
}).doSend(~hub)

and the hub forward msg to our client, and our client using s.listSendMsg(msg); to execute this, so we can both have the SynthDef test on both our machine.

But when we're using superdirt here, it seems not working. And we found it's trying to found syntndef from SynthDescLib, do you know any way to solve this somehow?

I think our client is getting the Int8Array here, not sure how to load that in SynthDescLib.

Again , thanks for hardwork on this!

@telephon
Copy link
Contributor

You are welcome!

Your analysis is correct: you need to register the SynthDef in the SynthDescLib (what normally happens when you call add).

A good solution is to use the Utopia network music library (https://github.com/muellmusik/Utopia):

Quarks.install("Utopia");

The documentation is still mostly absent. You could try the following setup (on both computers):

(
~win = Window("We share everything").front;
~win.layout = VLayout.new.add(~listView = ListView.new);

~addrBook = AddrBook.new;

// to get updates, just add a dependant
~addrBook.addDependant({|addrBook, what, who|
	{~listView.items = addrBook.peers.collectAs({|peer|
		peer.name ++ " | " ++ peer.addr.ip ++ " | " ++ if(peer.online, "online", "offline");
	}, Array)}.defer;
});

~addrBook.addMe; // will automatically add you using your user name
//~addrBook.addMe(\myNameOrWhatever); // or specify one

~hail = Hail(~addrBook);
~srelay = SynthDescRelay(~addrBook);
);

If that doesn't work, you could also hack something much simpler. But the above will give you a lot of useful things.

@lisongx
Copy link
Author

lisongx commented Jan 9, 2017

@telephon
Thanks so much for the great guide!

Actually we already some system orking here but kind of stuck at sharing synth, we have something like this client running on both of our sc

  OSCdef.newMatching(
    /d_recv,
    {|msg, time, addr, recvPort|
      msg.postln;
      s.listSendMsg(msg);
   })

and we just sync synth by Synth(\test, {}).doSend(~hub), where ~hub is a simple server that forward many osc here..

so for d_recv, we have this Int8Array of this synthdef we don't know how to add to the SynthDescLib

Not sure if I'm explain clear enough.

Will look at the Utopia source maybe that will help

@telephon
Copy link
Contributor

Yes, you can of course send the byte array to the scsynth, but your def is missing on the sclang side. There are many ways to send this info, but the best solution I think is in Utopia.

@lisongx
Copy link
Author

lisongx commented Jan 24, 2017

@telephon
I've figure a kind of a dirty way to achive this

      if (msg[0].asString=="/d_recv", {
        msg[1].size.postln;
        msg[1].postln;
        h = File("~/test.scsynthdef".absolutePath, "wb");
        h.write(msg[1]);
        h.close();
        SynthDescLib.global.read("~/test.scsynthdef".absolutePath);
      });

write to a file and then use SynthDescLib

I'll close the issue then. Thanks so much Julian!

@lisongx lisongx closed this as completed Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants