TEAM a.r.g.

ATMlib Sound Effects Editor manual · v1.0.1

← Back to the editor

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

  1. Open the Starters tab on the left. Press ▶ next to any starter to hear it.
  2. Press + (or double-click) to add one to My effects.
  3. Move the sliders. With "Play while I edit" ticked, the sound plays after every move.
  4. Give it a name. The name becomes the name in your code (Coin pickup becomes the track sfxCoinPickup and the number SFX_COIN_PICKUP).
  5. Copy the text from the right panel, or press Download, and put it in your sketch.
Stuck for ideas?Press 🎲 Surprise me. It nudges the sliders to random values. Undo (Ctrl+Z) brings the old sound back.

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.

One way tripOnce you edit every setting, the starter sliders no longer apply to that effect. Back to starter sliders discards your detailed edits.

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):

ChannelColourUsed for
CH0redtones
CH1bluetones
CH2greentones (a softer, saw-like sound)
CH3orangenoise 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

Troubleshooting

ProblemTry this
No soundPress Play once (browsers only allow sound after a click). Check the device volume and silent switch.
It sounds different on the ArduboyCheck 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 musicThat is how it works: the channel is borrowed. Use a channel your music leaves quiet.
The sliders stopped workingYou used "Edit every setting". Press "Back to starter sliders", or keep editing in detail.
I lost my effectsAutosave 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