[Csnd] websockets and interactive web-based csound
Date | 2014-05-22 23:31 |
From | Tarmo Johannes |
Subject | [Csnd] websockets and interactive web-based csound |
Attachments | fm-game.csd fm-game.html websocket-server.py |
Hi, I created an example to try out how it is possible to have interactive Csound session over internet. It uses Google Chrome pnacl technology for csound and websockets for communication. Go to address http://tarmo.uuu.ee/varia/failid/cs/nacl/fm-game.html to try it out. I attach the code of client (html), csd and server code (python). In this example "play" events are sent to all clients who are connected to the server at the same time. So the same sound is heard almost in the same time by all players - so you can have a worldwide musical communication already! :) It would be even more interesting to send also compileOrc messages or interchange channel values, but that's for future. Websockets is a new technoly that came with html5. It is basically a layer on top of TCP for bidirectioal communication but easier to use. Basically client (fm-game.html) connects to the ws-server on given address, loads Csound module and csd. Server takes care of the connections and sends all incoming "PLAY" events to all clients (expect sender) that evoke then the csound event also on their side. The websocket server is written in python using Tornado module http://www.tornadoweb.org/en/stable/ but there are implementations of websockets in most languages already (for example new Qt 5.3 includes a websocket library by default). The server sits in my home computer since I could not run it in the tarmo.uuu.ee server. I will keep it running for some days, but then I have to leave and I will switch out the computer. Please try it out, it can be fun! I believe there is a lot of potential in such solutions - if everybody has the same orchestra, it is SO much cheaper and faster to send just the data and commands that to stream audio... Please ask questions or comment if there is something vary vague! best! tarmo |
Date | 2014-05-23 09:31 |
From | jpff@cs.bath.ac.uk |
Subject | [Csnd] Re: |
Attachments | None |
Date | 2014-05-23 13:20 |
From | Tarmo Johannes |
Subject | [Csnd] Re: websockets and interactive web-based csound |
Hi, John let me know that there was some malware warning due to attachments of the previous mail and probably it was not forwardesd to many. here it is again, the attachments (fm-game.html, fm-game.csd and websocket- server.py are all up on: http://tarmo.uuu.ee/varia/failid/cs/nacl/ Thanks! tarmo --------------- On Friday 23 May 2014 01:31:28 Tarmo Johannes wrote: Hi, I created an example to try out how it is possible to have interactive Csound session over internet. It uses Google Chrome pnacl technology for csound and websockets for communication. Go to address http://tarmo.uuu.ee/varia/failid/cs/nacl/fm-game.html to try it out. I attach the code of client (html), csd and server code (python). In this example "play" events are sent to all clients who are connected to the server at the same time. So the same sound is heard almost in the same time by all players - so you can have a worldwide musical communication already! :) It would be even more interesting to send also compileOrc messages or interchange channel values, but that's for future. Websockets is a new technoly that came with html5. It is basically a layer on top of TCP for bidirectioal communication but easier to use. Basically client (fm-game.html) connects to the ws-server on given address, loads Csound module and csd. Server takes care of the connections and sends all incoming "PLAY" events to all clients (expect sender) that evoke then the csound event also on their side. The websocket server is written in python using Tornado module http://www.tornadoweb.org/en/stable/ but there are implementations of websockets in most languages already (for example new Qt 5.3 includes a websocket library by default). The server sits in my home computer since I could not run it in the tarmo.uuu.ee server. I will keep it running for some days, but then I have to leave and I will switch out the computer. Please try it out, it can be fun! I believe there is a lot of potential in such solutions - if everybody has the same orchestra, it is SO much cheaper and faster to send just the data and commands that to stream audio... Please ask questions or comment if there is something vary vague! best! tarmo |