Skip to content

LinkisLethe/Music_GenreAnalytics

Repository files navigation

Music Genre and Trend Modeling

Python Validation License

中文说明

This project studies music from two directions. The classification module compares MFCC+SVM and ResNet18 baselines with an Audio Spectrogram Transformer for multi-label genre recognition on FMA-Medium. The forecasting module uses a 30-year window, LSTM/RNN models, and Gaussian mixture clustering to model year-level changes in audio features from 1921 onward.

Modules and results

  • genre_classification/ contains the reviewed split tables, precomputed MFCC arrays, baseline notebook, AST and ResNet18 training code, and result figures.
  • trend_prediction/ contains yearly feature aggregation, LSTM and RNN training, evaluation, recursive prediction, and GMM clustering scripts.
  • The reviewed course report records AST Sample F1 0.60 and Macro F1 0.34 on FMA-Medium. It records overall normalized MSE 0.106 for the LSTM and 0.146 for the RNN baseline.

FMA genre frequency distribution

SVM genre F1 results

The metrics above were checked against the report and notebook outputs, but the full GPU training runs were not repeated during repository cleanup. The yearly label-generation script was rerun against the retained source snapshot and matched the original 100-row output exactly.

Setup and usage

Python 3.10 was used for the original environment. Create a virtual environment and install the dependencies:

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt

For a CUDA build of PyTorch, use the command generated by the PyTorch installation selector before installing the remaining requirements.

For classification, download fma_metadata.zip and fma_medium.zip from the FMA project, then extract them to genre_classification/data/fma_metadata/ and genre_classification/data/fma_medium/. Run commands from the source folder:

cd genre_classification/src
jupyter notebook mfcc_svm_baseline.ipynb
python train_ast_windows.py
python train_resnet.py

Use train_ast_linux.py instead of the Windows entry point on Linux.

For trend prediction, download data.csv from Spotify-Data 1921-2020, save it as trend_prediction/raw.csv, and run:

cd trend_prediction
python label_generation.py
python train_baseline.py
python baseline_pred.py
python train_generalized_lstm.py
python generalized_predict.py

generalized_predict.py evaluates years with known labels, recursively predicts later years, and fits GMM clusters for interpretation.

Data and licensing

The repository does not include FMA audio or the Spotify feature dataset. FMA metadata is CC BY 4.0, while individual audio tracks retain the licenses selected by their artists. The Spotify source page does not specify a license, so its raw data, derived labels, and trained artifacts are excluded. See DATA_SOURCES.md for the exact boundaries.

Project source and documentation use the MIT License. The unmodified FMA helper module keeps its original MIT notice under third_party/.

About

Multi-label music genre classification and long-term audio feature trend modeling

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors