Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/klausw3/pxt-sound-effects
MakeCode extension for sound effects
https://github.com/klausw3/pxt-sound-effects
Last synced: 24 days ago
JSON representation
MakeCode extension for sound effects
- Host: GitHub
- URL: https://github.com/klausw3/pxt-sound-effects
- Owner: klausw3
- License: mit
- Created: 2020-10-05T06:23:07.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T21:51:19.000Z (almost 2 years ago)
- Last Synced: 2024-08-03T22:02:10.877Z (4 months ago)
- Language: TypeScript
- Homepage: https://klausw3.github.io/pxt-sound-effects/
- Size: 2.95 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-Arcade-Extensions - GitHub repo - 54587-15263-92450) | [Forum post](https://forum.makecode.com/t/testing-modifications-to-the-sound-engine/3351/17?u=unsignedarduino) (Not built-in extensions / pxt-sound-effects)
README
## PXT Sound Effects ![Build status badge](https://github.com/klausw3/pxt-sound-effects/workflows/MakeCode/badge.svg)
This extension adds blocks for creating sound effects based on the [music.playInstructions()](https://arcade.makecode.com/developer/sound#sound-instructions) 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:
```js
let soundeffect: SoundBuffer = nullsoundeffect = soundEffects.createSound(WaveType.Triangle, 1000, 440, 110)
soundeffect.playUntilDone()
```The parameters to `createSound` are:
- waveform
- duration in milliseconds
- starting frequency in Hz (cycles/second)
- ending frequency in Hz
- starting volume 0-1023 (optional, default 255)
- ending volume 0-1023 (optional, default 0)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.
* open [https://arcade.makecode.com/](https://arcade.makecode.com/)
* click on **New Project**
* click on **Extensions** under the gearwheel menu
* search for **https://github.com/klausw3/pxt-sound-effects** and import## Edit this project
To edit this repository in MakeCode.* open [https://arcade.makecode.com/](https://arcade.makecode.com/)
* click on **Import** then click on **Import URL**
* paste **https://github.com/klausw3/pxt-sound-effects** and click import## Blocks example
![A rendered view of the blocks](https://github.com/klausw3/pxt-sound-effects/raw/master/assets/sound-effect-blocks.png)
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)
* for PXT/arcade
makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");