-- Shepard tone (https://en.wikipedia.org/wiki/Shepard_tone#Construction)
-- TODO: begin one still hearable, bad fadein?
do
setcps 0.3
d1
  $ (>| "cyclo")
  $ (# legato 4)
  $ (# octave 1)
  $ (# accelerate ("16")) -- INTENSIFIES
  $ (|* gain 0.65)
  $ superimpose (const $ "s" # note (scale "major" 7) # gain (range 1 0 saw))
  $ superimpose (const $ "s" # note (scale "major" (-7)) # gain (range 0 1 saw))
  $ sometimesBy "1 0" (# gain (range 0 0.5 saw))
  $ sometimesBy "0 1" (# gain (range 1 0.5 isaw))
  $ "s"

-- Shepard corrected 12 tones, but still begin
do
setcps 0.3
d1
  $ (>| "cyclo")
  $ (|* gain 0.45)
  $ (# legato 4)
  $ (# octave 1)
  $ (# accelerate 3) -- INTENSIFIES
  $ superimpose (const $ "s" # note (12)
  # gain ("11 10 9 8 7 6 5 4 3 2 1 0"/11))
  $ superimpose (const $ "s" # note ((-12))
  # gain (range 0 1 $ "0 1 2 3 4 5 6 7 8 9 10 11"/11))
  $ sometimesBy "1 0" (# gain (range 0 0.5 saw))
  $ sometimesBy "0 1" (# gain (range 1 0.5 isaw))
  $ "s"
  # gain 0.5
