Functional Composition • Chris Ford • YOW! 2018

Learn how musical composition maps to functional programming concepts through mathematical patterns, pure transformations, and domain modeling of sound and musical structure

Key takeaways
  • Music can be represented computationally through functional programming, treating musical elements as pure data structures and transformations

  • Canons are musical pieces built through functional composition - taking a melody and applying transformations like delays, mirrors, and intervals

  • Sound waves work through frequency (pitch) and amplitude (volume), with realistic instruments combining multiple harmonics rather than pure sine waves

  • Musical scales and keys can be modeled as functions that transform relative positions into actual frequencies/pitches

  • Version control and functional programming allow for cumulative development of musical pieces while maintaining pure transformations

  • Western music notation is optimized for human performance but can obscure underlying mathematical and computational patterns

  • Musical structures like swing rhythm and blues scales can be represented through mathematical transformations of timing and pitch

  • The psychology of sound processing means listeners reconstruct meaning from signals based on cultural context and learned patterns

  • Domain-specific abstractions in code can help express musical concepts more naturally while maintaining flexibility

  • Bach’s Canone alla Quarta demonstrates how complex musical structures emerge from combining simple transformations like mirroring, delay, and pitch shifts