Difference between revisions of "Vybz"

From ESE205 Wiki
Jump to navigation Jump to search
Line 66: Line 66:
 
'''Audio Spectrum Analyzer'''
 
'''Audio Spectrum Analyzer'''
  
A spectrum analyzer is a device that displays signal amplitude as it varies by signal frequency. The amplitude is displayed on the vertical axis and the frequency is displayed on the horizontal axis. There are three main types of spectrum analyzers; the superheterodyne analyzer, the real-time analyzer, and the audio analyzer. For our project, we incorporated characteristics of the real time  and audio analyzers. A fundamental part of many spectrum analyzers is the FFT ( short for Fast Fournier Transformer)  component. An FFT is an discrete Fournier transform algorithm that samples a signal over a period of time and divides it into its frequency components. The most elementary components these signals can be broken down to are sinusoidal oscillations. The FFT basically takes signals and breaks them down into the individual sine waves that construct them. Once these signals are in this elementary form, they can be manipulated with basic operations for many theoretical purposes. A challenging point in our project came with building a real-time audio  spectrum analyzer because the FFT algorithm is used to make most real time analyzers, but not for audio analyzers. Incorporating the technologies from both types proved difficult. Our solution was to go by a model of a real-time spectrum analyzer that didn't use the FFT component snd modify it to create a spectrum analyzer that fit our needs; one that both processed audio and did so in real-time.
+
A spectrum analyzer is a device that displays signal amplitude as it varies by signal frequency. The amplitude is displayed on the vertical axis and the frequency is displayed on the horizontal axis. There are three main types of spectrum analyzers; the superheterodyne analyzer, the real-time analyzer, and the audio analyzer. For our project, we incorporated characteristics of the real time  and audio analyzers. A fundamental part of many spectrum analyzers is the FFT ( short for Fast Fournier Transformer)  component. An FFT is an discrete Fournier transform algorithm that samples a signal over a period of time and divides it into its frequency components. The most elementary components these signals can be broken down to are sinusoidal oscillations. The FFT basically takes signals and breaks them down into the individual sine waves that construct them. Once these signals are in this elementary form, they can be manipulated with basic operations for many theoretical purposes. A challenging point in our project came with building a real-time audio  spectrum analyzer because the FFT algorithm is used to make most real time analyzers, but not for audio analyzers. Incorporating the technologies from both types proved difficult. Our solution was to go by a model of a real-time spectrum analyzer that didn't use the FFT component snd modify it to create a spectrum analyzer that fit our needs; one that both processed audio and did so in real-time.
  
  

Revision as of 06:23, 2 May 2018

Overview

Our goal is to create a sound detection system that alerts its users in response to the amount of noise in the room. This is an efficient way for people to gauge the volume level of their environment and maintain the desired vibe or atmosphere in the room. A practical application for this system is for students in dorm rooms hosting social gatherings and parties, the system will alert the user when the sound level of the room has gotten too loud. This device will hopefully reduce the amount of noise complaints from neighbors and visits from RAs. This application will consist of three main components: A microphone to gauge the level of noise in the room, a Raspberry Pi to analyze data and send signals to the speaker, and a website to easily download the python file which runs the program. In addition, the Raspberry Pi will be primed with code gathered from our own knowledge and coding libraries which include an audio spectrum analyzer that works in real time. With music being a vital part of today's culture, the Vybz detection system would be useful for keeping the social atmosphere of social gatherings, uninterrupted by the need to check if the volume level is too loud.

Link to log: https://classes.engineering.wustl.edu/ese205/core/index.php?title=Vybz_Log

Link to Project Proposal: https://docs.google.com/presentation/d/1-aceL_Ulm3FMN4_c8DnqJogrqBLV7KN6ToSFz62DLEk/edit?usp=sharing

Proposal PDF: Media:Vybz_Project_Proposal.pdf

Link to Poster: https://docs.google.com/presentation/d/1XbHT7HDg9GSyXPq9Pz4P7c1x6OASOrVdHth8_D2qg-Q/edit?usp=sharing

Team Members

  • Daniel Li
  • Isaac Thomas-Markarian
  • Benjamin van der Sman
  • TA: Sam Chai
  • Instructor: Dennis Mell

Objectives

  • Gather resources (speaker, microphone(s), A/D converter, etc...)
  • Configure the microphone with an A/D converter so the microphone's analog signal is transformed into a digital one
    • The Raspberry Pi needs a digital signal to read
  • Prime the Raspberry Pi to receive and analyze the digital signal using:
    • Our own coding knowledge
    • Newfound Python skills
    • Libraries of code for the Fast Fourier Transform
    • Use the Raspberry Pi internet capabilities to access music/songs to be played
  • Code a running set of integers in real time to represent the volume level
  • Connect the Raspberry Pi to the speaker in order to adjust the volume as a result of the input signal
  • Create a visually appealing website that will print out notifications of the sound level
  • Send the user a notification when the desired threshold is reached
  • Develop a plan for a demonstration that does not impede on other's project but effectively displays our project

Challenges

  • Learn how to program the Raspberry Pi using Python and skills from the tutorial videos
  • Access and dissect coding libraries that may hold code that is useful but lies outside of our skill level
  • Find and apply the audio spectrum analyzer to create sound profiles of the ambient noise and the speaker's music
  • Establish a communication between the Raspberry Pi and the microphone
  • Develop website that will show notification
  • Have a real time running set of integers displaying the sound level
  • Prompting a notification being sent to a phone when the volume reaches a certain level
  • Work to develop an effective demo given the location, Lopata Gallery

Gantt Chart

Vybz Gantt Chart

Budget

  • Raspberry Pi (Provided)
  • Microphone ($9.99)

Total: $~10

Design and Solutions

Overall Setup:

We used a Raspberry Pi and a USB microphone to detect the sound level in the room. Using the analog signal from the music played, we translated the sound bytes into a series of integers that represents the volume of sound. We tested that when the level falls within the 70-80 range of the integers, the sound leaks through the walls in WashU campus dorms. In response, we programmed our Raspberry Pi to print out the statement “Turn the volume down” when the microphone when integers in this range are recognized. Because it is unrealistic of the Vybz user to be closely monitoring the program on their computer while they are preoccupied with listening to loud music or hosting a social event, we created an alert system so that the program will send an SMS message to the user when the volume in the room has surpassed the threshold for an elongated period of time. To make this system more visually appealing, we designed a website with information about Vybz and a link to download the Python file which contains our executable program.


Recognizing Audio

On of the earliest problems we ran into into was getting the Raspberry Pi to recognize the audio signal from the microphone. In order to analyze audio information with a computer like the the Pi, we had to convert the analog signal which is the type of signal received by a microphone, and convert it into a digital signal which can be analyzed or manipulated with a computer. This signal transformation can be done with an A/D converter (analog to digital), but instead of purchasing this device, we found a USB microphone with this converter built in. Even with this microphone, it was difficult to find where the signal was being recognized on the Raspberry Pi. One of our first successes in visualizing the digital audio signal was through a program called Audacity, where we used a built in Fast Fournier Transformer (FFT) to visualize the frequency of the signal. *insert audacity graph here*

While this was a hopeful step in analyzing the signal, we found that Audacity is only able to analyze the signal and create this visual representation after recording. This was a crucial limitation because in order for our device to function as we conceptualized it, the program needed to be able to analyze the audio data in real time. After extensive searches for real time audio analysis programs, we came to the conclusion that we would have to build an audio spectrum analyzer for the device to work as intended.


Audio Spectrum Analyzer

A spectrum analyzer is a device that displays signal amplitude as it varies by signal frequency. The amplitude is displayed on the vertical axis and the frequency is displayed on the horizontal axis. There are three main types of spectrum analyzers; the superheterodyne analyzer, the real-time analyzer, and the audio analyzer. For our project, we incorporated characteristics of the real time and audio analyzers. A fundamental part of many spectrum analyzers is the FFT ( short for Fast Fournier Transformer) component. An FFT is an discrete Fournier transform algorithm that samples a signal over a period of time and divides it into its frequency components. The most elementary components these signals can be broken down to are sinusoidal oscillations. The FFT basically takes signals and breaks them down into the individual sine waves that construct them. Once these signals are in this elementary form, they can be manipulated with basic operations for many theoretical purposes. A challenging point in our project came with building a real-time audio spectrum analyzer because the FFT algorithm is used to make most real time analyzers, but not for audio analyzers. Incorporating the technologies from both types proved difficult. Our solution was to go by a model of a real-time spectrum analyzer that didn't use the FFT component snd modify it to create a spectrum analyzer that fit our needs; one that both processed audio and did so in real-time.


Integer Conversion

  • image of raw data if we have that

The raw data came out as zeros and ones when we ran our initial code for the audio spectrum analyzer. This was not optimal since our purpose for this data was to compare it to a threshold in an intuitive manner. We found that the best way to navigate this problem was to convert our raw data to integer values. We modified our code so that this transformation occurred in real time so that it didn't effect the speed at which the feedback loop of our program would run. Below is a visual of the array of of integers which refreshes itself at near real time speeds.

  • video of integer array*


Twilio

Twilio is a cloud


Website

New Skills

Going through this project, there was a lot to learn. Some key takeaways from our semester are:

  • Learning to connect the Raspberry Pi to our personal computers
  • Receiving an input through our USB microphone and our Pi
  • Creating an Audio Spectrum Analyzer to Measure Volume
  • Designing a Website and Demonstration
  • General coding techniques in Python and with the Raspberry Pi
  • Managing Project Time

Results and Next Steps

The final results of the Vybz Detection was a device that:

  • Incorporated an audio spectral analyzer
  • Transformed individual sound bytes into a string of running integers that could easily be analyzed
  • Used algorithm that alerted the Vybz user when the volume threshold was passed with a print statement on a GUI screen
  • Was accompanied by a website we built with information about the company and a link to download the Python file with our code
  • Incorporated an alert system that sent an SMS message to the Vybz user when the volume threshold had been exceeded for a specific duration of time

While we met all of the goals that we set for the Vybz detection system, with additional time to enhance the device, we would:

  • Add settings so that the user could calibrate the threshold of the program depending on how far away from their neighbor or whoever else they are concerned about disrupting in a simple way. This would take Vybz to a wider market than just WashU campus dorms which is where we currently have the threshold based on.
  • In the future, Vybz could also be a sound detection system that logs the volume levels in any space to reduce noise complaints, and could provide additional information about atmospheric volume for people investing in residential spaces while still holding its original purpose of maintaining the ambience of a party or social event.
  • Adjust the audio spectrum analyzer code to be able to run with any microphone provided, as many devices such as laptops, phones, and tablets already have built in microphones.
  • Make the Python compatible for all operating systems, as ours is only built to run on Linux devices. This would make the code much more accessible to people with any type of device capable of receiving audio input.
  • Redesign the messaging system and create a prompt that will allow anyone to put in their phone number to receive notifications, as right now it only works for one number.



Link to our GitHub: https://github.com/bvandersman/vybz/tree/master