Play Music with the Finch

You have learned how to use the Finch’s sensors to control the robot’s motors and lights, as well as the movement of a sprite on the computer screen. In this project, you will make the Finch into a musical instrument!

You can use the play note and rest blocks  from the Sound menu to create music. The play note block requires two numbers. The number on the left determines the pitch of the note; it should be between 15 and 130. Instead of entering a number, you can also select a piano key on the pop-up menu. The number on the right determines the length of the note; it can be any positive number.

The rest block can be used to separate notes. During the rest, no sound is played. The number in the rest block is the length of the rest. It can be any positive number.

Use the play note and Finch buzz blocks, and replace the numbers in these blocks with the Finch sensor blocks. You will need to use math operator blocks to scale the sensor output to a number that is appropriate for sound block you are using. For example, the pitch of the note in the play note block must be between 30 and 130, but the value of an acceleration block is between -1.5 and 1.5. The value of the acceleration block is scaled by multiplying it by 10 and then adding 75 to obtain a number that will work for the play note block. A different scaling expression is used in the Finch buzz block.

Try out the sample code below and vary the scaling expressions to see what happens. Remember, you can see the value of an expression by clicking on it (you will need to remove it from the play note or Finch buzz block first). Then create your own program to make music with the Finch sensors!

Grades: 
Activity Level: