Sounds of Structure - Music Modelling with ADT's
summary
Shows a working music sequencer built in Scala using algebraic data types and structural recursion, outputting audio via Scala.js + Tone.js (Web Audio). Models notes, rests, melodies, harmony and drums with sealed ADTs, replaces raw velocity with a custom type that maps 128 MIDI values into eight buckets, and uses builder methods to form a readable DSL. Live demo assembles multivoice songs from four voice samples, plays arranged bass/drums/piano and exposes where the JS wrapper caused runtime mismatches.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:09Talk outline
- 2:12From musician to developer
- 5:44Live demo setup
- 8:17Algebraic data types
- 10:01ADTs for music basics
- 11:46Evolving note structure
- 14:15Type safety with velocity
- 18:53Discretized velocity solution
- 21:00Structural recursion
- 24:53Benefits of ADTs and structural recursion
- 25:56ADT music challenges
- 27:00Music DSL with builders
- 30:53Song structure definition
- 32:19Complete song playback
- 33:40Live demo: rock song
- 41:16Summary
related talks
45mSongwriting in Scala: Creating a DSL for writing Music with ADT's
32mScala, Sound, and Structure - Composing Music through FP
27mScala Sampler for Functional Soundscapes
27mScala Sampler for Functional Soundscapes
19mComposing music with composed functions
39mBecome a Developer of Electronic Music
37mHow to code music?
25mDemo: Composable Compositions in Tonart
