Homework #2 |
October 24th, 2022
Music 256A / CS476a, Stanford University
(If the images aren't loading properly they can be found here or you can right click and open them in a new tab)
Visualizer in action + Narrative
Click and drag to move the camera (same in first person and orbiting mode)
Press [F] to toggle between orbiting mode and first person mode
Press [N] to start the narrative
Production Build - Windows
If the cleaned Project won't open in editor try the Full Project
My core idea for this project was to have the waveform be the mouth of something . I had a lot of different ideas floating around regarding what I wanted to do, and you can see that process below by looking at the previous milestones. The idea evolved a lot around what I realized I could and couldn't do in the time allotted. My first ideas were super limited in scope, mostly because I had just seen sndpeek and the plane example, so I didn't realize just how much I could diverge from these ideas. After seeing the compilation of last year's projects I realized I wanted to make my project feel more interactive and immersive, like the user is a part of the visualizer, not just observing it. My first idea after this was kinda off the walls, I wanted to make a massive space station that the user could walk around, a fully interactive level, and the ai would be visible on various monitors, and one could see the spectrums out the window. I have a project with a similar level of interaction so porting that code wouldn't have been very complex, but I ultimately decided against it because I realized I was just trying to make a game with an audio visualizer sort of tacked on. I instead decided on a small spaceshiip, where you were stuck in the pilot's chair, I added a second empty chair to sort of add onto the solitude. After messing with this I was happy with the experience, you still had the agency to choose what part of the spectrum you were seeing, and how much attention you were going to pay to the waveform, but you also can't really avoid the audio visualizer.
The first roadblock I encountered was how to make a good circle, I really wanted it to be backed somehow by math, so that I could easily mess with the cube attributes without needing a lot of magic numbers. I also didn't see the circle tutorial on the discord which certainly didn't help. I ended up using polar coordinates (which I never expected would be practically useful when I learned them) which worked super well. Trying to scale the rotated cubes so that they extended out of the circle was also impossible (no amount of linear algebra saved me there) so instead every frame the cubes rotate back to the upright position, scale, and rotate back before the graphics are drawn. It was definitley a hacky solution but hey, it worked.
The next roadblock was trying to make a cool spaceship, I called it a bus for the first milestone because of how blocky it was, and modelling out of Unity gameObjects was a real pain. After being kind of defeated by this I did a quick google to see if the one CAD software I know how to use (TinkerCAD, it's made for young children) could export to Unity and lo-and behold it could. This let me get much more specific with the ship modelling and the final product is very close to the mental image I first had when starting to model it out.
The one hardest part for me was the narrative. I am not a musically talented person (yet anyways); when I was 5 my piano quit because of how terrible I was. I do love game soundtracks though, especially older ones, where you can taste every bit of the sample rate. I had a broad idea, some major notes vibing when all of a sudden some minor notes rain on their parade and take over, with the narrative jarringly cutting out, shutting off the engines of the ship, and having the AI go quiet. Since I have no music theory background I decided to let the computer take the wheel and heavily used randomness to generate the sound (the narrative is a different experience every time). I encorporated the laser sounds from Terraria (one of my favorite games) in the background to break up the noise and that was kind of it. Partway through making this, miniAudicle crashed and the VM stopped working on my computer which was definitley a stressor, but despite only being able to test through Unity I was happy with the final result. It didn't quite live up to my initial vision for it (unlike the ship), but in the end, I'm proud of what I was able to put together narrative wise, it tells the story I wanted to tell.
Thanks to this Unity Forum Post for providing me with the code I used for the camera orbiting.
The laser sounds used in the chuck script are sampled from Terraria by Re-Logic
October 16th, 2022
In order to get the history to work I made some modifications to the spectrum class and turned them into a doubly linked list where each spectrum graph takes data from the previous, passing the information down until the last spectrum object. This wasn't the way we talked about doing it in class but it was much more intuitive to me to have the spectrums as objects I could independently manipulate and have the data be the only thing passed between them. The hardest part was definitley figuring out how to get the circles to work, I quickly realized polar coordinates would be my savior for placing them, but scaling proved to be very difficult. I did a bunch of linear algebra trying to figure out how I could potentially rotate the scaling vector but after like an hour and a half of trying to do that I decided to rotate the rectangle upright, scale it, then rotate it back all in one update call so that the rectangles look like they're just scaling outwards. The solution ended up being really simple, but it definitley took me a while to figure it out. Implementing the swap between first person and an orbiting camera was suprisingly easy as well, all it took was some slight modifications to the orbiting camera script I found on the unity forums.
All that's really left at this point is improving the model used for the bus and creating the narrative, feeling good about my progress.
(I just looked at the discord and realized there was a tutorial for circular audio whoops, definitley still very proud of myself for doing it from scratch though haha)
October 7th, 2022
This week I made my way through the Unity tutorials, here's some notes on each of them.
Roll a Ball
This tutorial definitley felt a bit slow at times, as someone who has used Unity extensively in the past, a lot of the tutorial was easy for me, and mostly covered things I already knew. Most of my Unity experience has been working on 2D software and UI though, so some of the 3D information learned was new and useful, put was relatively easy to grasp. Overall Roll a Ball got me back into the swing of Unity, and warmed me up for the second two tutorials.
Chunity with Roll a Ball
This tutorial was really cool. Chuck and Unity integrate in what I felt was precarious yet robust. What I mean by this is the integration is very simple, you simply include strings containing chuck code in your Unity C# files, and using the string.format method as a way to take in Unity variables is super cool, the reason I say precarious though is some of the weird hiccups like having to escape teh quotations or doubling the curly braces. The style of integration reminds me of a time when I needed an arduino to do two seperate things, but for whatever reason the arduino refused to. To solve that I used two arduino's and connected them with a single pin data cable so they could pass over information. To me this is similar to how chunity feels, it can do anything you'd want in a very simple and ueasy to understand way. The one part of Chunity I feel a bit less ready for is the usage of global variables to modify Chuck scripts and runtime. Callbakc functions in Unity have always been one of my weaker skills so I definitely wasn't trilled when those popped up haha. Overall, felt pretty good about this tutorial.
I'm not sure how I expected to represent the waveform and spectrum graphs but it definitley wasn't a bunch of tiny cubes next to each other. I found this tutorial really easy to follow, and (despite the "the_" variable naming scheme) I thought the code was super understandable, it never felt like I was just copying what the tutorial said. I feel pretty good about my understanding of all three tutorials, and am feeling good about the project overall.
2. My other idea is turning the audio vizualizer into a duel between two wizards, Willy the Waveform wizard and Sam the spectrum sorceror (names subject to change). Admittedly I'm not super sure how this world work, perhaps using the waveform as a spell and the spectrum as the terrain.