ECE434 Project: Dancing Fish

Team members: Eliza Romeu, Melina Ferner, Kurtis VonBargen

Grading Template
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

 00 Executive Summary 00 Packaging 00 Installation Instructions 00 User Instructions 00 Highlights 00 Theory of Operation 00 Work Breakdown 00 Future Work/Conclusions 00 Hackster.io 00 Demo/Poster 00 Not Late

Score: 00/100 (not graded yet)

Executive Summary
This project is making a device using the Beaglebone which can stream any chosen audio. The music will come from a specified youtube video and will be played on a wired speaker. In order to make the music being played more interactive, the device will feature a fish that moves on beat with the music controlled by a servo. Additionally, we will have a sound-activated LED Music spectrum (on two different 8x8 LED Matrices) to reflect the different tones that are being played.

Attached is a picture of the final device:



Packaging
This project uses:
 * Beaglebone Black
 * Two 8x8 LED Matrices
 * RC Servo Motor
 * A wired Speaker or Headphones (We used this speaker)
 * Any cords needed to attach the speaker to a USB 2 port
 * Movable Fish and any materials needed to attach to the servo

Attached is a picture of the packaging that we made for the device:



Installation Instructions
To install the project, ssh into your Beaglebone and follow the instructions below:

1.) Clone this github repository

bone$ git clone https://github.com/rhit-vonbarke/ece434_BigFish

2.) Navigate to the project directory and run install.sh. This only needs to be run the first time that you are running the program as it installs all of the needed libraries.

bone$ bash install.sh

3.) Run setup.sh. This needs to be run every time after connecting to the bone before you want to run the program.

bone$ bash setup.sh

4.) Run the program (this needs to be rerun every time you want to play a new song). bone$

Once you've done the above three steps, you can proceed to the user instructions.

User Instructions
Once the program is running the terminal will prompt you for a Youtube video link. This will be the audio file the program uses so make sure it is entered incorrectly. After this the song should begin playing, the audio visualizer will start, and the fish will begin to dance. All the user needs to do at this point is sit back and enjoy the music.

After the song is finished, if the user wants to listen to a new song, all they have to do is rerun the main program and enter in another Youtube link to listen to.

Highlights
We've included a video demoing our project in action.

We've also included our hackster.io page.

Additionally, our project includes a lot of behind-the-scenes optimizations. The LED Matrix display is logarithmic so a very large range of frequencies can be displayed and the spectrum is more adaptable to different types of audio. Also even though the fish's movements might sometimes seem sporadic, its movements are based on the magnitude of the frequencies in the human speaking range. This means that the fish is able to more or less detect when a person is singing or talking and dance accordingly.

Theory of Operation
The user interacts with the computer terminal and selects a song from Youtube. A script handles the input and uses the YoutubeDL library to download a .wav file into the audio downloads folder. Once the file is downloaded, the script runs two processes in parallel: a python file for the audio processing and a script to play the music. Within the python script, we compute the Fourier transform of the audio with the help of various libraries. Once the Fourier transform is computed on periodic intervals of the audio, the python file calls two different interfaces: one to handle the LED Matrices output and the other for the servo motor output.



Work Breakdown
All three partners worked together on most of the major tasks but below is the breakdown of team members main focuses:

Melina

 * LED Matrix Interface
 * Servo Interface
 * Speaker Interface
 * Music playing to work with Audio Processing
 * Setup and Installation Files

Eliza

 * Speaker Interface
 * Documentation
 * Music playing to work with Audio Processing
 * Setup and Installation Files

Kurtis

 * Youtube-DL Setup
 * Fourier Transform Handling
 * Music playing to work with Audio Processing
 * Setup and Installation Files

Future Work
Some additional things that could be done with this project in the future:
 * Work to interface the program with streaming services other than Youtube (i.e. Spotify, Apple Music, Pandora, etc.)
 * Find ways to play music remotely, unfortunately, the beagle bone black doesn't support Bluetooth without extra handware but Flask or Blynk would be options
 * Add more capabilities related to playing the music like pausing, playing skipping, etc.
 * Display the cover of the music video on an LCD or any other device with a screen

Conclusions
Our initial goals for this project were loosely set since all of our inspiration came from a viral video of a singing fish. Over time, we realized that some project goals were simply unrealistic given equipment and time. However, our overall goal was to produce a device that plays music, makes a fish dance, and makes an LED matrix react to the music in real-time. We did successfully meet our goals, but there is still some room for improvement. As mentioned in the future work section, it would be really cool to interface the program with streaming services other than Youtube and work on our current timing delay issues.

Through the course of this project, we learned a lot about the Beagle Bone, Linux capabilities, and even how to redirect group work when something goes wrong. At one point during the project, we realized that the Beagle Bone Black does not have Bluetooth capabilities. At this point in time, it was too close to the deadline to buy new parts so we had to undergo a last-minute scramble trying to find cords that would allow for functionality with the speaker and had to scratch our entire plan of interfacing with the speaker. This taught us to be adaptable and how to work quickly when learning an unfamiliar library. One of the biggest areas of learning was contributing to an existing project - YoutubeDL. Since this library already controls a lot of the features for us we had to learn to work with the inputs we were given instead of having creative reign over the whole project. We also learned how to run processes in parallel in one terminal. After, getting the speaker to function we realized that it paused the whole terminal as the song was playing so we had to research how to run processes in parallel in order for our audio processor to function at the same time.