<< Chapter < Page Chapter >> Page >

Test of the program:

We tested our program with 6 signals. For generality, we arbitrarily chose signals of different instruments, such as guitar, violin and piano, and signals of different complexity (single note, chord with 3 notes and chord with 5 notes). Among all these tests, 5 out of 6 succeeded. In the failed test, the input signal was a dual-note chord: A4 and E5 by piano. The program successfully recognized E5 but failed to identify A4. After analyzing we think the reason is that the 3 rd harmonic of A4 is very close to the 2 nd harmonic of E5, so this gives an error when the program tries to distinguish the two. But other than that, the program works fine. It demonstrates the ability to identify notes in a melody, with or without noise, and by different instruments.

The following are two trials we made with details.

I. Trial with a single note:

The input is a single piano B4 note with duration of about 0.1 sec. It is being extracted from a wav file. We can see its spectrum and time domain waveform below:

Note that in our program we use 44K Hz as the sample frequency, but the test signal may be sampled in a different frequency. (Like this one, being sampled with 11025 Hz)

To fit that signal in the program, we need to resample the input with the rate 44k Hz. This can be realized with the command:

input1=resample (input, 44000, fs);

With fs being the original sample frequency of the input.

As shown below, the program successfully detected the pitch of the note. And the program also returns the first 8 peaks of the harmonics of the note.

II. Trial with a chord of three notes

This time we change the input to a chord with notes: E3, G3 and C4, played by a guitar. Its spectrum and time domain waveform are shown below:

Again we convert the sample rate to 44k Hz and the program returns the correct results. Each column of the matrix represents the amplitudes of harmonics of corresponding note.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Elec 301 projects fall 2011. OpenStax CNX. Jun 18, 2012 Download for free at http://cnx.org/content/col11431/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 301 projects fall 2011' conversation and receive update notifications?

Ask