WebAudio API playback library, with filters. Modern audio playback for modern browsers.
Features
PIXI.Assets
systemKnown Compatibility
Installation is available by NPM:
npm i @pixi/sound --save
To import into your project, for instance, when using Webpack, Parcel, Rollup, or another bundler:
import { sound } from '@pixi/sound';
sound.add('my-sound', 'path/to/file.mp3');
sound.play('my-sound');
If you're using a <script>
element to import @pixi/sound
into your project, then the SoundLibrary object is PIXI.sound
global.
<!-- PixiJS must be imported before @pixi/sound -->
<script src="https://unpkg.com/pixi.js/dist/browser/pixi.min.js"></script>
<!-- found here, if not using CDN "./node_modules/@pixi/sound/dist/pixi-sound.js" -->
<script src="https://unpkg.com/@pixi/sound/dist/pixi-sound.js"></script>
<script>
PIXI.sound.add('my-sound', 'path/to/file.mp3');
PIXI.sound.play('my-sound');
</script>
PixiJS | PixiJS Sound |
---|---|
v5.x - v6.x | v4.x |
v7.x | v5.x |
v8.x | v6.x |
MIT License.