{"id":15017969,"url":"https://github.com/niklasei/bevy_kira_audio","last_synced_at":"2025-05-14T05:10:50.732Z","repository":{"id":37030338,"uuid":"330498775","full_name":"NiklasEi/bevy_kira_audio","owner":"NiklasEi","description":"A Bevy plugin to use Kira for game audio","archived":false,"fork":false,"pushed_at":"2025-04-26T17:46:59.000Z","size":1019,"stargazers_count":377,"open_issues_count":14,"forks_count":57,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-06T23:58:54.721Z","etag":null,"topics":["audio","bevy","bevy-plugin","game-audio","game-development","hacktoberfest","kira","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NiklasEi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-17T22:24:15.000Z","updated_at":"2025-05-06T13:46:14.000Z","dependencies_parsed_at":"2024-06-29T06:36:37.079Z","dependency_job_id":"cbd509d7-9224-433b-bdbd-115a49cc797e","html_url":"https://github.com/NiklasEi/bevy_kira_audio","commit_stats":{"total_commits":230,"total_committers":20,"mean_commits":11.5,"dds":"0.18695652173913047","last_synced_commit":"9b35b7cc6b4969b7ced26787095e1b83fe24705c"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiklasEi%2Fbevy_kira_audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiklasEi%2Fbevy_kira_audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiklasEi%2Fbevy_kira_audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiklasEi%2Fbevy_kira_audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NiklasEi","download_url":"https://codeload.github.com/NiklasEi/bevy_kira_audio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","bevy","bevy-plugin","game-audio","game-development","hacktoberfest","kira","rust"],"created_at":"2024-09-24T19:51:15.993Z","updated_at":"2025-05-14T05:10:50.718Z","avatar_url":"https://github.com/NiklasEi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bevy Kira audio\n\n[![Crates.io](https://img.shields.io/crates/v/bevy_kira_audio.svg)](https://crates.io/crates/bevy_kira_audio)\n[![docs](https://docs.rs/bevy_kira_audio/badge.svg)](https://docs.rs/bevy_kira_audio)\n[![license](https://img.shields.io/crates/l/bevy_kira_audio)](https://github.com/NiklasEi/bevy_kira_audio#license)\n[![Crates.io](https://img.shields.io/crates/d/bevy_kira_audio.svg)](https://crates.io/crates/bevy_kira_audio)\n\nThis bevy plugin is intended to test an integration of [Kira][kira] into Bevy. The 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.\n\nSound can be played in channels. Each channel has controls to pause or stop playback and can change the volume, playback speed, and panning of all sounds playing in it. You can easily add new channels and access them through Bevy's ECS (see the [`custom_channel` example](examples/custom_channel.rs)).\n\n## Usage\n\n*Note: the Bevy feature `bevy_audio` is enabled by default and not compatible with this plugin. Make sure to not have the `bevy_audio` feature enabled if you want to use `bevy_kira_audio`. The same goes for Bevy's `vorbis` feature. See [Bevys' Cargo file][bevy_default_features] for a list of all default features of version `0.16` and list them manually in your Cargo file excluding the ones you do not want. Make sure to set `default-features` to `false` for the Bevy dependency. You can take a look at [bevy_game_template's cargo file as an example](https://github.com/NiklasEi/bevy_game_template/blob/main/Cargo.toml).*\n\n\nTo play audio, you usually want to load audio files as assets. This requires `AssetLoaders`. `bevy_kira_audio` comes with loaders for most common audio formats. You can enable them with the features `ogg` (enabled by default), `mp3`, `wav`, or `flac`. The following example assumes that the feature `ogg` is enabled.\n\n```rust no_run\nuse bevy_kira_audio::prelude::*;\nuse bevy::prelude::*;\n\nfn main() {\n   App::new()\n        .add_plugins((DefaultPlugins, AudioPlugin))\n        .add_systems(Startup, start_background_audio)\n        .run();\n}\n\nfn start_background_audio(asset_server: Res\u003cAssetServer\u003e, audio: Res\u003cAudio\u003e) {\n    audio.play(asset_server.load(\"background_audio.ogg\")).looped();\n}\n```\n\nYou can change settings like volume, panning, or playback rate for running sounds, or when starting to play a sound.\nAll changes can be done as smooth transitions. By default, they will be almost instantaneous.\n\n### Sound settings\n\nYou can configure a sound when playing it:\n```rust\nuse bevy_kira_audio::prelude::*;\nuse bevy::prelude::*;\nuse std::time::Duration;\n\nfn play_audio(asset_server: Res\u003cAssetServer\u003e, audio: Res\u003cAudio\u003e) {\n    audio.play(asset_server.load(\"background_audio.ogg\"))\n        // The first 0.5 seconds will not be looped and are the \"intro\"\n        .loop_from(0.5)\n        // Fade-in with a dynamic easing\n        .fade_in(AudioTween::new(Duration::from_secs(2), AudioEasing::OutPowi(2)))\n        // Only play on our right ear\n        .with_panning(1.0)\n        // Increase playback rate by 50% (this also increases the pitch)\n        .with_playback_rate(1.5)\n        // Play at half volume\n        .with_volume(0.5)\n        // play the track reversed\n        .reverse();\n}\n```\n\nOptionally, you can also load a sound with already applied settings. This requires the feature `settings_loader`.\n\nSounds are configured in `ron` files. The following file loads as a `AudioSource` which is looped and has a 3 seconds intro before the loop:\n```ron\n(\n    // The actual sound file in your assets directory\n    file: \"sounds/loop.ogg\",\n\n    loop_behavior: Some(3.0),\n)\n```\nwould make the loaded sound loop by default and start each repeated playback three seconds into the sound (the three seconds are the intro).\n\nMore settings are available. See the [`settings_loader` example](examples/settings_loader.rs) for all options.\n\n### Controlling sounds\n\nYou can either control a whole audio channel and all instances playing in it ([`channel_control` example](examples/channel_control.rs)), or a single audio instance ([`instance_control` example](examples/instance_control.rs)). Both ways offer audio transitions with Tweens supporting multiple easings.\n\n### Spatial audio\n\nThere is limited spatial audio support. Currently, only the volume of audio and it's panning can be automatically changed based on emitter and receiver positions. Take a look at the [`spatial` example](examples/spatial.rs) for some code.\n\n## Compatible Bevy versions\n\nThe main branch is compatible with the latest Bevy release.\n\nCompatibility of `bevy_kira_audio` versions:\n\n| Bevy version | `bevy_kira_audio` version |\n|:-------------|:--------------------------|\n| `0.16`       | `0.23`                    |\n| `0.15`       | `0.21` - `0.22`           |\n| `0.14`       | `0.20`                    |\n| `0.13`       | `0.19`                    |\n| `0.12`       | `0.18`                    |\n| `0.11`       | `0.16` - `0.17`           |\n| `0.10`       | `0.15`                    |\n| `0.9`        | `0.13` - `0.14`           |\n| `0.8`        | `0.11` - `0.12`           |\n| `0.7`        | `0.9` - `0.10`            |\n| `0.6`        | `0.8`                     |\n| `0.5`        | `0.4` - `0.7`             |\n| `0.4`        | `0.3`                     |\n| `0.15`       | `main`                    |\n| `main`       | `bevy_main`               |\n\n## License\n\nDual-licensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)\n\nat your option.\n\nAssets in the examples might be distributed under different terms. See the [readme](examples/README.md#credits) in the `examples` directory.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n\n\n[kira]: https://github.com/tesselode/kira\n[bevy_default_features]: https://github.com/bevyengine/bevy/blob/v0.15.0/Cargo.toml#L101-L138\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklasei%2Fbevy_kira_audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniklasei%2Fbevy_kira_audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklasei%2Fbevy_kira_audio/lists"}