synthTest Instructions

# Instructions for synthTest

(produced at 21:24 on 2021-08-28)

You must write a function called `arpeggio` which adds a 5-note arpeggio to the current track. It has two parameters: a base pitch, and a duration. Each added note will use the provided duration, and the first and last notes will use the provided base pitch. The second and fourth notes will be three half-steps above the base pitch, while the third note will be seven half-steps above the base pitch.

An example of correct behavior

Note that to set up expectations for arpeggio, you can use the `printTrack` function to print descriptions of each note in the current track, and so you can use `captureOutput` along with `expectOutputContains` to test for the presence of certain notes or note sequences. Here is an example of this expectation setup. Your tests do not have to specify every note that should be present, although they may if you wish. You will need to create at lest two expectations for track descriptions in this manner.

## Examples

Examples for `arpeggio`

Some examples of correct results for `arpeggio`:

    In []:arpeggio(C4, 0.5)
    printTrack()

    Printsa 0.5s keyboard note at C4 (60% vol)
    and a 0.5s keyboard note at E4 (60% vol)
    and a 0.5s keyboard note at G4 (60% vol)
    and a 0.5s keyboard note at E4 (60% vol)
    and a 0.5s keyboard note at C4 (60% vol)

    Audio
    (Your browser does not support the audio element. Use this link to download the file and play it using a media player: download audio)
    In []:arpeggio(A4, 0.2)
    printTrack()

    Printsa 0.2s keyboard note at A4 (60% vol)
    and a 0.2s keyboard note at Db5 (60% vol)
    and a 0.2s keyboard note at E5 (60% vol)
    and a 0.2s keyboard note at Db5 (60% vol)
    and a 0.2s keyboard note at A4 (60% vol)

    Audio
    (Your browser does not support the audio element. Use this link to download the file and play it using a media player: download audio)
    In []:arpeggio(G5, 0.3)
    printTrack()

    Printsa 0.3s keyboard note at G5 (60% vol)
    and a 0.3s keyboard note at B5 (60% vol)
    and a 0.3s keyboard note at D6 (60% vol)
    and a 0.3s keyboard note at B5 (60% vol)
    and a 0.3s keyboard note at G5 (60% vol)

    Audio
    (Your browser does not support the audio element. Use this link to download the file and play it using a media player: download audio)

How to set up expectations

Here's a example of how to set up expectations for `wavesynth` notes using `captureOutput` along with `printTrack`.

    In []:from wavesynth import *

    # Here's some code that creates notes
    setPitch(C4)
    addNote(0.2)
    stepUp()
    addNote(0.3)

    # This isn't necessary, but we print the track first so you can see what
    # the expectations are dealing with
    printTrack()

    import optimism as opt

    # Use captureOutput to set up a test case for the printTrack output
    opt.captureOutput()
    opt.testCase(printTrack())
    opt.expectOutputContains("a 0.2s keyboard note at C4")
    opt.expectOutputContains("and a 0.3s keyboard note at D4")
    # Note: our expectations don't constrain the volume level, but they could

    Printsa 0.2s keyboard note at C4 (60% vol)
    and a 0.3s keyboard note at D4 (60% vol)

    Logs✓ <soln>/arpeggio.py:18
    ✓ <soln>/arpeggio.py:19
    Out[]:True

    Audio
    (Your browser does not support the audio element. Use this link to download the file and play it using a media player: download audio)

## Rubric

unknown Style Requirements
How your code is written.
unknown Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
unknown All functions are documented
Each function you define must include a non-empty documentation string as the very first thing in the function.
unknown Procedure Requirements
What code you use to solve the problem.
unknown Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
unknown Define `arpeggio` with 2 arguments
Use `def` to define `arpeggio` with 2 arguments
unknown Call `addNote`
Within the definition of `arpeggio` with 2 arguments, call `addNote` in exactly 5 places.
unknown Testing Requirements
What tests you define for your code and their results.
unknown Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
unknown Defines required expectations
Your code must use the `optimism` module to establish a certain number of test cases which use the following functions directly in the test case expression. (Each test case must be followed by at least one expectation):

- `printTrack`: 2 test cases

unknown Extra goals
Complete all extra goals in addition to the core goals for a perfect score.
unknown All defined expectations were met
Every expectation that your code establishes using the `optimism` module must be met, and it must establish at least one expectation.
unknown Other Requirements
Requirements that don't fall into any other category.
unknown Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
unknown `arpeggio` creates the correct note sequence
We will check the timing, duration, and pitch of the notes that `arpeggio` adds to the current track and compare them against the notes produced by the solution.
unknown Extra goals
Complete all extra goals in addition to the core goals for a perfect score.
unknown `arpeggio` adds to the end of the track
We will check the notes produced by calling `arpeggio` twice; it should create two arpeggios which happen one after the other.