Bold sounds
Module to play ambient and effect sounds for the game.
Usage
-
Get the module
npm install git+https://github .com/wearereasonablepeople/bold-sounds.git
-
Copy sprites.mp3
and sprites.webm
to your app public folder (e.g /build/audio/
) manually or using Webpack.
cp node_modules/bold-sounds/dist/sprites.* /build/audio/
-
Import the module of your choice (.cjs, .umd or .esm) from /dist
folder and play some sounds
import BoldSounds from 'bold-sounds';
const boldSounds = new BoldSounds({src: ['/audio/sprites.mp3', '/audio/sprites.webm']});
boldSounds.init()
.then(() => {
boldSounds.play('badge');
boldSounds.mute(true);
boldSounds.mute(false);
});
Logic
Build
Requires ffmpeg
to build sprites
brew install ffmpeg --with-theora --with-libvorbis
npm run build
Sounds loudness normalization
- For normalizing loudness we can use
ffmpeg-normalize
tool - this command overwrites original file
- for ambient sounds we use
-t -16
- for effect sounds we use
-t -10
pip3 install ffmpeg-normalize
ffmpeg-normalize sounds/input.wav -of ./sounds -ext wav -f -t -16