Difference between revisions of "ECE597 Project Music Visualizer"

From eLinux.org
Jump to: navigation, search
(Hardware)
m (to Fall 2014)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:ECE597 |Px]]
+
[[Category:ECE497Fall2014]]
 
{{YoderHead}}
 
{{YoderHead}}
  
Line 10: Line 10:
 
<pre style="color:red">
 
<pre style="color:red">
 
09 Executive Summary
 
09 Executive Summary
05 Installation Instructions  
+
09 Installation Instructions  
00 User Instructions
+
08 User Instructions
05 Highlights
+
09 Highlights
05 Theory of Operation
+
09 Theory of Operation
 
10 Work Breakdown
 
10 Work Breakdown
 
09 Future Work
 
09 Future Work
Line 19: Line 19:
 
10 Demo
 
10 Demo
 
10 Not Late
 
10 Not Late
Comments: Nice demo.  The wiki needs a little work. See comment below.
+
Comments: Nice demo.  Thanks for fixing up the wiki
  
Score:  73/100
+
Score:  93/100
 
</pre>
 
</pre>
  
Line 35: Line 35:
  
 
=== Hardware ===
 
=== Hardware ===
<pre style="color:red">
+
 
These are a bit lean.  You need more details. 
 
For example.  The display has three wires, where do I attach the other two?
 
Use Fritzing to create a wiring diagram.
 
</pre>
 
 
Connect 10x10 Neopixel LED matrix to P9_22 on Beaglebone, Black is GND, Red is VCC and White is DIN, the schematic is below:
 
Connect 10x10 Neopixel LED matrix to P9_22 on Beaglebone, Black is GND, Red is VCC and White is DIN, the schematic is below:
  
 +
[[File: Schem.jpg | 500px]]
 +
 +
Connect USB sound card to Beagle
  
Connect USB sound card to Beagle
+
The sound card we using is [http://us.creative.com/p/sound-blaster/sound-blaster-x-fi-go-pro CREATIVE SOUND BLASTER X-FI GO! PRO]
 +
The sound card driver is included in our git repo
  
 
[[File: Beagle-main.jpg | 200px ]]
 
[[File: Beagle-main.jpg | 200px ]]
Line 50: Line 50:
  
 
[[File: Beagle-all.jpg | 200px]]
 
[[File: Beagle-all.jpg | 200px]]
 
The sound card we using is [http://us.creative.com/p/sound-blaster/sound-blaster-x-fi-go-pro CREATIVE SOUND BLASTER X-FI GO! PRO]
 
  
 
===Software===
 
===Software===
<pre style="color:red">
 
It's LEDscape, you've spelled it at least two other ways!
 
</pre>
 
 
Download and install LEDscape from git repository
 
Download and install LEDscape from git repository
 
  bone$: '''git clone https://github.com/Yona-Appletree/LEDscape.git'''
 
  bone$: '''git clone https://github.com/Yona-Appletree/LEDscape.git'''
Please following the instruction under LEDscape repo to install <span style="color:red">LEDsacpe</span> and disable HDMI ports
+
Please following the instruction [https://github.com/Yona-Appletree/LEDscape/blob/master/README.md] under LEDscape repo to install LEDscape and disable HDMI ports
  
 
Download and install scipy and numpy package
 
Download and install scipy and numpy package
Line 71: Line 66:
 
  bone$: '''python setup.py install --prefix=$HOME/local'''
 
  bone$: '''python setup.py install --prefix=$HOME/local'''
  
After installing LEDscapte, scipy and numpy packages, get the project git repo
+
After installing LEDscape, scipy and numpy packages, get the project git repo
 
  bone$: '''git clone https://github.com/xHa0z/musicvisualizer.git'''
 
  bone$: '''git clone https://github.com/xHa0z/musicvisualizer.git'''
  
Line 79: Line 74:
  
 
== User Instructions ==
 
== User Instructions ==
 +
Enter musicvisualizer directory
 +
bone$: '''cd musicvisualizer'''
 +
 
Enable PRU and LEDscape service
 
Enable PRU and LEDscape service
 
  bone$: '''cd musicvisualizer'''
 
  bone$: '''cd musicvisualizer'''
Line 89: Line 87:
  
 
Here is our YouTube video
 
Here is our YouTube video
<pre style="color:red">
+
 
Give a text description of the highlights too.
+
This video shows how the LED matrix works with Super Mario theme song. The right most column is low frequency while the left most column is high frequency.
</pre>
+
 
 +
The spectrum is update every 0.1 second.  
 +
 
 
https://www.youtube.com/watch?v=gEa0vO2T--I
 
https://www.youtube.com/watch?v=gEa0vO2T--I
  
 
== Theory of Operation ==
 
== Theory of Operation ==
<pre style="color:red">
+
 
This needs some work.
+
The software reads a wave file, and obtains the amplitude and the sampling frequency. The amplitude is stored in an array, while the sampling frequency will be used to determine how many samples in the amplitude array represents 1 second.
What's it mean to slice the amplitude?
+
 
How many samples are in the 0.1 second segments?
+
Most wav files are written with a sampling frequency of 44100 Hz, indicating 44100 samples in a second, which is a lot more than what we need to compute a 10x10 spectrum. We downsample the amplitude array by a factor of 4, to decrease the number of computation needed. 
What's it mean to divide the frequency component into ten solumns?
+
 
What is the amplitude the average of?
+
The amplitude array (downsampled to 11025 Hz) is then sliced into 0.1 second segments, each with a length of 1102 samples. First array is sample 0-1102, second array is 1103-2205, and so on. Each new array represents 0.1 second of the original wav file. Fast Fourier transform is used to obtain the spectrum of each 0.1 second segment.
</pre>
+
 
The software reads a wave file, and obtains the amplitude and the sampling frequency. The amplitude is sliced into 0.1 second segments, and fast Fourier transform is performed on each fragment to obtain the spectrum. For each spectrum, the frequency component is divided into ten columns where the amplitude is average, and the amplitude information is then normalized to a value between 0 to 10. This 10x10 matrix is displayed on the LED matrix using open pixel control.   
+
To map the spectrum onto a 10x10 grid, the frequency component is divided into ten columns, by finding the average of all amplitude values for every 1/10 of the length of the Fourier transform. This gives us a 1-D array of 10 elements, where the length of the x-axis of the spectrum is compressed down to 10. 
 +
The amplitude in the 1-D array is then normalized to a value between 0-10, therefore compressing the y-axis of the spectrum down to 10.  
 +
 
 +
This array is converted to a 10x10 matrix, and is displayed on the LED matrix using open pixel control.   
  
 
The sound and display component of the software runs simultaneously so that the display is synchronized with the sound.
 
The sound and display component of the software runs simultaneously so that the display is synchronized with the sound.
Line 123: Line 126:
  
 
== Future Work ==
 
== Future Work ==
Currently we only have one pattern for the spectrum (which displays red, blue, green, and white). More complicated design patterns could be implemented to explore the capabilities of LEDscape(fading, color changing, etc).  
+
Currently we only have one pattern for the spectrum, which displays red, blue, green, and white. More complicated design patterns could be implemented to explore the capabilities of LEDscape(fading, color changing, etc).  
Minor adjustments could be made to the software to make it more versatile, and work more smoothly. Some issues we currently have are with the size of the input file (only works if size of original file is divisible by 4), and the display can be delayed depending on the input file.  
+
Minor adjustments could be made to the software to make it more versatile, and work more smoothly. Some issues we currently have are with the size of the input file (only works if size of original file is divisible by 4), and the display can be delayed depending on the input file.
+
 
 
== Conclusions ==
 
== Conclusions ==
 
We have implemented a music visualizer using Beaglebone Black, by displaying the spectrum of a given wav file on a 10x10 LED matrix.
 
We have implemented a music visualizer using Beaglebone Black, by displaying the spectrum of a given wav file on a 10x10 LED matrix.

Latest revision as of 04:11, 10 August 2015

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Zhihao Xue, Ying Ying Zhou

Grading Template

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

09 Executive Summary
09 Installation Instructions 
08 User Instructions
09 Highlights
09 Theory of Operation
10 Work Breakdown
09 Future Work
10 Conclusions
10 Demo
10 Not Late
Comments: Nice demo.  Thanks for fixing up the wiki

Score:  93/100

Executive Summary

This project is a music visualizer implemented on a 10x10 LED matrix controlled by Beaglebone Black, where a pattern that corresponds to the spectrum of a wav file is displayed on the LED. We are able to compute the spectrum of slices of the given wavefile, convert the spectrum to a 10 by 10 matrix, and display the spectrum on the LED matrix. Currently, the LEDs updates every 0.1 second. Depending on the size of the file, it may take a long time (about 1 minute for a 7M wav file) to parse the file. Once the file is loaded, the software will play the wav file and synchronize it with the LED display. Adjustments can be made to change the design of the display pattern, and how often the screen is updated.

Packaging

The LED matrix is a 3-pin device that connects directly to the beaglebone. LED-Matrix.jpg

Installation Instructions

Hardware

Connect 10x10 Neopixel LED matrix to P9_22 on Beaglebone, Black is GND, Red is VCC and White is DIN, the schematic is below:

Schem.jpg

Connect USB sound card to Beagle

The sound card we using is CREATIVE SOUND BLASTER X-FI GO! PRO The sound card driver is included in our git repo

Beagle-main.jpg

Connect Beagle to host computer

Beagle-all.jpg

Software

Download and install LEDscape from git repository

bone$: git clone https://github.com/Yona-Appletree/LEDscape.git

Please following the instruction [1] under LEDscape repo to install LEDscape and disable HDMI ports

Download and install scipy and numpy package

bone$: sudo apt-get update
bone$: sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
bone$: sudo apt-get install build-essential
bone$: pip install cython
bone$: git clone git://github.com/numpy/numpy.git numpy
bone$: cd numpy
bone$: python setup.py build
bone$: python setup.py install --prefix=$HOME/local

After installing LEDscape, scipy and numpy packages, get the project git repo

bone$: git clone https://github.com/xHa0z/musicvisualizer.git

Then make USB sound card as default output

bone$: cd musicvisualize
bone$: cp asoundrc ~/.asoundrc

User Instructions

Enter musicvisualizer directory

bone$: cd musicvisualizer

Enable PRU and LEDscape service

bone$: cd musicvisualizer
bone$: ./setup.sh

Run visualizer

bone$: python final.py

Highlights

Here is our YouTube video

This video shows how the LED matrix works with Super Mario theme song. The right most column is low frequency while the left most column is high frequency.

The spectrum is update every 0.1 second.

https://www.youtube.com/watch?v=gEa0vO2T--I

Theory of Operation

The software reads a wave file, and obtains the amplitude and the sampling frequency. The amplitude is stored in an array, while the sampling frequency will be used to determine how many samples in the amplitude array represents 1 second.

Most wav files are written with a sampling frequency of 44100 Hz, indicating 44100 samples in a second, which is a lot more than what we need to compute a 10x10 spectrum. We downsample the amplitude array by a factor of 4, to decrease the number of computation needed.

The amplitude array (downsampled to 11025 Hz) is then sliced into 0.1 second segments, each with a length of 1102 samples. First array is sample 0-1102, second array is 1103-2205, and so on. Each new array represents 0.1 second of the original wav file. Fast Fourier transform is used to obtain the spectrum of each 0.1 second segment.

To map the spectrum onto a 10x10 grid, the frequency component is divided into ten columns, by finding the average of all amplitude values for every 1/10 of the length of the Fourier transform. This gives us a 1-D array of 10 elements, where the length of the x-axis of the spectrum is compressed down to 10. The amplitude in the 1-D array is then normalized to a value between 0-10, therefore compressing the y-axis of the spectrum down to 10.

This array is converted to a 10x10 matrix, and is displayed on the LED matrix using open pixel control.

The sound and display component of the software runs simultaneously so that the display is synchronized with the sound.

Work Breakdown

Major tasks 1. Install and test LEDscape; drive the LED matrix using default test programs in LEDscape. -Zhihao

2. Install and test open pixel control; make a custom pattern in open pixel control and display it on the LED matrix. -Ying Ying

3. Read a wav file, compute its spectrum, and map it to a 10x10 matrix. -Ying Ying

4. Display the spectrum using open pixel control. -Zhihao

5. Play wav file and synchronize sound with display. -Zhihao

6. Test other sound files. -Ying Ying


Future Work

Currently we only have one pattern for the spectrum, which displays red, blue, green, and white. More complicated design patterns could be implemented to explore the capabilities of LEDscape(fading, color changing, etc). Minor adjustments could be made to the software to make it more versatile, and work more smoothly. Some issues we currently have are with the size of the input file (only works if size of original file is divisible by 4), and the display can be delayed depending on the input file.

Conclusions

We have implemented a music visualizer using Beaglebone Black, by displaying the spectrum of a given wav file on a 10x10 LED matrix.

Although the original scope was to make a music visualizer that displays a pattern for a given sound file, to make the project more interactive, a recording element could be added, and the spectrum could be updated in real time. Another expansion of the project is to stack several LED matrices, add a third variable, and create a 3-D music visualizer.



thumb‎ Embedded Linux Class by Mark A. Yoder