The function plays the tone on the speaker for the specified note and duration. The duration is calculated by the factor.
Actual playtime = 1 / duration factor
Function Definition: playtone(note = "C4", duration_factor = 1)
Name | Type | Description | Expected Values | Default Value |
---|---|---|---|---|
note | string | The note to be played. | "C4","D4","E4","F4","G4","A4","B4", "C5","D5","E5","F5","G5","A5","B5", "C6","D6","E6","F6","G6","A6","B6", "C7","D7","E7","F7","G7","A7","B7" | "C4" |
duration_factor | int | The factor by which the duration needs to be changed. | 1, 2, 4, 8, 16 | 1 |
The function plays the tone on the speaker for the specified note and duration. The duration is calculated by the factor.
Actual playtime = 1 / duration factor
sprite = Sprite('Tobi')
quarky = Quarky()
while True:
if quarky.ispadtouched("T1"):
quarky.drawpattern("bbbjjbjjbjjbbjjbjjjbjjbjjjbjjbjjbbb")
quarky.playtone("C4", 8)
if quarky.ispadtouched("T2"):
quarky.drawpattern("cccjcccjcjjjjcjcjjcccjcjjcjjjcjjccc")
quarky.playtone("D4", 8)
if quarky.ispadtouched("T3"):
quarky.drawpattern("fffjfffjfjjjjfjfjjfffjfjjjjfjfjjfff")
quarky.playtone("E4", 8)
if quarky.ispadtouched("T4"):
quarky.drawpattern("dddjdjdjdjjdjdjdjjdddjdjjjjdjdjjjjd")
quarky.playtone("F4", 8)
if quarky.ispadtouched("T5"):
quarky.drawpattern("gggjgggjgjjgjjjgjjgggjgjjjjgjgjjggg")
quarky.playtone("G4", 8)
The example demonstrates how to create a dance sequence with Quadruped with Music.
sprite = Sprite('Tobi')
quarky = Quarky()
import time
quad=Quadruped(4,1,8,5,3,2,7,6)
quad.home()
while True
quarky.playsound("QuarkyIntro")
quad.action("right hand wave",700,2)
quad.home()
quarky.playtone("E5",8)
quad.action("front back",700,3)
quarky.playtone("C4",8)
quad.action("bodyshake2",700,3)
quarky.playtone("D4",8)
quad.action("bodyshake3",700,3)
quarky.playtone("E4",8)
quad.action("bodyshake4",700,3)
quarky.playtone("C5",8)
quad.action("updown1",700,3)
quad.home()
You can also make the Quadruped dance work independent of PictoBlox using the Upload Mode. For that switch to upload mode.
Copyright 2024 – Agilo Research Pvt. Ltd. All rights reserved – Terms & Condition | Privacy Policy