Let the audience vote how they want a piece to sound! Audience members will use their phones to point where they want a sound/instrument/channel to be spatialized in an ambisonics array. To do so, a piece must be exported so each sound/instrument is in a single channel of a multichannel WAVE file. Thereafter, a web server corresponds averaged gyroscope data from the phones to a Pure Data patch as it plays the piece.
- Python 3.5 or 2.7
- Node (for NPM, to get Bower)
- Pure Data vanilla
- Install bower:
npm install -g bower
- Install bower requirements:
bower install
- Create a virtualenv:
virtualenv env
& enter itenv\Scripts\activate
- Install Python requirements:
pip install -r requirements.txt
- Install Pure Data requirements (all available on deken):
- PuREST JSON - https://github.com/residuum/PuRestJson
- grambilib~ - https://github.com/rickygraham/grambilib
- cyclone - https://puredata.info/downloads/cyclone
- Export your project so each sound you want to independently control is a different channel in a multichannel WAVE file.
- Setup the Pd patch
pd-client/client.pd
(see Pure Data setup below) - Run the server with
python run.py
(make sure you're still in the virtualenv) - Assure your server and clients are all connected to the same network (or that your server has a public IP and proper port forwarding)
- Connect your clients to
http://<YOUR_IP>:5000/<project_name>/<num_channels>
- There will probably be KeyError messages in the server console. These are fine (see Known Problems)
- Configure audio output settings and enable DSP in Pure Data
- Hit the bang to start the file open in Pure Data - wait a few moments.
- Hit the toggle to start the file playing
- Tell your clients to pick a channel and point a direction. Woo! Democratic ambisonics!
- Input has only been tested with multichannel WAVE files, but in theory
[readsf~]
will accept other multichannel files - Set the directory to your multichannel WAVE at the top of the file
- Specify the number of channels as the first argument to
[readsf~]
- Set URL to listen for before
[rest]
in the format ofGET http://localhost:5000/<room_name>/<num_channels>/out
- For each channel:
- Connect a send to the output of
[readsf~]
in the form of[s~ c<CHANNEL NUM>]
.
NOTE: There should be (num channels) + 1 outputs on[readsf~]
as the last output will send a bang when the file is finished. Assure this last output is connected to[s done]
- At the bottom in the ENCODING section, create a
[r~ c<CHANNEL NUM>]
and[r m<CHANNEL NUM>]
that connects to a[grambipan~ 3]
of its own. - Route each output of the new
[grambipan~ 3]
to each of the[s~ e<1-7>]
at the bottom of the file.
- Connect a send to the output of
- Assign the output configuration in
[grambidec~]
, and the output channels in[dac~]
NOTE: There are surely better ways of implementing this in Pure Data. My Pure Data skills are not that refined.
- While clients are joining, sometimes the WebSocket processes get the wrong priority for modifying GYRO.
This is likely a result of a global resources shared by many processes.
This means votes might send to a room before it is created. If this happens, KeyError messages will appear in the console. After the room is created these will stop.
- Python: (see requirements.txt)
- Flask - http://flask.pocoo.org/
- SocketIO - https://flask-socketio.readthedocs.io/en/latest/
- eventlet (for SocketIO) - http://eventlet.net/
- JavaScript:
- SocketIO-client - https://github.com/socketio/socket.io-client
- Gyronorm.js (for gyroscope data) - https://github.com/dorukeker/gyronorm.js
- jQuery (for Gyronorm.js) - https://jquery.com/
- Pure Data:
- PuREST JSON - https://github.com/residuum/PuRestJson
- grambilib~ - https://github.com/rickygraham/grambilib
- cyclone - https://puredata.info/downloads/cyclone