Musical Note Processing
Musical Note Processing
ABSTRACT
The project is based on producing musical notes by detecting and recognizing the tones in the audio file given
by the user. Detection and recognition of audio tones involves audio processing and rendering them requires
communication between the bots and motion planning. Two robots are used to render tones detected from the
audio and they communicate using XBEE technology. Depending on the number of tones detected, multiple
bots can be used, communicating with each other to play tones with the help of different sized. Multiple robots
collaborated together does the task fast and efficiently.
Music touches the soul and helps us to relax and feel good. Music has the power of uniting people from different
backgrounds and cultural heritages. In fact, it can be best described as a wonderful force that is capable of bonding people
together. In Indian Music, the following seven notes form the basis for creating music:
Sa Re Ga Ma Pa Dha Ni.
How about a robot singing or playing music for you? In this technological era, robots can not only be used as a
machine to reduce human work but may also be used for entertainment purpose to play music for you. Inspired by this idea,
we thought of developing an experiment with robots playing music. In this project, two robots coordinate with each other to
play the notes in a given sequence.
Challenges in this theme include Audio Processing, Motion Planning and Communication. A music file is Audio
Processed so that they have to extract the notes and communicate them to the robots. The arena consists of metallic pipes of
different sizes that are placed randomly to give different frequencies of sound. Both robots traverse the arena to play the
notes in a given order by coordinating with each other.
II. METHODOLOGY
A. Input
The input given to our program will consist of a series of pure notes, each of some finite duration,
separated by silence. The width of silence between any two notes may be different. The duration of each note
may be different.
B. Process Flow
In order to identify the notes that are present in the file, we will implement the following steps in the
same sequence:
1. Reading the sound file
2. Detecting silence in the file
3. Detecting the location of notes using data obtained from (2)
4. Calculating the frequency of each detected note by using DFT
5. Matching the calculated frequency to the standard frequencies of notes to identify the note that is being
played.
The audio file provided is processed to generate the musical notes from the audio file. The audio file is
broken down into windows for the process of detection of the notes. Moreover, the silences in the audio file
must be detected and they have to be neglected.
C. Detecting Silence
For the detection of silence, one of the approaches that can be implemented involves using a window of
some fixed size. Let us assume that our window is 0.05 seconds long. In terms of the number of samples, this
window will have the length equal to 0.05 ∗ i i. Considering,i i = 44,100, this window will of length 2205.
We can slide this window over the input signal and for each position of window, record the sum of
squared elements of input falling within the window. This will roughly be equal to the mean square of amplitude
of the signal under the window. If this value falls below a particular threshold, then we can classify that input
within that window as silence.
Implementing this using a for loop will work, but it may be inefficient for large audio files. Interested
reader might also try to implement this using convolve function from numpy.
This is the equation (1) for Calculating Frequency from DFT Output. Here l refers to the length (i.e. the number
of samples) of the vector corresponding to the audio signal of the sine wave.
Once we have the location of each note, we can use the Equation above to calculate the frequency of
the note. To do so, we find index by calculating the DFT of the portion of signal at the identified location of the
note. The DFT of a signal can be calculated in Python using fft function from numpy fft module.
numpy.fft.fft(signal) - This function computes the one dimensional Discrete Time Fourier Transform of the
specified signal and returns a complex numpy ndarray.
You might want to use numpy.argsort() function to find index from the calculated DFT.
With proper spacing and windowing we get certain set of notes and silences. From these notes the
frequency of the note is found out and the frequency is then compared with the standard set of frequencies to
figure out the tune of the note.
IV. APPLICATIONS
V. CONCLUSION
In this paper, we proposed the musical note processing using robots. The main idea behind this project was
that robots were generally used as a machine, this paper was made to prove that robots can not only be used as a
machine, but they can also be used for entertainment purpose for playing music. This was developed to show the
future scope of robotics in the field of music. The implementation of the project is provided in the link below.
https://www.youtube.com/watch?v=w8RsqEkZuZM&feature=youtu.be
REFERENCES
[1] https://www.youtube.com/playlist?list=PL86D5A3CA4C8BF2E8
[2] http://www.phy.mtu.edu/~suits/notefreqs.html
[3] http://www.audacityteam.org/