View on GitHub

pxt-sound-effects

MakeCode extension for sound effects

PXT Sound Effects Build status badge

This extension adds blocks for creating sound effects based on the music.playInstructions() interface.

It was originally intended for new waveforms (tunable noise, and cycle noise modulated square waves) that are currently only available in the beta editor, but also works with the current MakeCode Arcade editor as long as you stick to the waveforms it supports.

Example:

let soundeffect: SoundBuffer = null

soundeffect = soundEffects.createSound(WaveType.Triangle, 1000, 440, 110)
soundeffect.playUntilDone()

The parameters to createSound are:

Once the sound effect is created, use playUntilDone() or play() to play the sound, depending on if you want your program to wait for the sound to finish, or to continue running while it plays in the background.

You can modify the parameters of a sound effect using attributes, for example setting soundeffect.freq1 = 220.

Create a project with this extension

This repository can be added as an extension in MakeCode.

Edit this project

To edit this repository in MakeCode.

Blocks example

A rendered view of the blocks

Example for basic effects: https://arcade.makecode.com/16695-67870-01625-09215

Link to the beta editor for trying the new waveforms: https://arcade.makecode.com/beta#pub:_JL6P9m5fYg9u

Metadata (used for search, rendering)