HomeTurtlegraficsGPanelRobotics WebTigerPython |
Python - Online |
Deutsch English |
YOU LEARN HERE... |
how you can use the built-in speaker to play sounds, tone sequences and short melodies. Under additional material you can see how you can even connect headphones or speakers to the micro:bit to get better sound quality. |
SPEAKER (BUZZER) |
|
EXAMPLES |
Example 1: Play a tone sequence A table with tones and their frequencies can be found in the overlay window:
Example 2: Playing built-in melodies
Example 3: Playing melodies in musical notation The notation adheres to the following rules:
To compose a melody, write the notes in a list, for example in the following program for a major and subsequent minor chord.
Example 4: An acoustic position meter You can switch off the tone signal with the B button.
|
REMEMBER YOU... |
You must connect the headphones to the outputs labeled GND and P0. You play a sound with the frequency f with the command pitch(f, time). With play(song) you can play entire melodies, either as a tone sequence or in musical notation. |
TO SOLVE BY YOURSELF |
|
ADDITIONAL MATERIAL |
SETTING UP THE SOUND SYSTEM |
You can also connect headphones or a larger loudspeaker to the micro:bit You will need two cables with crocodile clips. Use the first cable (here yellow) to connect the GND pin to the rear part of the headphone plug. Use the second cable (here red) to connect pin 0 to the front part of the headphone plug. In order to hear the sound in both earcups, you must try to place the alligator clip so that it touches the two front parts of the plug. Now you can test all the previous examples with your sound system. |
REMEMBER... |
You must connect the headphones to the outputs labeled GND and P0. |
Ton | Frequency | Ton | Frequency |
h' | 494 | h'' | 988 | ||
a' | 440 | a'' | 880 | ||
g' | 392 | g'' | 784 | ||
f' | 349 | f'' | 698 | ||
e' | 330 | e'' | 660 | ||
d' | 294 | d'' | 588 | ||
c' | 262 | c'' | 524 | c''' | 1048 |
Melody, at modul music:
ADADADUM - Beethoven 5. Sinfonie C Moll
ENTERTAINER - Scott Joplin's Ragtime
PRELUDE -J.S.Bach 48 Preludien aund Fugen
ODE - "Ode on Joy" Beethoven 9. Sinfonie D Moll
NYAN - Nyan Phone tone
FUNK - Secret agent
BLUES - Boogie-Woogie Blues
BIRTHDAY - Happy Birthday to You
WEDDING - Wagner Oper "Lohengrin"
FUNERAL - funeral procession, Chopin Klaviersonate
PUNCHLINE - a funny Tonclip
PYTHON - Monty Python Flying Circust;
BADDY - Filmclip The Baddy
CHASE - Filmclick Jagdszene
BA_DING - Signalton
WAWAWAWAA - Posaunenklang
JUMP_UP - for games, up movement
JUMP_DOWN - for games, down movement
POWER_UP - power up
POWER_DOWN -power downt