<commit_before>Guide to Programming with Music Blocks
======================================
  
Music Blocks is a programming environment for children interested in
music and graphics. It expands upon Turtle Blocks by adding a 
collection of features relating to pitch and rhythm.

The Turtle Blocks guide is a good place to start learning about the
basics. In this guide, we illustrate the musical features by walking the
reader through numerous examples.

<a name="TOC">
TABLE OF CONTENTS
----------------
</a>

1. [Getting Started](#GETTING-STARTED)
2. [Making a Sound](#NOTES)
  1. [Note Value Blocks](#NOTE-VALUE)
  2. [Pitch Blocks] (#PITCH)
  3. [Chords] (#CHORDS)
  4. [Rests] (#RESTS)
  5. [Drums] (#DRUMS)
3. [Programming with Music] (#PROGRAMMING-WITH-MUSIC)
  1. [Chunks] (#CHUNKS)
  2. [Musical Transformation] (#TRANSFORMATION)
    1. [Step Pitch Block] (#STEP-PITCH)
    2. [Sharps and Flats] (#SHARPS-AND-FLATS)
    3. [Adjust-Transposition Block] (#ADJUST-TRANSPOSITION)
    4. [Dotted Notes] (#DOTTED)
    5. [Speeding Up and Slowing Down Notes via Mathematical Operations] (#MULTIPLY-AND-DIVIDE)
    6. [Repeating Notes] (#REPETITION)
    7. [Swinging Notes and Tied Notes] (#SWINGING)
    8. [Set Volume, Crescendo, Staccato, and Slur Blocks] (#MORE-TRANSFORMATIONS)
    9. [Intervals and Articulation] (#INTERVALS-AND-ARTICULATION)
    10. [Absolute Intervals] (#ABSOLUTE-INTERVALS)
    11. [Inversion] (#INVERSION)
    12. [Backwards] (#BACKWARDS)
    13. [Setting Voice and Keys] (#SETTING)
  3. [Voices] (#VOICES)
  4. [Graphics] (#GRAPHICS)
  5. [Interactions] (#INTERACTIONS)
4. [Widgets] (#WIDGETS)
  1. [Monitoring status](#status)
  2. [Generating chunks of notes](#pitch-time)
    1. [Pitch-Time Matrix] (#pitch-time) 
    2. [The Rhythm Block] (#THE-RHYTHM-BLOCK) 
    3. [Creating Tuplets] (#CREATING-TUPLETS)
    4. [Using Individual Notes in the Matrix] (#INDIVIDUAL-NOTES)
  3. [Generating rhythms](#rhythms)
  4. [Musical Modes](#modes)
  5. [The Pitch-Drum Matrix](#pitch-drum)
  6. [Exploring musical proportions](#stairs)
  7. [Generating arbitrary pitches](#slider)
  8. [Changing tempo](#tempo)
5. [Beyond Music Blocks] (#BEYOND-MUSIC-BLOCKS)

Many of the examples given in the guide have links to code you can
run. Look for RUN LIVE links.


<a name="GETTING-STARTED">
1. GETTING STARTED                                                     
---------------
</a>
[Back to Table of Contents](#TOC) | [Next Section (2. Making a sound)](#NOTES)

Music Blocks is designed to run in a browser. Most of the development
has been done in Chrome, but it should also work in Firefox (although
you may need to disable hardware acceleration). You can run it from
[github io](http://walterbender.github.io/musicblocks) or by
downloading a copy of the code and running a local copy directly from
the file system of your computer.

For more details on how to use Music Blocks, see [Using Music
Blocks](http://github.com/walterbender/musicblocks/tree/master/documentation).
For more details on how to use Turtle Blocks, see [Using Turtle
Blocks
JS](http://github.com/walterbender/turtleblocksjs/tree/master/documentation).

<a name="NOTES">
2. MAKING A SOUND
--------------------
</a>
[Previous Section (1. Getting Started)](#GETTING-STARTED) | [Back to Table of Contents](#TOC) | [Next Section (3. Programming with Music)](#PROGRAMMING-WITH-MUSIC)

Music Blocks incorporates many common elements of music, such as [pitch](#PITCH), [rhythm](#rhythms), [volume](#MORE-TRANSFORMATIONS),
and, to some degree, [timbre and texture](#VOICES).
<a name="NOTE-VALUE">
### 2.1 Note Value Blocks
</a>

At the heart of Music Blocks is the *Note value* block. The *Note
value* block is a container for a [pitch block](#PITCH) that specifies the duration
(note value) of the pitch. 

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note1.svg'</img>

At the top of the example above, a single (detached) *Note value* block is
shown. The `1/8` is value of the note, which is, in this case, an eighth note. 

At the bottom, two notes that are played consecutively are
shown. They are both `1/8` notes, making the duration of the entire sequence `1/4`. 

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note2.svg'</img>

In this example, different note values are shown. From top to bottom, they are: 
`1/4` for an quarter note, `1/16` for a sixteenth note, and `1/2` for a half
note.

Note that any mathematical operations can be used as input to the *Note value*.

<a name="PITCH">
### 2.2 Pitch Blocks
</a>

As we have seen, *Pitch* blocks are used inside the [*Note value*] (#NOTE-VALUE)
blocks. The *Pitch* block specifies the pitch name and pitch octave of a note
that in combination determines the frequency (and therefore pitch) at which the note is played.

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note3.svg'</img>

There are many systems you can use to specify a *pitch* block's name and octave. Some examples are
shown above. The top pitch block is specified using a *Solfege* block (`Sol` in `Octave 6`), which contains
the notes `Do Re Me Fa Sol La Ti `. The middle block is specified using a *Pitch-name* block (`B flat` in `Octave 4`),
which contains the notes `C D E F G A B`. The last block is specified using the *Hertz* block in conjunction
with a *Number* block (`440` Hertz) , which corresponds to the frequency of the sound made.

The octave is specified using a number block and is restricted to
whole numbers. In the case where the pitch name is specified by
frequency, the octave is ignored.

Note that the pitch name can also be specified using a *Text* block. 

<img src='https://rawgithub.com/walterbender/musicblocks/guide/Keyboard%Chart.svg'</img>
Please refer to the above picture for
a visual representation of where a certain note is located in a keyboard or staff.

<a name="CHORDS">
### 2.3 Chords
</a>
<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note4.svg'</img>

A chord (multiple, simultaneous pitches) can be specified by adding
multiple *Pitch* blocks into a single *Note value* block, like the above example.

<a name="RESTS">
### 2.4 Rests
</a>

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/silence.svg'</img>

A rest of the specified note value duration can be constructed using a *Silence* block in place of a *pitch* block.

<a name="DRUMS">
### 2.5 Drums
</a>

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/drum1.svg'</img>

Anywhere  a *Pitch* block can be used&mdash;e.g., inside of the matrix or a
*Note value* block&mdash;a *Drum Sample* block can also be used instead. Currently there<commit_msg>Updated link<commit_after>Guide to Programming with Music Blocks
======================================
  
Music Blocks is a programming environment for children interested in
music and graphics. It expands upon Turtle Blocks by adding a 
collection of features relating to pitch and rhythm.

The Turtle Blocks guide is a good place to start learning about the
basics. In this guide, we illustrate the musical features by walking the
reader through numerous examples.

<a name="TOC">
TABLE OF CONTENTS
----------------
</a>

1. [Getting Started](#GETTING-STARTED)
2. [Making a Sound](#NOTES)
  1. [Note Value Blocks](#NOTE-VALUE)
  2. [Pitch Blocks] (#PITCH)
  3. [Chords] (#CHORDS)
  4. [Rests] (#RESTS)
  5. [Drums] (#DRUMS)
3. [Programming with Music] (#PROGRAMMING-WITH-MUSIC)
  1. [Chunks] (#CHUNKS)
  2. [Musical Transformation] (#TRANSFORMATION)
    1. [Step Pitch Block] (#STEP-PITCH)
    2. [Sharps and Flats] (#SHARPS-AND-FLATS)
    3. [Adjust-Transposition Block] (#ADJUST-TRANSPOSITION)
    4. [Dotted Notes] (#DOTTED)
    5. [Speeding Up and Slowing Down Notes via Mathematical Operations] (#MULTIPLY-AND-DIVIDE)
    6. [Repeating Notes] (#REPETITION)
    7. [Swinging Notes and Tied Notes] (#SWINGING)
    8. [Set Volume, Crescendo, Staccato, and Slur Blocks] (#MORE-TRANSFORMATIONS)
    9. [Intervals and Articulation] (#INTERVALS-AND-ARTICULATION)
    10. [Absolute Intervals] (#ABSOLUTE-INTERVALS)
    11. [Inversion] (#INVERSION)
    12. [Backwards] (#BACKWARDS)
    13. [Setting Voice and Keys] (#SETTING)
  3. [Voices] (#VOICES)
  4. [Graphics] (#GRAPHICS)
  5. [Interactions] (#INTERACTIONS)
4. [Widgets] (#WIDGETS)
  1. [Monitoring status](#status)
  2. [Generating chunks of notes](#pitch-time)
    1. [Pitch-Time Matrix] (#pitch-time) 
    2. [The Rhythm Block] (#THE-RHYTHM-BLOCK) 
    3. [Creating Tuplets] (#CREATING-TUPLETS)
    4. [Using Individual Notes in the Matrix] (#INDIVIDUAL-NOTES)
  3. [Generating rhythms](#rhythms)
  4. [Musical Modes](#modes)
  5. [The Pitch-Drum Matrix](#pitch-drum)
  6. [Exploring musical proportions](#stairs)
  7. [Generating arbitrary pitches](#slider)
  8. [Changing tempo](#tempo)
5. [Beyond Music Blocks] (#BEYOND-MUSIC-BLOCKS)

Many of the examples given in the guide have links to code you can
run. Look for RUN LIVE links.


<a name="GETTING-STARTED">
1. GETTING STARTED                                                     
---------------
</a>
[Back to Table of Contents](#TOC) | [Next Section (2. Making a sound)](#NOTES)

Music Blocks is designed to run in a browser. Most of the development
has been done in Chrome, but it should also work in Firefox (although
you may need to disable hardware acceleration). You can run it from
[github io](http://walterbender.github.io/musicblocks) or by
downloading a copy of the code and running a local copy directly from
the file system of your computer.

For more details on how to use Music Blocks, see [Using Music
Blocks](http://github.com/walterbender/musicblocks/tree/master/documentation).
For more details on how to use Turtle Blocks, see [Using Turtle
Blocks
JS](http://github.com/walterbender/turtleblocksjs/tree/master/documentation).

<a name="NOTES">
2. MAKING A SOUND
--------------------
</a>
[Previous Section (1. Getting Started)](#GETTING-STARTED) | [Back to Table of Contents](#TOC) | [Next Section (3. Programming with Music)](#PROGRAMMING-WITH-MUSIC)

Music Blocks incorporates many common elements of music, such as [pitch](#PITCH), [rhythm](#rhythms), [volume](#MORE-TRANSFORMATIONS),
and, to some degree, [timbre and texture](#VOICES).
<a name="NOTE-VALUE">
### 2.1 Note Value Blocks
</a>

At the heart of Music Blocks is the *Note value* block. The *Note
value* block is a container for a [pitch block](#PITCH) that specifies the duration
(note value) of the pitch. 

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note1.svg'</img>

At the top of the example above, a single (detached) *Note value* block is
shown. The `1/8` is value of the note, which is, in this case, an eighth note. 

At the bottom, two notes that are played consecutively are
shown. They are both `1/8` notes, making the duration of the entire sequence `1/4`. 

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note2.svg'</img>

In this example, different note values are shown. From top to bottom, they are: 
`1/4` for an quarter note, `1/16` for a sixteenth note, and `1/2` for a half
note.

Note that any mathematical operations can be used as input to the *Note value*.

<a name="PITCH">
### 2.2 Pitch Blocks
</a>

As we have seen, *Pitch* blocks are used inside the [*Note value*] (#NOTE-VALUE)
blocks. The *Pitch* block specifies the pitch name and pitch octave of a note
that in combination determines the frequency (and therefore pitch) at which the note is played.

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note3.svg'</img>

There are many systems you can use to specify a *pitch* block's name and octave. Some examples are
shown above. The top pitch block is specified using a *Solfege* block (`Sol` in `Octave 6`), which contains
the notes `Do Re Me Fa Sol La Ti `. The middle block is specified using a *Pitch-name* block (`B flat` in `Octave 4`),
which contains the notes `C D E F G A B`. The last block is specified using the *Hertz* block in conjunction
with a *Number* block (`440` Hertz) , which corresponds to the frequency of the sound made.

The octave is specified using a number block and is restricted to
whole numbers. In the case where the pitch name is specified by
frequency, the octave is ignored.

Note that the pitch name can also be specified using a *Text* block. 

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/Keyboard%20Chart.svg'</img>
Please refer to the above picture for
a visual representation of where a certain note is located in a keyboard or staff.

<a name="CHORDS">
### 2.3 Chords
</a>
<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/note4.svg'</img>

A chord (multiple, simultaneous pitches) can be specified by adding
multiple *Pitch* blocks into a single *Note value* block, like the above example.

<a name="RESTS">
### 2.4 Rests
</a>

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/silence.svg'</img>

A rest of the specified note value duration can be constructed using a *Silence* block in place of a *pitch* block.

<a name="DRUMS">
### 2.5 Drums
</a>

<img src='https://rawgithub.com/walterbender/musicblocks/master/guide/drum1.svg'</img>

Anywhere  a *Pitch* block can be used&mdash;e.g., inside of the matrix or a
*Note value* block&mdash;a *Drum Sample* block can also be used instead. Currently there
{'fraction_non_alphanumeric': 0.12472044132995377, 'fraction_numerical': 0.012375130460712688, 'mean_word_length': 3.9851356373095506, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 49, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4690160', 'n_tokens_mistral': 4542, 'n_tokens_neox': 4180, 'n_words': 1708}