Java Automatic Composer


ABSTRACT:

The main goal of this project was to design an application with the Java programming language capable of capturing and analyzing low-level sound input in a byte array from a microphone. This information was then displayed to the user in the form of universally accepted sheet music.

In the graphical user interface, many musical theory concepts were addressed. Namely, the user can change the time signature, the key signature (which is loaded from a file), and the tempo (which is synchronized with a flashing metronome during recording). Gathered music is analyzed and displayed to conform to these parameters.

There are two different ways to compose music: manually (which involves clicking on a virtual violin fingerboard), or automatically (which relies directly on a microphone). In the latter case, information is gathered and passed to one "DSP" (digital signal processing) class, where it undergoes a "Discrete Fourier Transform," in which the relative powers of contained frequencies of the sound wave are calculated. With the powers of the fundamental frequency and its first five harmonics, the exact note that the user is playing can be determined. Checking for notes in sixteenth-beat time intervals, the sound is built up and merged in a dynamic collection that is drawn to the screen.

During testing with a violin, it was found that the program detects the most notes and makes the fewest mistakes under moderate tempos around 100bmp.

Practical applications of this program include teaching new music students, providing a pitch tool for the tone deaf, verifying pitch accuracy for those learning a tonal language such as Chinese, and increasing efficiency for aspiring composers.

SCREENSHOTS:

Determining the notes that the user played after a recording session and drawing them to the screen as they are calculated

The output of one test in which I played "Over the Rainbow" on my violin

The user also has the option to click on a virtual violin fingerboard with the mouse (instead of using a microphone) if he/she does not want to play an instrument

Here are all of the parameters that can be modified in the Options->Settings menu

Here is an example in which the user has modified the default settings with respect to tempo, time signature, and key signature.

To highlight the physics aspect of the project, I also created a program that analyzes an incoming sound wave in detail. After recording a portion of sound, the user can zoom in on a particular time interval and check it for a range of frequencies (the power of each frequency is then plotted). The amplitude/time domain is graphed in green, while the power/frequency domain is graphed in cyan

I also created a real-time sound spectrum analyzer/oscilloscope program in which the powers of fundamental frequencies are plotted above their associated notes. If you look closely at the picture above, you should notice a harmonic pattern. This particular one resulted from me playing an "A" on my lowest string.


AWARDS/RECOGNITION:



Me (left) receiving the DaVinci award, which was presented by John Bravo (middle). And there's my mom on the right :)