Exercise 11.1 - Guitar Strings 1 2 3  

This tutorial details several extended features in Manhattan, including a built-in physical guitar model, parallel playback threads, and anonymous (lambda) functions. There concepts are explored in the context of the 2003 hit, Hey Ya, by hip-hop duo OutKast.
  In the first part, we look at an alternative to sample synthesis: physical modelling (or "virtual acoustic" synthesis). Rather than using recordings of real instruments, this approach seeks to faithfully simulate the energies and vibrations within the acoustic instrument, using a virtual model of its physics. A faithful physical model should not only sound, but also behave like the original, permitting all the same expressive possibilities and playing styles - unlike samples, which only reproduce what was recorded.
  Manhattan supports up to two physically-modelled guitars (GX and GY), each of which can be configured to simulate a variety of different acoustic and electric guitar types, including classical, flamenco, nylon and steel hollow bodies (as well as banjos, mandolines, etc.) and numerous solid-body electric guitars with additional pedals and effects processing. We will use one to play the piece's chord sequence, strummed on acoustic (rhythm) guitar.

Start by strumming the virtual guitar:

Exercise 11.2 - Chords and Chorus 1 2 3  

The chord sequence for Hey Ya is provided in the  Chords  array, below the  Strum  pattern. Unlike previous examples, it runs left to right (rather than a vertical list). Each chord contains the pitches for the six strings, in rows 0 to 5 of the array.

Strum the chord sequence:

Add the chorus motif using the play() function:

Exercise 11.3 - Lambda Functions 1 2 3  

Sometimes we want to run a specific code expression over a range of cells, but don't want to litter all the cells with copies of the code, nor multiple run() statements or macro effects. Manhattan supports an advanced programming concept that allows you to create an anonymous function, called a lambda function - and run it over a range of cells.
  To demonstrate the syntax, we'll use a simple example that runs a formula to slightly randomise all the volume entries in our strummed guitar part, adding a touch of human 'error' to the performance.

Randomise volumes using a lambda function:

Lambda functions are simple and extremely powerful, capable of quickly applying changes over broad areas of the music. They can be used to search, replace, increment, or randomise values, to calculate number sequences or iterate over cells, or even affect playback actions by triggering multiple play() or loop() commands - anything a single cell or function can do, but on a larger scale.