Abstract – At present all the various methods present to generate music are very complex, they are either based on playing recorded samples of musical instruments that are high priced and non-creative or by synthesis which involves a large number of components and is very complex to generate tones. Also, a synthesizer can be designed exclusively for only a single musical instrument. This paper provides an overview of how the sound of various musical instruments can be generated using an ARM Microcontroller and a simple binary weighted resistor DAC. This work is based on ARM Cortex – M4F Microcontroller which has low power consumption and is economical.
Keywords – Music generation, Musical Instruments, Binary weighted resistor Digital to Analog Converter, ARM Cortex M4F Microcontroller.
Music is an indispensable part of life for billions of people all over the world. It is an art and the harmonious creation of voice.1 Objects used to generate sound are musical instruments. There are primarily two ways of creating music electronically, Sampling and Synthesis. In Sampling the sound of the musical instruments is recorded into digital form and then played with modifications like modulation, looping and phase shifts. Either one or
many samples for one note of a musical instrument are recorded. To play songs on various instruments expensive libraries of the samples need to be purchased. Music synthesis is a sub-field of Music Technology. In the field of music, synthesizers are the instruments that are used to generate and record music. Music Synthesizers replicate traditional musical instruments and can generate new tones that cannot be played on acoustic instruments. There are various methods by which synthesizers can generate sounds such as additive, subtractive, wavetable, modulation and sample-based synthesis. Current synthesizers are very expensive and are designed to play a single instrument. They are complex in operation and consist of numerous components One of the barriers to playing music is the high cost, bulky size and regular maintenance of musical instruments. The basic motive of this work is to develop a device that can fulfill the need of playing various musical instruments under a single system. This device is user-friendly as a user who does not know how to play an instrument can compose new music or play existing songs. The circuit construction and operation are very simple and creative music can be composed.
II. RELATED WORK
Digital Synthesizers use digital signal processing methods to synthesize the sound of musical instruments. Contrary to Analog Synthesizers that were constructed using analog circuits and samplers that simulated the recorded samples of the instruments, digital synthesizers generate a sequence of sampled numbers converted from an analog waveform. The first digital synthesizer prototype developed by Yamaha2.They constructed it based on John Chownings FM Synthesis algorithms with many up gradations to avoid distortions. K.Balasubramanian proposed a music synthesizer which was is based on creating sound patterns of musical instruments by recurring occurrences of its fundamental sound signal.3 The frequency of the notes could be programmed. The instrument playing was also displayed on a 16-segment device. Currently digital synthesizers are completely based on software, “softsynth” which is a program for generating music signals.
Each musical instrument has a unique waveform, a sequence of numbers that generate this waveform is stored as an array and is sent to the DAC. The DAC output produces the wave by playing it depending on the frequency inputted. Each note of a song is played for a duration specified by the user. This circuit is implemented using a simple binary weighted resistor DAC. Higher order DACs can be used to improve quality of the sound produced as more number of samples for amplitude are selected. The number of various musical instruments that can be played is determined by the DAC.A 4 bit binary weighted resistor DAC can play 4 different instruments and an 8 bit DAC can play 8 different instruments.
Push buttons correspond to each musical instrument. For a given set of notes entered by the user the song starts to play when the button is pressed. The main program contains the complete list of notes for a particular song. The digital numbers fed to the DAC is converted to produce a wave similar to that particular instrument and with the help of Systick Timer that wave is produced multiple times depending on frequency of the musical note to generate music. The software code is executed on a microcontroller development tool/ (Embedded Development Tool) Keil uVision4 and is written in the C programming language.
Implementation of GUI
Graphical User interface portrays a diagrammatic illustration and is easy to interact with for users. The work was implemented on MATLAB and a GUI(Graphical User Interface) was created to play music of different instruments.
The Fig(1) is the circuit of the implemented work. It consists of four switches to play four different instruments and a 4 bit binary weighted resistor DAC connected to the Microcontroller.Fig(2), shows the waveforms with marked sample values of different musical instruments that is used to generate the tone of a particular instrument.
Fig (3) shows the GUI which plays a song for two different instruments using the harmonic equations for that particular instrument. Each note can be programmed by specifying its frequency and duration to be played. Fig(4) shows the main task window of the GUI. The waveform of the song playing will be shown on the axes plot and Fig(5) shows the GUI playing violin song 2 and its corresponding waveform is generated.
In this paper, it is proven that by constructing a circuit with an ARM Microcontroller and DAC circuit a system could be developed to play various musical instruments in an economical and simple manner.
Presently, the project implemented can play one instrument at a time, this limitation can be overcome by utilization of the other timers or the ARM microcontroller to play more than one instrument simultaneously. The implementation on MATLAB can be extended to many musical instruments by using its respective harmonic equations.