Flash + scsynth

View: New views
10 Messages — Rating Filter:   Alert me  

Flash + scsynth

by Schell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I'm a Actionscript guy and I'm trying to hook up my swf to scsynth. I've established a connection to scsynth by starting it up with:

./scsynth -t 57120

Then I establish a socket connection using as3's binary socket class, but disconnecting is a different story. I can't just close the connection because it causes scsynth to panic, and I get this:

...
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
command FIFO full
FAILURE +nL Command not found
command FIFO full
FAILURE {5 Command not found
FAILURE {5 Command not found
FAILURE {5 Command not found
Broken pipe

I was just wondering if anyone has tackled this and could tell me what kind of messages I should be sending for a graceful disconnect, then I will learn more about sending some well formed OSC messages.

--
Schell Scivally
600 Santa Rosa Ave.
Santa Rosa, CA
95404
efsubenovex@...
http://blog.efnx.com
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by MDK-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Schell wrote:
> I was just wondering if anyone has tackled this and could tell me what
> kind of messages I should be sending for a graceful disconnect,

thats a good question.

im building an AS3 OSC library at the moment and I can connect to scsynth, but
when i call 'close' on my socket then i dont get any notification that its closed.

the connection stops working and i *dont* get all that command FIFO stuff you
get (maybe because im on windows?)

 > then I will learn more about sending some well formed OSC messages.

If you want to join forces i've setup an assembla space for the library here :

http://www.assembla.com/wiki/show/osclib

svn is here (read only until you are a project member)

http://svn2.assembla.com/svn/osclib/

Im developing this as part of a larger project to make some interesting UI
controllers in flash for SC (and Max/MSP, i still find SC quite confusing as im
just learning it now)

Here's a couple of early demos of the UI stuff im building :

http://relivethefuture.com/code/flash/BoxTest.swf

http://relivethefuture.com/code/flash/IKNodeTest.swf

--

I've written a page on the wiki to explain how FlexBuilder is setup and the
various dependencies.

http://www.assembla.com/wiki/show/osclib/Development_Setup

So if you're interested in working together feel free to drop me a mail off list.

btw, there is some basic SC test code in the osclib stuff which connects to the
server, reads the server status and can load and create a synth (hard coded to
'sine' at the moment).

thanks,

Martin
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by Stefan Nussbaumer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Schell schrieb:
> Hi, I'm a Actionscript guy and I'm trying to hook up my swf to scsynth. I've
> established a connection to scsynth by starting it up with:
>
> ./scsynth -t 57120
>  

you're trying to send osc commands from flash to sc, right? basically i
believe you should have a look at the server-command reference in the sc
helpfiles. commands have to be in compliance with the specified
namespaces i believe (e.g. "/s_new, "/n_free", "/quit etc.). i've no
idea about as3's osc capabilities but i believe there must be ways.
there's a nice little example documented for processing:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1133669730 
(http://tinyurl.com/ymfph4 ). not as3 though basic principles probably
apply to as3 as well ...

perhaps there are others, who know more than me ...

good luck, stefan

> Then I establish a socket connection using as3's binary socket class, but
> disconnecting is a different story. I can't just close the connection
> because it causes scsynth to panic, and I get this:
>
> ...
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> command FIFO full
> FAILURE +nL Command not found
> command FIFO full
> FAILURE {5 Command not found
> FAILURE {5 Command not found
> FAILURE {5 Command not found
> Broken pipe
>
> I was just wondering if anyone has tackled this and could tell me what kind
> of messages I should be sending for a graceful disconnect, then I will learn
> more about sending some well formed OSC messages.
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>  


--
=+=+=+=+=+=+=+=+=+=+=+=+=
Stefan Nussbaumer
Johnstrasse 18/2a
A-1150 Vienna
Austria
-------------------------
T:     +43 (0)1 956 20 35
M: +43 (0)699 11 33 41 79

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Parent Message unknown Re: Flash + scsynth

by Schell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If sclang can listen on tcp, is it possible to send arbitrary sc code to sclang [via binary socket], have sclang interpret it and send that to scsynth? It would be nice to be able to use the oop functionality of sc with a graphical representation of it in as3.

Martin - I don't know how much of a help I could be at this time, I just had one day off and decided to take an hour to learn a little about sockets in flash and SC, but I'd love to check out what you've done so far. As for scsyth barfing all that FIFO full stuff, I'm sure that if you installed cygwin [http://www.cygwin.com] and used the linux version of scsynth it would spew a bit for you too, haha. If I can help in any way, I will, but my plate is pretty full right now.



_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by Stefan Nussbaumer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Schell schrieb:
> If sclang can listen on tcp, is it possible to send arbitrary sc code to
> sclang [via binary socket], have sclang interpret it and send that to
> scsynth? It would be nice to be able to use the oop functionality of sc with
> a graphical representation of it in as3.
>  

hmm ... there has been a thread on sclang a few days - you maybe read
that. i wouldn't try to go the sclang way, rather use osc-commands that
go to scsynth directly. you can 'set' arguments of running synths or
create new synth-instances - whatever you need. you can have the full
power of sc sound-synthesis. i've only had a look at the processing-way
(a few additional libraries in processing are needed). for flash there
used to be something called "flosc" - no idea about that.

however, have a look at the server-command reference (name-spaces!),
look through other osc-related stuff in the helpfiles ...

i don't know about binary sockets (others on this list certainly know
better ..). anyway, flash has to be able to send osc to a given ip and
port (e.g. 127.0.0.1, 57110).


stefan
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by nonprivate :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

so how could this work in practice? would it be possible to compile the
synthdef files beforehand using the language, then somehow get these to
load into the plugin, then you would just send the OSC commands by some
method - java or something. it would be cool (or maybe even essential)
for the plugin to be able to load synthdefs from remote paths, not to
mention soundfiles and the like.

Stefan Nussbaumer wrote:

> Schell schrieb:
>  
>> If sclang can listen on tcp, is it possible to send arbitrary sc code to
>> sclang [via binary socket], have sclang interpret it and send that to
>> scsynth? It would be nice to be able to use the oop functionality of sc with
>> a graphical representation of it in as3.
>>  
>>    
>
> hmm ... there has been a thread on sclang a few days - you maybe read
> that. i wouldn't try to go the sclang way, rather use osc-commands that
> go to scsynth directly. you can 'set' arguments of running synths or
> create new synth-instances - whatever you need. you can have the full
> power of sc sound-synthesis. i've only had a look at the processing-way
> (a few additional libraries in processing are needed). for flash there
> used to be something called "flosc" - no idea about that.
>
> however, have a look at the server-command reference (name-spaces!),
> look through other osc-related stuff in the helpfiles ...
>
> i don't know about binary sockets (others on this list certainly know
> better ..). anyway, flash has to be able to send osc to a given ip and
> port (e.g. 127.0.0.1, 57110).
>
>
> stefan
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>
>  

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by Stefan Nussbaumer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

nonprivate schrieb:
> so how could this work in practice? would it be possible to compile the
> synthdef files beforehand using the language, then somehow get these to
> load into the plugin, then you would just send the OSC commands by some
> method - java or something. it would be cool (or maybe even essential)
> for the plugin to be able to load synthdefs from remote paths, not to
> mention soundfiles and the like.
>  

well, i still don't quite get what this thread is going to be about ...
i've only copied this little processing example, which does what i
believe Schell wants to do with flash.

in either case it's not meant without having loaded the synthdefs before
from regular sc. i wouldn't see an obstactle in having to send my
synthdefs beforehand from my local computer to a networked scsynth ...
as scsynth keeps working you go to sleep ;)

2c, stefan

> Stefan Nussbaumer wrote:
>  
>> Schell schrieb:
>>  
>>    
>>> If sclang can listen on tcp, is it possible to send arbitrary sc code to
>>> sclang [via binary socket], have sclang interpret it and send that to
>>> scsynth? It would be nice to be able to use the oop functionality of sc with
>>> a graphical representation of it in as3.
>>>  
>>>    
>>>      
>> hmm ... there has been a thread on sclang a few days - you maybe read
>> that. i wouldn't try to go the sclang way, rather use osc-commands that
>> go to scsynth directly. you can 'set' arguments of running synths or
>> create new synth-instances - whatever you need. you can have the full
>> power of sc sound-synthesis. i've only had a look at the processing-way
>> (a few additional libraries in processing are needed). for flash there
>> used to be something called "flosc" - no idea about that.
>>
>> however, have a look at the server-command reference (name-spaces!),
>> look through other osc-related stuff in the helpfiles ...
>>
>> i don't know about binary sockets (others on this list certainly know
>> better ..). anyway, flash has to be able to send osc to a given ip and
>> port (e.g. 127.0.0.1, 57110).
>>
>>
>> stefan
>> _______________________________________________
>> sc-users mailing list
>> sc-users@...
>> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>>
>>  
>>    
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>
>  


--
=+=+=+=+=+=+=+=+=+=+=+=+=
Stefan Nussbaumer
Johnstrasse 18/2a
A-1150 Vienna
Austria
-------------------------
T:     +43 (0)1 956 20 35
M: +43 (0)699 11 33 41 79

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by MDK-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Stefan Nussbaumer wrote:

> nonprivate schrieb:
>> so how could this work in practice? would it be possible to compile the
>> synthdef files beforehand using the language, then somehow get these to
>> load into the plugin, then you would just send the OSC commands by some
>> method - java or something. it would be cool (or maybe even essential)
>> for the plugin to be able to load synthdefs from remote paths, not to
>> mention soundfiles and the like.
>>  
>
> well, i still don't quite get what this thread is going to be about ...

im not sure either :)

is he talking about the SC browser plugin?

> i've only copied this little processing example, which does what i
> believe Schell wants to do with flash.

I think schell just wanted to get flash communicating directly with SC.

Because you can use a 'binary http socket' in flash you can connect it directly
to scsynth, whereas before you needed something like flosc to act as the middleman.

That opens up a lot of different possibilities depending on what people want to
achieve.

The flash app doesnt have to run in the browser it can run on the machine like
any other app and just be like another SC client.

but, there might be a way in the browser to get both the flash plugin and the SC
plugin talking to each other, which would be quite interesting.

Or, you could have a flash app in the browser talking to a normal scsynth
instance (although this would need some extra work to implement the security
requirements for the flash player so it can connect to a local socket..)

Then there was another idea which i think was hinting at something like this :
instead of using the editor part of sclang, make sclang a 'compiler service'
which listens on a particular socket to which you can send source code. Then
sclang could either send the compiled synthdef back to the originator (i.e.
flash) or could send it directly to scsynth. Then the flash application can
instantiate synthdefs on the server however it likes.
You could imagine having a visual tool much like the standard visual flow graph
of PD / Max etc, but you could show code nodes directly in the structure and
edit them 'live' (which i guess is similar in some ways to the code module
inside synthmaker)

of course you could build synthdefs directly in flash and send them straight to
scsynth, but if the sc language is there (and its a very well thought out way of
managing the server then why not take advantage of that), just treat it as
another means of representation. :)


martin.
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: Flash + scsynth

by Stefan Nussbaumer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

MDK schrieb:
> ...
>> well, i still don't quite get what this thread is going to be about ...
>>    
>
> im not sure either :)
>
> is he talking about the SC browser plugin?
>  
mmh ... looks like it might become complex ...

>  
>> i've only copied this little processing example, which does what i
>> believe Schell wants to do with flash.
>>    
>
> I think schell just wanted to get flash communicating directly with SC.
>
> Because you can use a 'binary http socket' in flash you can connect it directly
> to scsynth, whereas before you needed something like flosc to act as the middleman.
>  

right, that's the point. so the binary http socket is basically capable
of sending osc commands to sc. these commands need to be in compliance
with the namespaces for osc commands defined in sc.

> That opens up a lot of different possibilities depending on what people want to
> achieve.
>
> The flash app doesnt have to run in the browser it can run on the machine like
> any other app and just be like another SC client.
>
> but, there might be a way in the browser to get both the flash plugin and the SC
> plugin talking to each other, which would be quite interesting.
>
> Or, you could have a flash app in the browser talking to a normal scsynth
> instance (although this would need some extra work to implement the security
> requirements for the flash player so it can connect to a local socket..)
>
> Then there was another idea which i think was hinting at something like this :
> instead of using the editor part of sclang, make sclang a 'compiler service'
> which listens on a particular socket to which you can send source code.
yes, i understand - i'm not sure but i vaguely having seen some
demonstration done with haskell - i guess there would be a way to do it
but that certainly goes beyond _my_ capabilities ...

> Then
> sclang could either send the compiled synthdef back to the originator (i.e.
> flash) or could send it directly to scsynth. Then the flash application can
> instantiate synthdefs on the server however it likes.
> You could imagine having a visual tool much like the standard visual flow graph
> of PD / Max etc, but you could show code nodes directly in the structure and
> edit them 'live' (which i guess is similar in some ways to the code module
> inside synthmaker)
>
> of course you could build synthdefs directly in flash and send them straight to
> scsynth, but if the sc language is there (and its a very well thought out way of
> managing the server then why not take advantage of that), just treat it as
> another means of representation. :)
>  

well ... basically: a webbrowser is an application. supercollider is an
application. doing a flash standalone creates an application ... i'm
currently working on an sc application, that communicates nicely to the
net on my local machine. i can think of various other options e.g.
streaming sound directly from my local machine on request from the
internet.
sure that all involves latency which you can only avoid (...) if you
have the sound-synthesis on your machine - controlled from whereever,
remote or local.  a browser plugin would only transfer synthesis from
your local sc to the plugin which runs in a bloatet webbrowser (...) ...
sure one has to download supercollider where you would have to install
your browserplugin.

don't know - guess i'll always prefer the supercollider way ...

... but that's really only 1c

stefan
>
> martin.
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>
>  


--
=+=+=+=+=+=+=+=+=+=+=+=+=
Stefan Nussbaumer
Johnstrasse 18/2a
A-1150 Vienna
Austria
-------------------------
T:     +43 (0)1 956 20 35
M: +43 (0)699 11 33 41 79

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Parent Message unknown Re: Flash + scsynth

by Schell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> sclang could either send the compiled synthdef back to the originator (i.e.
> flash) or could send it directly to scsynth. Then the flash application can
> instantiate synthdefs on the server however it likes.
> You could imagine having a visual tool much like the standard visual flow graph
> of PD / Max etc, but you could show code nodes directly in the structure and
> edit them 'live' (which i guess is similar in some ways to the code module
> inside synthmaker)
>
> of course you could build synthdefs directly in flash and send them straight to
> scsynth, but if the sc language is there (and its a very well thought out way of
> managing the server then why not take advantage of that), just treat it as
> another means of representation. :)

Yes Martin, that's pretty much exactly what I was thinking. I'd like to have Flash sending arbitrary SC code to sclang through http, which acts as a compiling service to scsynth. scsynth could then send info back through sclang or direct to Flash if needed. This could open up lots of possibilities for visual programming like Max and performance options like interpreting key strokes as live control commands. If we can get info out of scsynth [like instantaneous control bus values] then we can use that for visualization in Flash, which AS3 is great for. I'd like to eventually have a composition/performance solution that includes graphics and sound so I could do stuff like this live -> http://www.efnx.com/clients/AudioFriend

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users