Skip to content

OxleyS/bevy_kira_audio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bevy Kira audio

Crates.io license Crates.io

This bevy plugin is intended to try integrating Kira into Bevy. The end goal is to replace or update bevy_audio, if Kira turns out to be a good approach. Currently, this plugin can play ogg, mp3, flac, and wav formats and supports web builds for everything except mp3.

You can check out the examples directory in this repository for a display of this plugin's functionality.

Usage

To initialize the corresponding AssetLoaders, use at least one of the features ogg, mp3, wav, or flac. The following example assumes that the feature bevy_kira_audio/ogg is enabled.

use bevy_kira_audio::{Audio, AudioPlugin};

// in your game's AppBuilder:
// app.add_plugin(AudioPlugin)

fn my_audio_system(
    asset_server: Res<AssetServer>,
    audio: Res<Audio>,
) {
    let music_handle = asset_server.get_handle("sounds/music.ogg");
    audio.play(music_handle);
}

Current state

  • play common audio formats
    • ogg
    • mp3
    • wav
    • flac
  • web support
    • The features ogg, flac and wav can be build for WASM and used in web builds. There are some differences between browsers:
      • Chrome requires an interaction with the website to play audio (e.g. a button click). This issue can be resolved with a script in your index.html file (usage example).
      • Firefox: The audio might sound distorted (this could be related to overall performance; see issue #9)
  • pause/resume and stop tracks
  • play a track on repeat
  • control volume
  • control playback rate
  • control pitch (no change in playback rate)
  • control panning
  • get the current status of a track (time elapsed/left)?

Compatible Bevy versions

The main branch is up to date with the latest Bevy release. The branch bevy_main tracks the main branch of Bevy.

Compatibility of published bevy_kira_audio versions:

bevy_kira_audio bevy
0.4.0 0.5.0
0.3.0 0.4.0

License

This crate is distributed under the terms of the MIT license.

Assets in the examples might be distributed under different terms. See the readme in the examples directory.

About

A Bevy plugin to use Kira for game audio

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%