Circuit Lake

Electronic Project and Circuit Collection

AVR Auto Composing Piano

01/27/2013 Category: Audio, AVR, Miscellaneous

This ATmega644-based smart piano can composes music of your own taste automatically. What you have to do is select a mood of the music and play two notes upon which the music is based, and then let the piano create the music for you. You can also train the piano by first playing several pieces of music that you like. The piano would then compose music based on the pattern of the music user just played.

Smart Piano with music composer feature

Composing algorithm in the project takes in three inputs and consists of three stages of composing. The first input that user has to enter is the mood of music that he wishes to create. Currently, The project support two moods: happy and tender. The other two inputs are two notes chosen by the user.

Algorithm diagram

First stage of composing is determine music tone as result of the three inputs. Happy mood corresponds to a major tone determined by the two input notes, while tender mood corresponds to a minor tone determined by the two input notes. The speed of the music is also determined in the first stage by the mood input.

Second stage of composing is to create the melody for the music. The first step is to set rhythm corresponding to different moods. After the rhythm is set, the next note of the melody is chosen roughly according to the corresponding Markov probability matrix until all notes of the melody is filled. We incorporate composing rules that cannot be represented by the probability matrix to the melody composing process by either setting certain notes deterministically or changing the probability matrix when choosing notes for some special rhythm.

Third stage of composing is choosing proper chord after the melody is set. The chord is chosen so that it sounds harmonic together with the melody and also varies with some randomness to avoid monotony.

There is a special train mode in our composing system that lets the user to build their own Markov probability matrix instead of using our pre-trained ones. If the user chooses to enter the train mode, the system allows the user to play a piece of music on the electric piano. Then the system will compute the Markov probability matrix based on the piece of music that the user played and thus could generate music that assemblies what the user just played with some variations. The smart piano project is designed by Chaorong Chen and Siyu Zhan.