❮❮ ❯❯  00:00:00:00
LEGEND   PersonSuitcaseTrainBicycle
CHAPTERS  (click to expand)
BOOKMARKS  (click to expand)
WORKSHOP GUIDANCE
  • All code for this exercise should be entered in the cell labelled  Update .
  • Rather than enter simple formulas for individual musical properties, we now want to enter blocks of code into the cell. Press Tab to switch between formula and block code editing.
  • Use the constrain() function to co-opt one set of pitches to conform to the pitch classes defined by another:

    constrain(@Range, @Palette)

  • Lambda functions allow you to iteratively apply simple expressions to a range of cells:

    @Array = f(".pitch = .pitch + 1")

    This specified expression, raising pitch by one semitone, is executed for every cell in @Array.
  • The order of operations is important. We want to restrict the pitch range of the @Notes array before we constain the pitches to our palette.
SOLUTIONS  (click to reveal)
▸ Constraining pitch

copy(@Persons, @Notes)
constrain(@Notes, @Chord, 1)

▸ Constricting pitch

copy(@Persons, @Notes)
@Notes = f(".pitch = C-4 + .pitch / 3")
constrain(@Notes, @Chord, 1)

▸ Dynamic Range Compression

copy(@Persons, @Notes)
@Notes = f(".pitch = C-4 + .pitch / 3")
@Notes = f(".volume = (@Persons +.volume) * 0.7")
constrain(@Notes, @Chord, 1)