What is this?
A small editor for sound effects for the Arduboy, made for ATMlib's ATM.playSfx(). A sound effect is a short sound (a jump, a coin, an explosion) that borrows one channel of your music for a moment and gives it back afterwards.
You don't have to write notes. Pick a starter that sounds roughly right, drag the sliders until it sounds like you want, and copy the result into your sketch.
Quick start
- Open the Starters tab on the left. Press ▶ next to any starter to hear it.
- Press + (or double-click) to add one to My effects.
- Move the sliders. With "Play while I edit" ticked, the sound plays after every move.
- Give it a name. The name becomes the name in your code (Coin pickup becomes the track
sfxCoinPickupand the numberSFX_COIN_PICKUP). - Copy the text from the right panel, or press Download, and put it in your sketch.
Starters
Starters are grouped by what they are used for (Movement, Pick-ups, Menu, Weapons, Impacts, Alerts, Jingles) and by the trick they use: Vibrato (the pitch wobbles), Tremolo (the volume throbs), Arpeggio (a chord played note by note, or a chopped-up "stutter" note) and Transpose (a note repeated and shifted up or down each time, or a whole effect shifted by a set amount). Each is a complete effect that already sounds fine. "tone" starters make a pitched sound, "noise" starters make hiss, wind or rumble.
Sliders
Every starter shows only the few sliders that matter for that sound, for example Start pitch, Length, Volume and Fade out. Back to starter values resets them.
The picture shows the result: bars are the volume per tick, the line is the pitch. Under it you can see the size in bytes, the length in ticks and seconds, and the channel. Below that are the exact commands that will be exported.
Edit every setting
Want more than the sliders offer? Press Edit every setting…. You get all the building blocks: volume, fade out (or swell), pitch slide, glide, wobble (vibrato or tremolo), texture (arpeggio or cut), shift all notes, repeat-and-shift, rumble, extra tail, and a list of notes with their lengths.
Channels and colours
Every effect plays on one channel, and each channel has its own colour everywhere in the editor (the list, the picture, the buttons):
| Channel | Colour | Used for |
|---|---|---|
| CH0 | red | tones |
| CH1 | blue | tones |
| CH2 | green | tones (a softer, saw-like sound) |
| CH3 | orange | noise only |
Pick the channel with the coloured buttons above the picture. Noise effects always play on CH3 and tone effects can never go on CH3, so the buttons that don't fit are greyed out. While the effect plays, that channel is borrowed from your music, so choose one your song is not using at that moment.
The export lists the channel for each effect. Pass the same one to playSfx.
Tempo and length
ATMlib counts in ticks, and a tick is a fixed fraction of your song's tempo. So an effect lasts a different time in a fast song than in a slow one. Set Test tempo in the top bar to your game's tempo to hear it right. This setting is only for listening and is not exported.
Export
The right panel holds a ready-made header file. Every effect is a plain PROGMEM track that ends with ATM_STOP_CHAN:
const uint8_t sfxJump[] PROGMEM = {
ATM_VOL(48),
ATM_SL_VOL((uint8_t)-4),
ATM_GLIS(1),
ATM_NOTE_B3,
ATM_DELAY(12),
ATM_STOP_CHAN
};
After the effects come a #define per effect (SFX_JUMP 0, SFX_COIN 1 ...), a PROGMEM list soundFX[] with all the tracks, and a small PROGMEM list soundFXch[] with the channel of each effect. Comments give size, ticks and channel. Name the file (default sfx), then Copy or Download. The total size in bytes is shown so you can watch your memory.
Playing it
ATMlib wants a pointer to the track, so look it up in the list. Put one small function in your sketch and call it with the number:
#include <ATMlib.h>
#include "sfx.h"
void sfx(byte n)
{
ATM.playSfx((const uint8_t *)pgm_read_word(&soundFX[n]),
pgm_read_byte(&soundFXch[n]));
}
// when something happens:
sfx(SFX_COIN);
Want to ignore the channel list? Pass your own channel instead, for example ATM.playSfx((const uint8_t *)pgm_read_word(&soundFX[n]), CH_ONE). To respect the sound setting of the Arduboy, wrap the call in if (arduboy.audio.enabled()), ATMlib does not look at it. ATM.playSfx needs ATMlib to be set up with a song (or silence) as usual.
ATMconfig.h: effects that use glissando (ATM_GLIS), noise, tremolo, vibrato, note cut and so on need the matching switch to be on in your ATMconfig.h (ATM_FX_GLISSANDO, ATM_FX_NOISE ...), otherwise the command is ignored and the sound is different. Leave the ones you don't use off to save flash.
Save, open, reset
- Your work is saved automatically in this browser.
- Save downloads a project file (
.atmsfx.json) and Open loads it back. Do this for anything you care about. - New starts an empty list. Reset wipes everything, including the browser's autosave.
- Space plays the selected effect. Ctrl+Z / Ctrl+Y undo and redo.
Troubleshooting
| Problem | Try this |
|---|---|
| No sound | Press Play once (browsers only allow sound after a click). Check the device volume and silent switch. |
| It sounds different on the Arduboy | Check the tempo, and make sure you pass the right channel to playSfx and that the effects it uses (glissando, noise ...) are switched on in ATMconfig.h. |
| The effect cuts my music | That is how it works: the channel is borrowed. Use a channel your music leaves quiet. |
| The sliders stopped working | You used "Edit every setting". Press "Back to starter sliders", or keep editing in detail. |
| I lost my effects | Autosave lives in the browser. Use Save to keep a project file. |
Made by TEAM a.r.g. If this tool is useful to you, a coffee is always welcome:
☕ Cool tool? Buy us a coffee