This week I’ve been working mainly on the audio component of my project, which has been the most challenging part of this process and has definitely taken the most persistence to get through.
I started by collecting some field recordings along with my own guitar playing. I wanted to capture a warm, home-like atmosphere that further emphasized viewers to look inwards. Edited both audio files in Audacity, and they were good to go in my project!

The code was where it got challenging though. Understanding the audio functionality of p5.js was pretty simple, and getting my first track to play for the entirety of the code running was easy enough.

For this project however, I wanted the music I recorded to play as the user drew, thinking I could just add song.play to my mouseIsPressed function was a mistake. It was also a mistake to forget to save the draft project I was working through these problems on!

Stellar! So had to reapproach how I was going to get this to work (after catching up on the other work I had lost). I knew the issue was that the draw feature was repeatedly trying to start the audio track each time it looped its function, crashing the whole site. So I needed to figure out a way to get the code to do a couple more checks before deciding whether to play the track or not. So, enter the Boolean, which assumes music is not playing, checks if the mouse is pressed, plays only once, and stops if the mouse is not pressed. This took a lot of trial and error to finally wrap my brain around how Boolean functions work.

As per my comments instructions, now that the music played while the mouse was pressed, I wanted the audio to pan in relation to where the cusor moved across the screen. I was particularily interested in this feature as the audio is a major component to this piece, and I am planning on exhibiting it in AUArts’ 8 speaker media arts gallery. Again, doing this required me to understand another new p5.js function: mapping.


This took a lot of persistence. And too be fair, I still am not quite sure what I have done here to get it to work, but it does so I am happy! For a while I had everything right except having my variable drawline defined in a constrain, and the second I included that everything decided to work and I now had a line that played audio as the user drew, and that audio panned left and right with the curser!
Now I have essentially everything I want this program to do doing what it needs to, my final week on this should just be cleaning everything up and refining a couple other points.