A MATLAB Neural Network for Musical Instrument Recognition, Built on a Public Orchestra Dataset
Machine Learning Project, using Artificial Neural Networks in Musical instrument Recognition.
At a glance
- What is it?
- This repository trains a multilayer perceptron to classify eight orchestral instruments from audio samples, and compares how different parts of the signal affect accuracy. The MATLAB code is simple to run, but the project is a research artifact from 2017, not a maintained library.
- Who is it for?
- Adopt this repository if you are a student or researcher replicating a 2017 instrument classification experiment and want a minimal, readable MATLAB implementation. Do not use it for production audio classification: it handles only eight instruments, uses a fixed 50-input feature vector, and has no inference pipeline or trained model files.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Probably not. The repository last received commits 114 months ago, on May 16, 2017.
- What is it written in?
- Mainly Matlab, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 21, 2026, and from our analysis. They are not legal advice.
Star history
- babaktr/musical-instrument-recognition50 ★ · +0
| Repository | 2026-08-18 | 2026-10-21 |
|---|---|---|
| babaktr/musical-instrument-recognition | 50 | 50 |
0 Stars in the last 64 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What This Project Actually Solves
The repository addresses a narrow research question: how much does the temporal or spectral structure of a musical instrument sound matter for automatic recognition? It trains a neural network to classify eight instruments and then runs controlled experiments by feeding the network different slices of the audio. The instruments are Banjo, Cello, Clarinet, English horn, Guitar, Oboe, Trumpet and Violin, spanning brass, string and woodwind families. The intended user is a researcher or student working on audio classification, not a developer building a product. The code is a companion to an arXiv paper, so its value is in reproducibility, not in deployment.
The Data and the Preprocessing Pipeline
The source data comes from the London Philharmonic Orchestra Dataset, which contains recordings of 20 instruments across octaves, dynamics and playing techniques. The authors limited the scope to eight instruments and, critically, only used samples from the fourth octave. That choice avoids dealing with harmonics that shift across octaves, but it also means the model never sees the full pitch range of any instrument. The README reports the sample counts, which are heavily unbalanced: Violin has 366 samples while Banjo has only 23. That imbalance is a real limitation for training a classifier, and the repository does not mention any weighting or oversampling strategy. The preprocessed data is stored in .mat files, one per experiment, so the raw audio never enters the network training code.
The Neural Network Architecture and Training
The model is a Multilayer Perceptron with 50 input nodes, 30 hidden nodes and one output node that produces eight values, one per instrument. Training uses Resilient Back Propagation, a common heuristic that adjusts each weight with its own step size, and Early Stopping to avoid overfitting. The README states the network is trained over an average of 10 sessions, which suggests some randomness in initialization or data splitting. The feature vector of 50 inputs is not described in detail; the README only mentions 'avgvalue' and 'chunk50' in the dataset filenames, implying that audio is split into 50 chunks and each chunk is averaged. That is a coarse representation, and it likely discards phase and temporal fine structure, which explains the accuracy differences in the experiments.
What the Experiments Show About the Signal
The results table is the core of the project. The base experiment, using the whole sample, reaches 93.5% accuracy. Using only the attack of the sound gives 80.2%, while using everything but the attack drops to 73.2%. That tells you the attack carries more discriminative information than the sustained part. The spectral experiments are more surprising: the first 100 Hz of the frequency spectrum yields only 64.2%, but the following 900 Hz reaches 90.6%. The authors do not explain why the higher band works better, but it suggests that the fundamental frequency region is less informative than the harmonics, at least for these instruments. The README also mentions a confusion matrix, but it is not included in the text, so you cannot see which instruments are confused. That is a gap for anyone trying to understand failure modes.
Getting It Running: Commands and Configuration
The entry point is a single MATLAB script: neural_network.m. You run it directly in MATLAB, and it loads a dataset via a load command that you must edit. The README shows the line: load 'datasets/<dataset>.mat'. You uncomment the line for the experiment you want. There are five preprocessed datasets, each named with a prefix: 1-dataset_avgvalue_chunk50.mat for the base experiment, 2-dataset_avgvalue_chunk50_only_attack.mat, 3-dataset_avgvalue_chunk50_without_attack.mat, 4-dataset_avgvalue_chunk50_100hz.mat, and 5-dataset_avgvalue_chunk50_900hz.mat. The README does not state where these files come from or whether they are included in the repository. It also does not list any dependencies beyond MATLAB itself. That simplicity is a strength for reproducibility, but it means you must have the dataset files and the Neural Network Toolbox, or the script will fail.
Limitations and Where It Is the Wrong Tool
The most obvious limitation is that the model only recognizes eight instruments, and only in the fourth octave. It will not generalize to other octaves, other instruments, or even the same instruments played with techniques like vibrato or pizzicato, unless those techniques are present in the fourth octave samples. The dataset includes such techniques, but the README does not say whether they are mixed into the training set or held out. The sample imbalance is another issue: Banjo and Guitar have very few samples, so their classification accuracy is likely poor, and the overall 93.5% average masks that. The feature extraction is also fixed, so you cannot adapt the network to raw audio or to a different feature set without rewriting the preprocessing. If your goal is a real-time recognition app, this project is the wrong starting point because it has no inference code, no trained model file, and no way to feed a single audio file through the network.
Alternatives and How They Differ
A common alternative for instrument recognition is to use a convolutional neural network on spectrograms, as done in many modern audio classification projects. That approach learns features from raw spectrograms, whereas this project hand-crafts a 50-dimensional average-chunk feature. The difference is fundamental: the MLP here relies on the engineer to design the input, while a CNN learns its own filters. Another alternative is to use a support vector machine with mel-frequency cepstral coefficients, which is a classic baseline in audio classification. That would be simpler to train and might handle the small dataset better, but it would not give you the same experimental control over attack versus sustain. The choice depends on whether you want to replicate this paper's specific experiments or build a more general classifier.
Maintenance, Licensing, and Reproducibility
The repository has no license, which is a legal problem for reuse. You cannot legally copy or modify it without explicit permission, even for research, unless you contact the authors. The last push is unknown, and there are no releases, so the code is likely frozen at its 2017 state. That is fine for a paper companion, but it means no bug fixes or compatibility updates for newer MATLAB versions. The README references an arXiv paper (1705.04971), which is a good entry point for understanding the method in detail. To reproduce the results, you need the original dataset from the London Philharmonic Orchestra, which is publicly available, but the repository does not include the .mat files or the preprocessing script that generated them. That is the biggest gap: you can run the training, but you cannot regenerate the datasets without reverse-engineering the feature extraction.
Editorial conclusion
Adopt this repository if you are a student or researcher replicating a 2017 instrument classification experiment and want a minimal, readable MATLAB implementation. Do not use it for production audio classification: it handles only eight instruments, uses a fixed 50-input feature vector, and has no inference pipeline or trained model files. Before relying on it, verify that your MATLAB version supports the Neural Network Toolbox functions used in neural_network.m, and confirm the dataset files are present, since the repository does not include them. The project is a snapshot of a specific paper, not a general tool.
Frequently asked questions
How do you identify a musical instrument with this project?
By training a multilayer perceptron in MATLAB on single-note recordings and classifying into eight instruments: banjo, cello, clarinet, English horn, guitar, oboe, trumpet and violin. The base experiment, using the whole sample, reaches 93.5% accuracy averaged over 10 sessions.
Is there an app that identifies instruments in musical-instrument-recognition?
No. The repository is a set of MATLAB scripts with no interface: you run neural_network.m, choose a dataset by uncommenting a load line, and read the printed results and plots. There is also a companion arXiv paper at 1705.04971 describing the experiments.
Which instruments does the musical-instrument-recognition model classify?
Eight: banjo, cello, clarinet, English horn, guitar, oboe, trumpet and violin, chosen from a 20 instrument dataset for sample quality and because they cover the brass, string and woodwind families. Only fourth-octave recordings are used, to avoid different harmonics for the same tone across octaves.
What does the neural network in musical-instrument-recognition look like?
A multilayer perceptron with early stopping, trained with resilient back propagation. It has fifty inputs, thirty hidden nodes, and one output node carrying eight outputs, one per instrument.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/babaktr-musical-instrument-recognition)Star history chart for your README
[](https://hysenlabs.com/projects/babaktr-musical-instrument-recognition)