Discussion:
SC as Sound engine within Unity - making a game with SC
Eli Fieldsteel
2014-10-21 19:23:47 UTC
Permalink
All,

A student of mine is involved in a cross-disciplinary game design project
using the Unity 3D game engine. He submitted a post to the listserv, but it
was never accepted (I assume there was some technical bit of listserv
instructions he didn't quite follow). I'm posting his question below:

---

I'm a relatively new sc user, and I'm currently developing a game with the
Unity 3D game engine. My team and I hope to utilize sc as a source of sound
within the game engine, utilizing OSC messages. We're hoping to achieve a
few basic goals:
- boot sc (scsynth & sclang) within Unity - check
- initialize SynthDefs
- allocate buffers
- dynamically alter synths via OSC during gameplay

First, as we came to booting the server and language in unity, I began to
wonder - might anyone else know if any of sc's packages contents can be
omitted? We're hoping to minimize the size/number of any necessary files to
include in the Unity game build, and scraping down the size of supercollider
itself would largely reduce the audio asset's impact on file-size. We came
to the conclusion that both scsynth and sclang would be necessary for our
goals, to take advantage of the sc language, but some of the other files did
not seem entirely necessary.

Secondly, I was particularly curious about creating external SynthDef files
(to be loaded upon boot, I presume?). Or maybe each synthDef (and other bits
of code) ought to be referenced from one file? I don't particularly know
anything about external files containing code for synthDefs, but it seemed
that it might be useful in this situation. With buffers being processed via
GrainBuf (in synthDefs), I was particularly worried about lag time between
reading buffers & loading SynthDefs.

For example, at the beginning of a level, sc would ideally:
- load background audio files into buffers (Buffer.read("sound.wav"))
- then load synthDefs with processed buffers (SynthDef(\granular_synth,
{}).add)
- then finally play the background audio (~synth_routine.play)

tl;dr, are all of the files in sc's package contents required?
pt 2. external synthDef files - where might a beginner begin?

Thanks in advance, and sorry for the wall of text.
Rob



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SC-as-Sound-engine-within-Unity-making-a-game-with-SC-tp7614198.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Juan Gabriel Alzate Romero
2014-10-21 20:35:27 UTC
Permalink
Hi,
afaik you could use just scsynth and maybe precompile SynthDefs from
sclang. If you have to cread SynthDefs dynamically, then you would need
sclang, or another wrapper for that (I've seen there are some for different
languages, and Unity might support one of those). Otherwise, I think the
super McKinney twins had a C++ library for scsynth (I think thos one here:
https://github.com/ChadMcKinney/libscpp ) for embedding it into
applications internally.

I've heard from other people using UE4 and Unity with SC, but more for
testing and prototyping, don't know if they managed to pack it in the
binary though.

Cheers,
-Juan
Post by Eli Fieldsteel
All,
A student of mine is involved in a cross-disciplinary game design project
using the Unity 3D game engine. He submitted a post to the listserv, but it
was never accepted (I assume there was some technical bit of listserv
---
I'm a relatively new sc user, and I'm currently developing a game with the
Unity 3D game engine. My team and I hope to utilize sc as a source of sound
within the game engine, utilizing OSC messages. We're hoping to achieve a
- boot sc (scsynth & sclang) within Unity - check
- initialize SynthDefs
- allocate buffers
- dynamically alter synths via OSC during gameplay
First, as we came to booting the server and language in unity, I began to
wonder - might anyone else know if any of sc's packages contents can be
omitted? We're hoping to minimize the size/number of any necessary files to
include in the Unity game build, and scraping down the size of
supercollider
itself would largely reduce the audio asset's impact on file-size. We came
to the conclusion that both scsynth and sclang would be necessary for our
goals, to take advantage of the sc language, but some of the other files did
not seem entirely necessary.
Secondly, I was particularly curious about creating external SynthDef files
(to be loaded upon boot, I presume?). Or maybe each synthDef (and other bits
of code) ought to be referenced from one file? I don't particularly know
anything about external files containing code for synthDefs, but it seemed
that it might be useful in this situation. With buffers being processed via
GrainBuf (in synthDefs), I was particularly worried about lag time between
reading buffers & loading SynthDefs.
- load background audio files into buffers (Buffer.read("sound.wav"))
- then load synthDefs with processed buffers (SynthDef(\granular_synth,
{}).add)
- then finally play the background audio (~synth_routine.play)
tl;dr, are all of the files in sc's package contents required?
pt 2. external synthDef files - where might a beginner begin?
Thanks in advance, and sorry for the wall of text.
Rob
--
http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SC-as-Sound-engine-within-Unity-making-a-game-with-SC-tp7614198.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Loading...