Music for our ads, composed in Python

The soundtracks of our ads are written as code and rendered with a free soundfont.

Piano keys and a speaker with music notes that float up into the air

Royalty-free music libraries are fine, but we wanted music that fits our videos exactly. So we compose it in Python.

How it works

  • A Python script writes notes into a MIDI file: chords, bass, drums, a piano motif.
  • FluidSynth renders the MIDI with a free General MIDI soundfont.
  • The script stretches the song so that it ends on the final chord exactly when the video ends.

Why code?

The length of the video changes when the script changes. Music written as code can follow.

The sound

Simple and clean: a cinematic minor key for the premium ads, upbeat pop for the longer tour.

Levels

Voice first, music a fixed step below it, and one final gain for the whole mix. No pumping effects.

Guess the price of real Swedish homes

PricePinner is free on Android and iOS. It has no ads.

Get the app