Hysen Labs
Open-source project
babaktr/musical-instrument-recognition avatar
babaktr

musical-instrument-recognition

Machine Learning Project, using Artificial Neural Networks in Musical instrument Recognition.

50 stars9 forksMatlabLicense varies
01
DEEP OPEN-SOURCE ANALYSIS

Classifying instruments with a neural network in MATLAB

A MATLAB project that trains a multilayer perceptron to recognize eight orchestral instruments, comparing accuracy across the attack, the tail, and frequency slices.

02
DEEP OPEN-SOURCE ANALYSIS

The experiment design

The project trains artificial neural networks to classify musical instruments, then runs comparative experiments to see how different characteristics of a sound affect accuracy. The conditions tested are the whole sample, the attack of the sound, everything but the attack, the initial 100 Hz of the frequency spectrum, and the following 900 Hz. Each variant isolates a different part of the signal, and the accuracy differences between them are the whole point of the study.

03
DEEP OPEN-SOURCE ANALYSIS

The dataset and the eight picks

The data comes from the London Philharmonic Orchestra Dataset, which has recorded samples from 20 instruments covering tones in every octave with varying strength and length, plus techniques like vibrato, tremolo, pizzicato, and ponticello. To keep the scope manageable, eight instruments were selected: banjo, cello, clarinet, English horn, guitar, oboe, trumpet, and violin. They were chosen for sample quality and because they span the brass, string, and woodwind families. Only samples from the fourth octave were used, to avoid different harmonics in the same tone across octaves.

04
DEEP OPEN-SOURCE ANALYSIS

The network

The model is a Multilayer Perceptron with early stopping, trained with resilient back propagation as the learning heuristic. The network has 50 inputs, 30 hidden nodes, and one output node with eight outputs, one per instrument. The architecture is small and conventional, which keeps the experiment about the input representations rather than about model engineering. Results come from training run over an average of 10 sessions.

05
DEEP OPEN-SOURCE ANALYSIS

What accuracy said

The results table tells the story. The base experiment with the whole sample hit 93.5 percent accuracy. Using only the attack dropped to 80.2 percent, and removing the attack fell further to 73.2 percent. The first 100 Hz of the spectrum was the weakest at 64.2 percent, while the following 900 Hz recovered to 90.6 percent. So the attack carries signal, but most of the distinguishing information lives in the body of the sound and the bulk of the spectrum. A confusion matrix from one training session shows the per class picture. Running the code is a matter of running the neural network file in MATLAB and uncommenting the dataset you want.

07
DEEP OPEN-SOURCE ANALYSIS

Official sources

08
Community notes

Community notes