--- license: cc-by-4.0 task_categories: # - music-information-retrieval # - symbolic-music - audio-classification - audio-to-audio tags: - midi - music - audio-features - million-song-dataset - data-vault configs: - config_name: mart_artist_profile_sample data_files: - "gold_lakh_midi/mart_artist_profile_sample.parquet" - config_name: mart_track_analytics_sample data_files: - "gold_lakh_midi/mart_track_analytics_sample.parquet" - config_name: mart_musical_features_sample data_files: - "gold_lakh_midi/mart_musical_features_sample.parquet" - config_name: hub_artist data_files: - "silver_lakh_midi/hub_artist.parquet" - config_name: hub_key_signature data_files: - "silver_lakh_midi/hub_key_signature.parquet" - config_name: hub_midi_file data_files: - "silver_lakh_midi/hub_midi_file.parquet" - config_name: hub_midi_source data_files: - "silver_lakh_midi/hub_midi_source.parquet" - config_name: hub_mode data_files: - "silver_lakh_midi/hub_mode.parquet" - config_name: hub_release data_files: - "silver_lakh_midi/hub_release.parquet" - config_name: hub_track data_files: - "silver_lakh_midi/hub_track.parquet" - config_name: link_artist_similar data_files: - "silver_lakh_midi/link_artist_similar.parquet" - config_name: link_midi_source data_files: - "silver_lakh_midi/link_midi_source.parquet" - config_name: link_track_artist data_files: - "silver_lakh_midi/link_track_artist.parquet" - config_name: link_track_midi data_files: - "silver_lakh_midi/link_track_midi.parquet" - config_name: link_track_release data_files: - "silver_lakh_midi/link_track_release.parquet" - config_name: sat_artist data_files: - "silver_lakh_midi/sat_artist.parquet" - config_name: sat_artist_mbtags data_files: - "silver_lakh_midi/sat_artist_mbtags.parquet" - config_name: sat_artist_similarity data_files: - "silver_lakh_midi/sat_artist_similarity.parquet" - config_name: sat_artist_terms data_files: - "silver_lakh_midi/sat_artist_terms.parquet" - config_name: sat_key_signature data_files: - "silver_lakh_midi/sat_key_signature.parquet" - config_name: sat_match_scores data_files: - "silver_lakh_midi/sat_match_scores.parquet" - config_name: sat_midi_file data_files: - "silver_lakh_midi/sat_midi_file/**/*.parquet" - config_name: sat_mode data_files: - "silver_lakh_midi/sat_mode.parquet" - config_name: sat_release data_files: - "silver_lakh_midi/sat_release.parquet" - config_name: sat_track data_files: - "silver_lakh_midi/sat_track/**/*.parquet" size_categories: - 100K [![Code](https://img.shields.io/badge/Code-GitHub-blue?logo=github)](https://github.com/Nintorac/ntrc_lmd) [![Data](https://img.shields.io/badge/Data-Repository-green?logo=database)](https://huggingface.co/datasets/nintorac/ntrc_lmd_data) [![Docs](https://img.shields.io/badge/Docs-Website-orange?logo=book)](https://ntrc-lmd.nintoracaudio.dev) > [!NOTE] > Check out the tables prefixed with `mart_*` to get started for some easy to understand and interesting data This dataset contains an opionated, structured and lightly cleaned release of the [Lakh MIDI Dataset](https://colinraffel.com/projects/lmd/) by Colin Raffel, transformed using modern data engineering practices into a Data Vault 2.0 model. ## Dataset Description The original Lakh MIDI Dataset is a collection of 176,581 unique MIDI files, 45,129 of which have been matched and aligned to entries in the Million Song Dataset. This processed version transforms the raw data into a structured format suitable for music information retrieval research and analysis. **Key ideas in this release:** - **Structured Data Vault 2.0 model** with hubs, links, and satellites - **Bronze layer** with raw extracted data in Parquet format (not part of this distribution, see https://github.com/Nintorac/ntrc_lmd to build it) - **Silver layer** with cleaned, deduplicated, and structured data - **Gold layer** with clean derormalized views ready for ML pipelines and other downstream usecases ## Usage Examples ### Connecting to the Remote Database You can attach to the remote Lakh MIDI database using DuckDB and query the processed data directly: ```sql -- Attach the remote database ATTACH 'hf://datasets/nintorac/ntrc_lakh_midi/lakh_remote.duckdb' AS lakh_remote; -- Sample the artist profile mart table CREATE TABLE my_artist_sample AS SELECT * FROM lakh_remote.mart_artist_profile WHERE artist_profile_tier = 'High Profile' LIMIT 100; -- Query the sample SELECT artist_name, total_tracks, avg_tempo, most_common_key, top_terms[1:3] as top_3_terms FROM my_artist_sample ORDER BY total_tracks DESC; ``` This approach allows you to fetch data from the gold layer, without having to manage the full silver layer locally. It's pretty slow though so it would be best to follow the above pattern to save a table locally before running analysis. ## Data Structure To understand the schema of the silver layer check out the [schema_silver.dbml](https://github.com/Nintorac/ntrc_lmd/blob/main/schema_silver.dbml) - load it in [dbdiagram.io](https://dbdiagram.io/d) for an interactive view. Below is a high level overview of how the tables fit together. ![high level silver schema diagram](assets/ntrc_lakh_schema_silver.png) ### Silver Layer (`silver_lakh_midi/`) Structured using Data Vault 2.0 methodology: #### Hubs (Business Entities) - **`hub_track.parquet`** - MusicBrainz tracks - **`hub_artist.parquet`** - Artists (including similar artists) - **`hub_release.parquet`** - 7digital releases - **`hub_midi_file.parquet`** - MIDI files by MD5 hash - **`hub_midi_source.parquet`** - Source file paths - **`hub_key_signature.parquet`** - Musical key signatures (0-11) - **`hub_mode.parquet`** - Musical modes (0=minor, 1=major) #### Links (Relationships) - **`link_track_midi.parquet`** - Track-to-MIDI matches - **`link_track_artist.parquet`** - Track-to-artist relationships - **`link_track_release.parquet`** - Track-to-release relationships - **`link_artist_similar.parquet`** - Artist similarity relationships - **`link_midi_source.parquet`** - MIDI-to-source path mappings #### Satellites (Descriptive Data) - **`sat_track/`** - Track details, audio analysis, and time-series arrays (partitioned) - **`sat_artist.parquet`** - Artist metadata and location info - **`sat_release.parquet`** - Release information - **`sat_midi_file/`** - MIDI file content and size (partitioned) - **`sat_match_scores.parquet`** - Match quality scores - **`sat_artist_similarity.parquet`** - Similarity rankings - **`sat_artist_terms.parquet`** - Echo Nest artist terms - **`sat_artist_mbtags.parquet`** - MusicBrainz tags - **`sat_key_signature.parquet`** - Human-readable key signature names - **`sat_mode.parquet`** - Human-readable mode names ## Data Quality Features - **Deduplication**: Consistent handling of duplicate entities - **Referential Integrity**: All foreign keys reference valid parents - **Partitioned Storage**: Large tables partitioned by hash key prefix for scalable processing - **Comprehensive Testing**: Data quality tests ensure consistency and completeness ## Technical Details - **Format**: Apache Parquet with snappy compression - **Schema**: Data Vault 2.0 with hash keys for scalable joins - **Processing**: Built with dlt, dbt, and DuckDB - **Partitioning**: Large tables partitioned by first character of hash keys (0-9, a-f) ## Original Dataset Information This processed dataset is based on the Lakh MIDI Dataset, which contains: - **176,581 unique MIDI files** from LMD-full - **45,129 matched files** aligned to Million Song Dataset entries - **Audio analysis features** from Echo Nest - **Artist metadata** including MusicBrainz tags and similarity data ## Citations & License ### License This dataset is distributed under the [CC-BY 4.0](http://creativecommons.org/licenses/by/4.0/) license, following the original Lakh MIDI Dataset license. ### Required Citations If you use this dataset, please cite the original Lakh MIDI Dataset: ```bibtex @phdthesis{raffel2016learning, title={Learning-Based Methods for Comparing Sequences, with Applications to Audio-to-MIDI Alignment and Matching}, author={Raffel, Colin}, year={2016}, school={Columbia University} } ``` For the Million Song Dataset metadata, please also cite: ```bibtex @inproceedings{bertin2011million, title={The Million Song Dataset}, author={Bertin-Mahieux, Thierry and Ellis, Daniel PW and Whitman, Brian and Lamere, Paul}, booktitle={Proceedings of the 12th International Society for Music Information Retrieval Conference}, pages={591--596}, year={2011} } ``` ### Attribution Note The original MIDI files were scraped from publicly-available sources on the internet and de-duplicated by Colin Raffel. While MIDI files have a built-in mechanism for attribution (the Copyright meta-event), it is not used consistently, so attributing each individual MIDI file to a particular author is not feasible. ## Processing Pipeline This dataset was processed using: - **dlt** for data extraction from unstructured files - **dbt** for data transformation and testing - **DuckDB** as the analytics database engine - **Data Vault 2.0 methodology** for scalable data modeling For more information about the processing pipeline, see the [project repository](https://github.com/nintorac/ntrc_lmd). ## Resources - [Colin Raffel's project page](https://colinraffel.com/projects/lmd/). - [Million Song Dataset](http://millionsongdataset.com/) - [Echo Nest Schema](https://developer.spotify.com/documentation/web-api/reference/get-audio-analysis)