Proceedings of the 12th INDIACom; INDIACom-2018; IEEE Conference ID: 42835 2018 5th International Conference on “Computing for Sustainable Global Development”, 14th - 16th March, 2018 Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA) Accompanist Electronic Harmonium An AI based Real Time Follower

Prasad Pusavale Forum Rathod Dept. of Information Technology Dept. of Information Technology VCET., University of Mumbai, VCET, University of Mumbai, Maharashtra, INDIA Maharashtra, INDIA E-mail: [email protected] E-mail:[email protected]

Prof. Yogesh Pingle Dept. of Information Technology Siddhesh Raut VCET., University of Mumbai, Dept. of Information Technology Maharashtra, INDIA VCET, University of Mumbai, E-mail: [email protected] Maharashtra, INDIA E-mail: [email protected]

Abstract__This paper is about developing an Electronic Music, Sufi Music, Bhajans and other varieties of music. The Harmonium which will identify the of the vocalist and main objective here is to replace the human Harmonium play the notes which he is singing in Real Time. Raspberry Pi Player with ‘ELECTRONIC HARMONIUM 3 Model B will be used here. Audio processing is needed to PLAYER’.There are instruments in classical music which calculate the frequency of an audio to find out Notes sung by the vocalist. This system won't just follow the vocalist but also can be replaced by there Electronic Equivalent Devices. Such will be able to feel the short gaps taken by vocalist during the as, for we have ' Tarang', Electronic is concert. For that Machine will first detect the , vocalist is also available in the market. Both of these Electronic currently singing. Various predefined libraries such as machines can replace their respective original instruments PyAudio, NumPy and Wave. PyAudio has functions through very effectively. But, for Harmonium we don't have such which the input is taken using microphone. From NumPy we reliable Electronic Machine. So, the basic aim is to make will use the FFT function which is used to calculate the such an Electronic Machine on which Music Practitioner can frequency of audio from chunks of bytes. The Wave library is be dependent on. used to store the audio from the input signal into various small predefined size of bytes called as chunk. When this bytes are processed using the FFT function of the NumPy II. REFRENCIAL PROCEDURE library then we get the average frequency of these bytes as Python scientific computing process comes with three modules output which will be then further used to identify the Ragas NumPy SciPy Matplotlib. NumPy gives you access to complex and Notes and play the music accordingly. arrays and constants which cannot be achieved through basic Python. Various binary operations, statistics operations, logical Keywords: Raspberry pi (Model B); audio packages; FFT. functions and sorting and searching functions can be done using NumPy. Whereas various linear algebraic, integration, I. INTRODUCTION signal processing and Fourier Transform functions can be done One of the most powerful and important thing in affecting using SciPy. The task of quickly visualizing and analyzing of data from NymPy arrays can be done using Matplotlib. When the emotional behavior of an individual is music . It may we see a signal in the time domain, we cannot tell how many through listening or signing to music during spare time, while studying during exam time or distressing oneself after different individual signals are present. a bad day .Music can also be related to yoga as it helps to achieve mental peace and also keeps our body healthy. III. PROPOSED SYSTEM However playing any musical instrument is a serious act. One such instrument is Harmoniu m. It was introduced in late nineteenth century in India by British. The resonance of A. Technologies Used Harmonium perfectly matches with the resonance of vocals The waveform of the Harmonium is similar to square wave in . Thus it has very become a very thus to obtain that Raspberry Pi (Model B) and PWM (Pulse popular accompanying instrument as it can capture Shruti, Width Modulation) technique in it is used which is a , Gamak.It plays a central role in Indian Classical technique to modify pulses of the input signal.

Copy Right © INDIACom-2018; ISSN 0973-7529; ISBN 978-93-80544-28-1 1565 Proceedings of the 12th INDIACom; INDIACom-2018; IEEE Conference ID: 42835 2018 5th International Conference on “Computing for Sustainable Global Development”, 14th - 16th March, 2018

GPIO pin when used as output pin, above figure shows the interfaces between simple LED. Each pin can be turned on 1.RASPBERRY PI 3 MODEL B (Specifications) : or off. The anode of LED pin is connected to VCC where 3.3 V is output through some low value register to drop the Raspberry Pi system includes an ARM compatible central voltage and cathode is being connected to ground pin processing unit. It has on chip GPU. It’s CPU speed ranges which is specified and shown in above figure. from 690 MHz to 1.19 GHz. Microcontroller Pi has on board memory RAM which is of 1 GB. Ultra class 10 of 16GB C. Waveform Generation Using PWM memory card is used to store the operating system like Raspbian OS which is installed by NOOB OS. After getting Waveform of Harmonium is a square waveform, we will memory card, first it has to be formatted. Operating system require to use the Pulse Width Modulation for generating a like Rasbian OS is installed using card reader and then it has suitable waveform to produce the voice of Harmonium. been inserted in the card slot of Raspberry Pi. It has between PWM is a technique used to control the power output of four USB slots, one HDMI port where HDMI to VGA cable raspberry pi. The figure 3 shows pattern of signals from the can be attached. It has composite video output, and audio jack PWM pin of Pi. connector. Number of GPIO pins are 40 where other peripheral devices like sensors can be attached.

Fig .3.Duty Cycle of PWM waveform

Fig .1.Raspberry Model Pi 3 Model

2 .G.P.I.O.: GPIO is also referred as General Purpose Input Output. Raspberry Pi has 40 pin GPIO slot. These pins act like a interface between the microcontroller and the outside peripheral devices. The sensors can be attached to it through the breadboard and specific hardware circuit. 26 pins are GPIO pins and the others pins are power pins and/or ground pins. Fig .4.Switch Interface with LED In above figure [4], the LED will remain ‘ON’ until and B. How GPIO Pins Work unless the switch is open. Duty Cycle is the proportion of time for which the LED is ON. If the switch is closed for half second and open for half second then the LED will glow only in the first half second. Duty cycle can be calculated as follows: Duty Cycle =Turn ON time/ (Turn ON time + Turn OFF time) Duty Cycle = (0.5/ (0.5+0.5)) = 50%

Fig .2.Interfacing LED with GPIO pins.

Copy Right © INDIACom-2018; ISSN 0973-7529; ISBN 978-93-80544-28-1 1566 Accompanist Electronic Harmoniu m

D. Audio Processing Using Python 1.SOFTWARE PWM: To process the audio Python libraries are used such as PyAudio library is used for listening audio from input source In Raspberry 3 there are 2 dedicated pins for PWM but in and giving desired output. PyAudio uses Stream class for case when you require more then that then using Software taking inputs from microphone and giving outputs to PWM we can use any of the GPIO pins for generating PWM speaker. The stream class has values such as Rate, Width, outputs this can be achieved using WiringPi library of Channels, Input, Output (have boolean values).Channels set Raspberry Pi. It has GPIO access library written in C which the number of audio channels. It's value ranges from 1 to is used Pi. This library has a command-line utility “gpio” which is used to program. Using this reading and wrting on 2.Rate defines the number of Samples collected per second the GPIO pins can possible. .When the audio is recorded, it is divided into chunk of bytes specified. These chunks are then added to each frames which are then joined together to make a .wav file These .wav file is 2.HARDWARE PWM: then read using the Wave package NumPy is then used to perform Fast Fourier Transform on the file and obtain the This can be achieved using the WiringPi library of Raspberry frequency of each chunk of bytes. The data from the file is Pi. It is also called as BCM2835 library. Hardware PWM is read in frames as per it has been saved. supported on limited GPIO subset pins by the bcm2835 library. This library provides functions for configuring and controlling PWM output on GPIO pins. IV.CONCLUSION AND FUTURE SCOPE After looking at the increasing demand in market as well as The library has 2 PWM channels that is 0 and 1. Each channel need of Electronic Harmonium for Riyaz purpose in Indian of can be connected to a limited subset of GPIO pins. Classical Music our main aim was to create “Electronic D. PWM Audio Output To Speaker Harmonium” which will be played automatically and not manually through Raspberry Pi and Python that will follow Two output modes of Pi are HDMI and Headphone jack .The the vocalist in real time. It can act as a filler thus giving following are two ways to set the audio output that is through vocalistis time to breathe and continue the music even if the Command Line and using raspi-config. vocalistis stop singing. It can be developed in the future in such a way that it can be used for a variety of Musical Amixer cset numid = 3 2 Instruments. Most distance measures that have worked well in musical process. On the other hand ,many of the indexing And sudo raspi-config methods rely 40 on the properties of a metric. Typke and Walczak-Typke discuss indexing techniques. This non- Through raspi-config window we can select whichever metric distance measures musical interest. Inspired by LSH, output method we want to use. The 3.5mm audio jack is it may be worthwhile to explore the use of non-metric driven by this PWM peripheral which should give the sound dissimilarity measures which is suited for music retrieval similar to Harmonium but the audio quality received by this with different indexing methods. Designing a good effective audio jack for speakers is not good and headphones sound confidence measure to support raga identification results will bit louder than speaker but not loud enough hence an audio be of great importance while building a real-time raga amplifier here. PAM8403 would be best suited. recognition.

REFRENCES [1] A.K.M Fazlul H., "FFT and Wavelet-Based Feature Extraction for Acoustic Audio Classification." Department of EXTC, Daffodil International University. [2] J.Glover,Victor Lazzarani and J. Timoney, “Python For Audio Signal Processing” The Sound and Digital Music Research Group, 2011. [3] Ms. PadmaSundari, “Music Information Retrieval: Raga Identification using Machine Learning” Post graduate report in Industrial Mathematics and Scientific Computing dept., IIT Madras, May 2016. [4] Mr. Yogesh P. Pingle, “Predicting Shrutis in Harmonium using Temporal Mining” in International Journal of Education and Research, ISSN :2248-9622 National Conference on Emerging Trends, March 2012.

Fig .5.Speaker Amplifier

Copy Right © INDIACom-2018; ISSN 0973-7529; ISBN 978-93-80544-28-1 1567