Now that we know what values of gravity we may want to try with the board, we need to figure out how many and which pitches we want from 1 G (The board tilted all the way forwards) to -1G (The board tilted all the way backwards).

In this project, I decided to make the pitches all in the C major scale or "key signature" however the beauty with programming is you may change the pitches to what ever key or crazy pattern you'd like.

The notes in the C major scale are quite simply all the white notes from C up to B. More about the C major scale and key signature here.

makecode_image.png
One octave on the piano. Source: the howtoreadmusic blog

Let's say we want 8 pitches, the notes C, D, E, F, G, A, B, then the high C.

With 8 pitches we will put 4 in the negative x direction (tilting back) and 4 in the positive x direction (tilting forward).

Rather than starting at -1000 mg for the low C I decided to start at -775mg because it gave more control and room to play without really having to twist my arm to play the lowest or highest notes.

Starting at -775mg for the low C and ending at 775mg for the high C will be the range we will program all the other pitches in between. Each pitch will have a range of 225mg.

With that said let's map out the logic for when we want each pitch to be played:

Tilted backward:

  • Low C will be played when acceleration in the x direction is less than -775mg (Tilted all the way backward)
  • Low D will be played when acceleration in the x direction is greater than -775mg but less than -550mg
  • Low E will be played when acceleration in the x direction is greater than -550mg but less than -225mg
  • Low F will be played when acceleration in the x direction is greater than -225mg but less than 0mg

Tilted forward:

  • Low G will be played when acceleration in the x direction is greater than 0mg but less than 225mg
  • Low A will be played when acceleration in the x direction is greater than 225mg but less than 550mg
  • Low B will be played when acceleration in the x direction is greater than 550mg but less than 775mg
  • High C will be played acceleration in the x direction is more than 775mg (Tilted all the way forward)

This guide was first published on Apr 11, 2018. It was last updated on Mar 08, 2024.

This page (Mapping Gravity to Pitches) was last updated on Mar 08, 2024.

Text editor powered by tinymce.