Skip to content

[bricks] Sound generator brick#18

Closed
rjtokenring wants to merge 28 commits intoarduino:mainfrom
rjtokenring:sound-generator
Closed

[bricks] Sound generator brick#18
rjtokenring wants to merge 28 commits intoarduino:mainfrom
rjtokenring:sound-generator

Conversation

@rjtokenring
Copy link
Copy Markdown
Contributor

@rjtokenring rjtokenring commented Nov 11, 2025

Brick created for generate sounds based on wave form handling.

from arduino.app_bricks.sound_generator import SoundGenerator, SoundEffect

player = SoundGenerator(wave_form="square", sound_effects=[SoundEffect.adsr()])
player.start()

song = [
    ("E5", 0.125), ("E5", 0.125), ("REST", 0.125), ("E5", 0.125),
    ("REST", 0.125), ("C5", 0.125), ("E5", 0.125), ("REST", 0.125),
    ("G5", 0.25),  ("REST", 0.25),  ("G4", 0.25),  ("REST", 0.25),

    ("C5", 0.25),  ("REST", 0.125), ("G4", 0.25),  ("REST", 0.125),
    ("E4", 0.25),  ("REST", 0.125), ("A4", 0.25),  ("B4", 0.25),
    ("Bb4", 0.125), ("A4", 0.25),  ("G4", 0.125), ("E5", 0.125),
    ("G5", 0.125), ("A5", 0.25),  ("F5", 0.125), ("G5", 0.125),
    ("REST", 0.125), ("E5", 0.25),  ("C5", 0.125), ("D5", 0.125), ("B4", 0.25),
]
for note, duration in song:
    player.play_tone(note, duration)
from arduino.app_bricks.sound_generator import SoundGenerator, SoundEffect

player = SoundGenerator(master_volume = 0.8, bpm = 120, sound_effects=[SoundEffect.adsr()])
player.start()

music = [
    ("E5", 1/8), ("D#5", 1/8), ("E5", 1/8), ("D#5", 1/8), ("E5", 1/8),
    ("B4", 1/8), ("D5", 1/8),  ("C5", 1/8),  ("A4", 1/4),

    ("C4", 1/8), ("E4", 1/8),  ("A4", 1/8),  ("B4", 1/8),
    ("E4", 1/8), ("G#4", 1/8), ("B4", 1/8),  ("C5", 1/8),

    ("E4", 1/8), ("E5", 1/8),  ("D#5", 1/8), ("E5", 1/8), ("D#5", 1/8), ("E5", 1/8),
    ("B4", 1/8), ("D5", 1/8),  ("C5", 1/8),  ("A4", 1/4),

    ("C4", 1/8), ("E4", 1/8),  ("A4", 1/8),  ("B4", 1/4),
    ("E4", 1/8), ("C5", 1/8),  ("B4", 1/8),  ("A4", 1),
]
for note, duration in music:
    player.play(note, duration)

beanrepo added a commit to beanrepo/app-bricks-py that referenced this pull request Jan 20, 2026
* Replace SineGenerator with WaveGenerator Brick in Theremin (arduino#8)

* Mascot Jump Game Example Addition (arduino#7)

* Add Bedtime story teller example (arduino#15)

* Mascot Jump Game Update UI (arduino#17)

* Add Object Hunting example documentation (arduino#18)

* Update Theremin Simulator example documentation (arduino#16)

* Add led-matrix-painter (arduino#5)

* Docs: update bedtime story teller (arduino#20)

* Fan vibration monitoring UI (arduino#19)

* Vibration Anomaly Detection Example Documentation (arduino#22)

* Led matrix UI improvement (arduino#24)

* Docs led matrix painter (arduino#26)

---------

Co-authored-by: Dario Sammaruga <48221340+BeanRepo@users.noreply.github.com>
Co-authored-by: Dario Sammaruga <d.sammaruga@ext.arduino.cc>
Co-authored-by: TaddyHC <94547080+TaddyHC@users.noreply.github.com>
Co-authored-by: Stefano Torneo <s.torneo@arduino.cc>
Co-authored-by: Matteo Marsala <matteo.marsala92@gmail.com>
Co-authored-by: Ernesto Voltaggio <92443068+91volt@users.noreply.github.com>
Co-authored-by: Christopher Méndez <49886387+mcmchris@users.noreply.github.com>
Co-authored-by: Stefano Torneo <121802192+stefanotorneo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant