View on GitHub

sound-and-music-minecraft-makecode-ext

Code with Sound and Music in Minecraft: Education Edition. Adds blocks to play game sounds, music discs, and note block sounds from your code projects!

Sound and Music MakeCode extension for Minecraft: Education Edition

Open this page at https://microsoft.github.io/sound-and-music-minecraft-makecode-ext/

Use the extension in Minecraft

The left menu should now contain a new Music category!

Block documentation

playMusic(builtInMusicDisc, musicOption)

Play a Minecraft music disc.

Examples:

playMusic(MusicDisc.Eleven, MusicOption.Once);
playMusic(MusicDisc.Otherside, MusicOption.Forever);

Available MusicDiscs include:

Available MusicOptions include:

stopMusic()

Stop the music.

Example:

stopMusic();

playSound(sound)

Plays the specified Minecraft game sound.

Examples:

playSound(Sound.CatMeow);
playSound(Sound.Firework);

Available Sounds include:

playNote(note, instrument)

Plays the specified note on the specified Minecraft instrument, as if it was played on a note block.

Minecraft can play notes from Low F# (Note.FSharp3) to High F# (Note.FSharp5).

Examples:

playNote(Note.E4, Instrument.Harp);
playNote(Note.FSharp4, Instrument.Banjo);

Available Instruments include:

setVolume(newVolume)

Changes the volume that playSound and playNote will play at.

Volumes can range from 0 to 100 and starts at 100.

This is separate from all Minecraft audio settings. It only affects the other blocks provided by this extension.

Examples:

setVolume(0); // mute
setVolume(100); // max volume

volume()

Returns the volume previously set by setVolume.

Examples:

volume(); // returns 100 by default
setVolume(50);
volume(); // now returns 50

Test the extension in a browser

This repository can be added as an extension in the MakeCode online editor (outside of Minecraft). None of the functionality will work outside of Minecraft, but this is a quick way to test out what the MakeCode blocks will look like without loading up the game.

Edit this project

To edit this repository in MakeCode:

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

Metadata (used for search, rendering)