Lucid Projects

Blog - Day to day mumblings...
Peer to Peer Music - kinda.

Peer to Peer Music - kinda.

20 Sep 2020 - Jake Sherwood

Peer to Peer Music - kinda Peer to Peer Music - kinda

Peer to Peer Music - kinda

The assignment was to create a peer to peer interaction.

My partner Doug had the idea to try to create and “instrument” with Tonejs.

I had done some stuff with p5sound but nothing with Tonejs.

I started researching and spent a lot of time here on the Tonejs Docs

It’s amazing how much you can do with this library. I just barely touched the surface.

I also did a good amount of searching for p5 examples of how others were using it.

I found a couple of examples by Ivy Meadows, that I used as starting points and I modified for my needs. Tone Player objects and Tone Synths

I also wanted some visuals and found this page with a bunch of different visualization examples.

This one measuring amplitude seemed really cool. It to a bit of work to modify it to work with Tonejs. It was previously just working with p5sound.

I spent quite a bit of time just getting a Tonejs sketch to work which I thought I had a pretty good spot. However, when I went to tie it into the PSP code I kept finding more and more bugs.

####### BUGS ########
1: only toggling on off once per touch
2: disallowing partner to turn on and off sounds but still be able to do it on your client
3: have to start oscillator for sounds to start?
4: playing synths reliably - its hard to start and stop them 
5: controlling partners state - commented out atm
6: Lisa's new webrtc_peer_client.js makes it so nothing works
#####################

So while I can play music and make some could sounds it is not the best user experience.

As is now the other user potentially can just turn of the sounds you just added and vice versa. It kind of turns into this amorphic game of music collaboration.

I also think I suffered a bit from feature creep here and probably added too many options.

##### CONTROLS ######
key presses toggle functions call on mouse touch
1: the Beat
2: the ass
3: Oscillator
4: backwards rGuitar
5: rain
6: throwaway sound
7: synthA
8: synthB
9: synthC
s: turns off touch function calls
o: changes oscillator mode
#####################

I test on a chromebook of mine and with my wife. The experience was fund but not exactly my initial goal

A video of me playing with two clients on my machine


Problems
1) Numerous bugs as mentioned above
2) Issues reliably using ngrok
3) Issues with Lisa’s update webrtc_peer_client
4) Weird behaviour with p5 editor version - sometimes it would show my mouse moving from the client but wouldn’t show me the canvas

Weird p5 editor behaviour


What I learned
1) Tonejs is cool. Still so much to explore
2) Making direct peer to peer connections opens up a lot of possibilities..
3) I had a little experience with ngrok and node/express before but this project helped me to further that knowledge

Final Thoughts
Even with a number of issues I still had fun with this project. I do feel like I still need to learn more about the server set up and what all that is doing.

Work in progress code here.

categories: body_ewah

join me on this crazy ride. enter your email:

contact [at] jakesherwood [dot] com

contact me if you'd like to work together