https://github.com/ralith/oddio
Lightweight game audio
https://github.com/ralith/oddio
audio game-development hacktoberfest rust
Last synced: about 1 year ago
JSON representation
Lightweight game audio
- Host: GitHub
- URL: https://github.com/ralith/oddio
- Owner: Ralith
- License: apache-2.0
- Created: 2020-11-15T05:42:25.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-15T23:53:48.000Z (over 2 years ago)
- Last Synced: 2024-10-18T21:55:45.764Z (over 1 year ago)
- Topics: audio, game-development, hacktoberfest, rust
- Language: Rust
- Homepage:
- Size: 312 KB
- Stars: 149
- Watchers: 4
- Forks: 9
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Oddio
[](https://docs.rs/oddio/)
[](LICENSE-APACHE)
[](LICENSE-MIT)
Oddio is a game-oriented audio library that is:
- **Lightweight**: Fast compilation, few dependencies, and a simple interface
- **Sans I/O**: Send output wherever you like
- **Real-time**: Audio output is efficient and wait-free: no glitches until you run out of CPU
- **3D**: Spatialization with doppler effects and propagation delay available out of the box
- **Extensible**: Implement `Signal` for custom streaming synthesis and filtering
- **Composable**: `Signal`s can be transformed without obstructing the inner `Signal`'s controls
### Example
```rust
let (mut scene_handle, mut scene) = oddio::SpatialScene::new();
// In audio callback:
let out_frames = oddio::frame_stereo(data);
oddio::run(&mut scene, output_sample_rate, out_frames);
// In game logic:
let frames = oddio::FramesSignal::from(oddio::Frames::from_slice(sample_rate, &frames));
let mut handle = scene_handle
.play(frames, oddio::SpatialOptions { position, velocity, ..Default::default() });
// When position/velocity changes:
handle.set_motion(position, velocity, false);
```
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the
Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.