Time to look at musical scales. Moving around scales can be especially fun with waveforms, so there's a lot of focus on that. It's a bit fiddly because as I explain in the video, you have to convert between decimal and whole numbers with e.g. floor <$>
.. I'm going to have to look at making that easier in Tidal. Anyway, here's the video:
- 0:00 - intro
- 0:48 - Using sets of samples that are ready-tuned in scales (e.g. arpy)
- 02:59 - Random notes in a scale
- 03:30 - Random variation around a melody
- 03:57 - Motivating the 'scale' function
- 04:24 - Using the 'scale' function
- 04:55 - Shifting time to get different random streams
- 05:48 - Listing the available scales with scaleList
- 06:48 - Using waveforms to move around a scale
- 10:35 - Working outside of the scope of a 'scale'
- 12:40 - Patterning the range of a waveform
- 13:47 - Patterning the scale that's used
- 14:10 - Adding rhythmic structure with 'struct'
- 15:50 - Adding / multiplying waveforms together to make new waveforms
- 17:50 - Using 'off' to add some canon structure
And the worksheet:
-- The 'arpy' folder contains sounds sampled using a pentatonic
-- 'ritusen' scale, starting with 'c'. In this scale there are five
-- notes per octave. So these are the same notes:
d1 $ n "0 5" # sound "arpy"
d2 $ n "0 12" # sound "superpiano"
-- Pentatonic scales like this are nice to work with because they all
-- sound good together. So if we add a random note to a melody, it
-- always sounds 'good':
d1 $ n ("0 [7 2] 3 2" |+ irand 3) # sound "arpy"
-- This isn't really the case on the usual twelve-tone "equal
-- temperament" (12-TET) scale:
d1 $ n ("0 [7 2] 3 2" |+ (irand 3)) # sound "superpiano"
-- 12-TET is the scale that pianos etc are normally tuned to in the west.
-- To use a different scale, we can use the "scale" function for converting
-- numbers from a different scale to 12-TET.
d1 $ n (scale "ritusen" $ "0 [7 2] 3 2" |+ (irand 3))
# sound "superpiano"
-- There's quite a few available:
scaleList
-- It's fun to use waveforms to pick notes from a scale. For example,
-- use a smooth sinewave to select notes from a minor scale:
d1 $ segment 16 $ n (scale "minor"
$ floor <$> (range 0 14 sine)
)
# sound "supersaw"
# legato 0.5
# lpf 1000 # lpq 0.1
-- Remember that waveforms don't have structure, so don't produce
-- events until you use something like 'segment', which in the example
-- above picks 16 notes per cycle.
-- There's also a complication that waveforms produce 'floating point'
-- decimal numbers, but scale only accepts 'integers' - whole numbers.
-- The 'floor <$>' bit converts from decimal to whole numbers. The
-- "range 0 14" bit converts from the usual range of 0 to 1 to the
-- given range of 0 to 14.
-- We can make this more exciting by patterning the range:
d1 $ segment 16 $ n (scale "minor"
$ floor <$> (range "<0 4 -8>" "<12 14 13 -13>" sine)
)
# sound "supersaw"
# legato 0.5
# lpf 1000 # lpq 0.1
-- And maybe even more exciting by using 'struct' to pattern the
-- rhythm using Euclidean syntax.. Taking the opportunity to pattern
-- the lpf (low pass filter) as well:
d1 $ struct "t(<9 7>,16)"
$ n (scale "minor"
$ floor <$> (range "<0 4 -8>" "<12 14 13 -13>" sine)
)
# sound "supersaw"
# legato 0.5
# lpf (range 400 5000 saw) # lpq 0.1
-- Using scales in this way allows us to play with movement while
-- still making tunes that make 'sense'. Here I add together
-- waveforms to create some longer-form movement:
d1 $ segment 16 $
n (scale "minor"
$ floor <$> (slow 2 $ (slow 2 sine + slow 3 cosine) * "<6 -3>"
)
)
# sound "supersaw"
# legato 0.5
# lpf (range 400 5000 saw) # lpq 0.1
-- Back with the struct:
d1 $ struct "t(<9 7>,16)" $
n (scale "minor"
$ floor <$> (slow 2 $ (slow 2 sine + slow 3 cosine) * "<6 -3>"
)
)
# sound "supersaw"
# legato 0.5
# lpf (range 400 5000 saw) # lpq 0.1
-- And with an 'off' going up an octave:
d1 $ off 0.25 (|+ n 12) $ struct "t(<9 7>,16)" $ segment 16 $
n (scale "minor"
$ floor <$> (slow 2 $ (slow 2 sine + slow 3 cosine) * "<6 -3>"
)
)
# sound "supersaw"
# legato 0.5
# lpf (range 400 5000 saw) # lpq 0.1
-- Note that in the above the 'off' is outside of the 'scale'
-- function, So we're back in 12-TET land, so add '12' to go up an
-- octave, rather than the number of notes in the minor scale (7)