a project exploring the creation of chance music via user interaction
setup is based in 3 parts:
- app.js | the nodejs server app that handles all command communication
- client.html | a self-contained client that is used to connect to the server and send/receive commands
- sengine/index.html | the sound engine which actually plays sounds in a browser
To start chancer, first start the server app:
node app
Next open sEngine (sengine/index.html) in a browser [Chrome preferred]. You will get a message on the server app once sEngine successfully connects. As of now, sEngine only works when running on the same machine as the server app.
Finally, use the client (client.html) to connect to the server and begin sending commands! The gear icon in the top right allows you to set the IP of the server (use localhost if server is running locally) and will automatically attempt to connect. The gear icon will turn green if successfully connected.
Any # of clients can simultaneously connect to the server.
config.js | the server app config where you can change the listening ports and various other settings
chancer supports a command line interface. To send and receive commands, use the self-contained client (client.html).
For the following supported commands, assume x is a number associated with a particular sound. The association is random at each startup of sEngine.
The command line supports standard up/down arrow navigation through recently used commands.
/play x
play sound x 1 time
/stop x
stop sound x and reset its position
/pause x
pause sound x without changing its position
/loop x y
loop sound x, y times. If y is ommitted, loop infinitely.
/vol x y
change the volume of sound x to y, which much be a value between 0 and 100, with 0 being 0% and 100 being 100% volume.
/pan x y
change the panning of sound x to y, which much be a value between -50 and 50, with -50 being hard left, and 50 being hard right.
/filter x y
change the filter frequency of sound x to frequency y, which much be a value between 0 and 22000 (hz). Currently only 'lowpass' filter is supported.
#####node server app errors
command received from client, but sEngine is not connected
The server is receiving commands successfully from the client, but sEngine is not running. Simply open sengine/index.html in a browser window, and it will automatically connect to the server.
#####client errors
Server received your command [/play x] , but the sound id is invalid
Server received your command [/play -x] , but the sound id is invalid (must be positive number)
The server received the command as shown, but x is not a valid sound id.
x cannot be negative nor can it be a number higher than the manifest length -1. The manifest length is shown on the server at the moment sEngine connects to the server. It will say something like "SENGINE says manifest length = 9"
Not yet supported, but will be the next major feature.