A "boing" when you jump, a "ching" when you grab a coin, music that sets the mood. Sound alone can make a game feel twice as good.

This guide shows how to add sound effects and music to a game on CraftNova, and how to fix the classic problem of "no sound on my phone."

Two ways to add sound on CraftNova

Games on CraftNova can't load audio files from the internet or from separate files (see Fixing images, sounds, or libraries that won't load). So sound comes from one of these two methods.

1. Generate sound in code (recommended)

Browsers include "Web Audio", a way to create sound with code. Blips, explosions, and retro chiptune music can all be made without a single audio file. As a bonus, it keeps your game's file small.

2. Embed audio in the HTML

If you really need a specific sound, you can convert the audio file to text (Base64) and embed it in the HTML. The catch: it makes the file much bigger. CraftNova accepts games up to 10 MB, so keep this to short sound effects.

What to ask the AI

Give the AI the "Game creation guidelines" from the posting page first, then ask something like:

Add sound to this game.
- Don't use audio files; generate all sounds with the Web Audio API
- Play sound effects for jumping, picking up items, and game over
- Play a short looping background track during gameplay
- Keep the volume low, and add an on-screen sound on/off button

Describing the mood helps a lot, like "8-bit retro game sounds" or "soft music-box tones."

No sound on phones?

Sound that works on a PC but not on a phone is one of the most common problems. It's usually one of these:

The game plays sound before the player taps

Mobile browsers have a rule: no sound until the player has tapped the screen. A game that starts its music the moment the page opens will stay silent. The standard fix is a "Tap to start" title screen that also prepares the audio on that tap.

On iPhone, audio stays paused even after a tap

On iPhone, the audio system can stay "suspended" even after a tap, and it can pause again when you switch to another app and come back. The guidelines include code that wakes it back up. Ask the AI to "follow the [If the game uses sound] section of the guidelines so sound works on iPhone."

The phone is on silent

On iPhone, game audio may not play while the silent switch is on. That's not a bug in the game, so check the phone's settings first.

Tips for player-friendly sound

  • Keep it quiet: sudden loud sounds startle people. The guidelines cap volume at 0.3
  • Add an on/off button: some people play on the train or in other places where sound isn't OK
  • Vary repeated sounds: shifting the pitch slightly on a sound that plays often keeps it from getting tiring
  • Use short music loops: a short repeating phrase is smaller and wears thin less quickly than a long track

Summary

  • On CraftNova, generating sound with Web Audio is the way to go
  • Phones only allow sound after the player taps the screen
  • If iPhone stays silent, check that the code follows the guidelines
  • Keep the volume low and add an on/off button

For phone controls, see Making controls that work on phones.