{"id":50567899,"url":"https://github.com/rowan-m/tone-nets","last_synced_at":"2026-06-04T16:01:17.152Z","repository":{"id":356808377,"uuid":"1233968854","full_name":"rowan-m/tone-nets","owner":"rowan-m","description":"Analyse, visualise, and play MIDI files.","archived":false,"fork":false,"pushed_at":"2026-05-24T21:02:40.000Z","size":8027,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T22:25:08.306Z","etag":null,"topics":["midi","threejs","tonejs","visualization","web"],"latest_commit_sha":null,"homepage":"https://tone-nets.web.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rowan-m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-09T15:23:43.000Z","updated_at":"2026-05-24T21:02:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rowan-m/tone-nets","commit_stats":null,"previous_names":["rowan-m/tone-nets"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rowan-m/tone-nets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowan-m%2Ftone-nets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowan-m%2Ftone-nets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowan-m%2Ftone-nets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowan-m%2Ftone-nets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rowan-m","download_url":"https://codeload.github.com/rowan-m/tone-nets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowan-m%2Ftone-nets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33912343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["midi","threejs","tonejs","visualization","web"],"created_at":"2026-06-04T16:01:15.725Z","updated_at":"2026-06-04T16:01:17.146Z","avatar_url":"https://github.com/rowan-m.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tone Nets\n\nThe paper [\"Decoding the evolution of melodic and harmonic structure of Western music through the lens of network science\"](https://www.nature.com/articles/s41598-026-42872-7) analysed and visualised musical tracks to identify structural trends over a range of genres. This project is a web-based implementation inspired by the [original R-based visualisations](https://osf.io/ujre4/files/osfstorage).\n\n[Try 🎶 Tone Nets 🎶 now!](https://tone-nets.web.app/)\n\nThe application parses MIDI files to analyse note transitions and visualises the results as a 3D topological web.\n\n## Architecture\n\n1.  **Network Parsing \u0026 Analysis**\n    The application parses note-to-note transitions from MIDI data into a directed, weighted graph using `ngraph.graph`, where nodes represent pitch classes and edges represent transitions. Drums (Channel 10) are excluded. The application supports two operational modes:\n    - **Live Build Mode** (default): The network is constructed dynamically in real time as the music plays.\n    - **Static Mode**: The MIDI file is parsed upfront using `@tonejs/midi` in a background Web Worker (to keep the UI responsive). The worker calculates academic complexity metrics:\n        - **Efficiency**: Global (unweighted) and Weighted (via Dijkstra).\n        - **Reciprocity**: Binary, Weighted, and Normalized ($\\rho$).\n        - **Entropy**: Mean Node Entropy.\n        - **Scale-interval Embedding**: A 12D interval signature of directed pitch class intervals.\n\n2.  **3D Visualization**\n    The graph is rendered in 3D using `three` (Three.js) with `TrackballControls` for user interaction. A 3D force-directed layout is calculated by `ngraph.forcelayout` using a spring-physics simulation. To keep layout components cohesive, isolated nodes are pulled toward the main component's hubs via temporary anchor links. Visual features include:\n    - Quadratic Bezier edges with directional cones.\n    - Pitch-class based node coloring (HSL).\n    - Dynamic visual themes (including a high-reflection `terminator` theme with metallic shaders and a custom fire/plasma background).\n    - Floating instrument emojis above active nodes using `THREE.Sprite`.\n    - Post-processing bloom effects via the `postprocessing` library.\n    - Interactive metadata display and highlighting via `THREE.Raycaster`.\n\n3.  **Audio Playback \u0026 Keep-Alive**\n    Playback is managed by `tone` (Tone.js) and `spessasynth_lib` for high-quality SoundFont synthesis. To ensure audio is never suspended when the application is backgrounded or on mobile:\n    - Audio is routed to a `MediaStreamDestination` and an unmuted, playsinline `\u003caudio\u003e` element on mobile, and supported by a silent keep-alive MP3 loop on desktop.\n    - Live playback highlights and instrument emojis are synced in real time.\n    - Full `MediaSession` API integration synchronizes metadata and lock-screen controls.\n\n## Develop\n\nTo run this project locally:\n\n```bash\nnpm ci\nnpm run dev\n```\n\n## Contribute\n\nBefore submitting a pull request, run the `check` tasks to validate formatting, quality issues, tests, and the build:\n\n```bash\nnpm run check\n```\n\n## Attribution\n\nSample MIDI files included from Wikimedia Commons:\n\n- [Beethoven's Moonlight Sonata](https://commons.wikimedia.org/wiki/File:Beethoven_-_Moonlight_Sonata_1st_Movement.mid)\n- [Chopin's Funeral March](https://commons.wikimedia.org/wiki/File:Chopin_-_Funeral_March.mid)\n\n_Tone Nets sounds a bit like [Tonnetz](https://wikipedia.org/wiki/Tonnetz). Ha ha, so clever._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowan-m%2Ftone-nets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frowan-m%2Ftone-nets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowan-m%2Ftone-nets/lists"}