Skip to main content

play_note()

Description#

Play a note, from C2 - B6.

Syntax#

play_note(note_type)
play_note(note_type, note_duration=500)

Parameters#

note_type: Integer from 0 to 60 or enum from Note class. Setting the note to 0 will result in no sound.
note_duration: Default to 500 milliseconds but can be an integer from 0 to 2500 milliseconds. Must be in 100 millisecond increments ex. 100, 200, 500, 2000. If 0 note will play forever.

class Note:
C2 = 1
CS2 = 2
D2 = 3
DS2 = 4
E2 = 5
F2 = 6
FS2 = 7
G2 = 8
GS2 = 9
A2 = 10
AS2 = 11
B2 = 12
C3 = 13
CS3 = 14
D3 = 15
DS3 = 16
E3 = 17
F3 = 18
FS3 = 19
G3 = 20
GS3 = 21
A3 = 22
AS3 = 23
B3 = 24
C4 = 25
CS4 = 26
D4 = 27
DS4 = 28
E4 = 29
F4 = 30
FS4 = 31
G4 = 32
GS4 = 33
A4 = 34
AS4 = 35
B4 = 36
C5 = 37
CS5 = 38
D5 = 39
DS5 = 40
E5 = 41
F5 = 42
FS5 = 43
G5 = 44
GS5 = 45
A5 = 46
AS5 = 47
B5 = 48
C6 = 49
CS6 = 50
D6 = 51
DS6 = 52
E6 = 53
F6 = 54
FS6 = 55
G6 = 56
GS6 = 57
A6 = 58
AS6 = 59
B6 = 60

Returns#

None

Example Code#
Python#
#Python code
from zumi.zumi import Zumi
from zumi.protocol import Note
import time
zumi = Zumi()
zumi.play_note(30, 500)
time.sleep(1)
zumi.play_note(Note.C4)
time.sleep(1)
# will stop the buzzer
zumi.play_note(0, 0)