Programming Sounds and Tones with MicroPython

Programming Sounds and Tones with MicroPython

2019-06-21T10:26:01+09:00 Jun 21, 2019|Tinker Stories|0 Comments

Python + Micro:Bit = MicroPython !!!

 

This term in Tinker Education’s intensive coding class, students are using Python Programming Language and Micro:Bit physical computing for invention.

 

Last Saturday’s mission asked students to ‘make music using the micro:Bit’.

 

The idea that you can use code to generate sound is easy and fun.

 

Resources:

  1. Speakers
  2. Laptop
  3. Micro:Bit module
  4. Micro:Bit System installed on the computers
  5. Python Programming Language.

 

Step 1: Connecting the speaker.

With the use of crocodile clips, students attached pin 0 and GND to the positive and negative inputs on the speaker – it doesn’t matter which way round they are connected to the speaker.

 

Step 2: Import Music.

The students started to code by first importing music using the music module on Microbit (see screenshot below). This module contains methods used to make and control sound.

 

Step 3: Creating own Tunes

In the students screenshot below, he has used the range function to generate a range of numeric values which define the pitch and the tone.

 

Step 4: Listening to your sound.
Because everyone has a different taste in  music, each student chose different types of melodies. Some chose Blues, Wedding, Birthday etc. The fun part was listening in on the speaker to hear the melodies they were able to create on their own.

 

Leave A Comment