-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'RustAudio:master' into Issue#566
- Loading branch information
Showing
17 changed files
with
1,291 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//! Noise generator example. Use the "noise" feature to enable the noise generator sources. | ||
|
||
#[cfg(feature = "noise")] | ||
fn main() { | ||
use rodio::source::{pink, white, Source}; | ||
use std::thread; | ||
use std::time::Duration; | ||
|
||
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap(); | ||
|
||
let noise_duration = Duration::from_millis(1000); | ||
let interval_duration = Duration::from_millis(1500); | ||
|
||
stream_handle | ||
.play_raw( | ||
white(cpal::SampleRate(48000)) | ||
.amplify(0.1) | ||
.take_duration(noise_duration), | ||
) | ||
.unwrap(); | ||
println!("Playing white noise"); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
stream_handle | ||
.play_raw( | ||
pink(cpal::SampleRate(48000)) | ||
.amplify(0.1) | ||
.take_duration(noise_duration), | ||
) | ||
.unwrap(); | ||
println!("Playing pink noise"); | ||
|
||
thread::sleep(interval_duration); | ||
} | ||
|
||
#[cfg(not(feature = "noise"))] | ||
fn main() { | ||
println!("rodio has not been compiled with noise sources, use `--features noise` to enable this feature."); | ||
println!("Exiting..."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
//! Test signal generator example. | ||
|
||
fn main() { | ||
use rodio::source::{chirp, Function, SignalGenerator, Source}; | ||
use std::thread; | ||
use std::time::Duration; | ||
|
||
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap(); | ||
|
||
let test_signal_duration = Duration::from_millis(1000); | ||
let interval_duration = Duration::from_millis(1500); | ||
|
||
println!("Playing 1000 Hz tone"); | ||
stream_handle | ||
.play_raw( | ||
SignalGenerator::new(cpal::SampleRate(48000), 1000.0, Function::Sine) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
println!("Playing 10,000 Hz tone"); | ||
stream_handle | ||
.play_raw( | ||
SignalGenerator::new(cpal::SampleRate(48000), 10000.0, Function::Sine) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
println!("Playing 440 Hz Triangle Wave"); | ||
stream_handle | ||
.play_raw( | ||
SignalGenerator::new(cpal::SampleRate(48000), 440.0, Function::Triangle) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
println!("Playing 440 Hz Sawtooth Wave"); | ||
stream_handle | ||
.play_raw( | ||
SignalGenerator::new(cpal::SampleRate(48000), 440.0, Function::Sawtooth) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
println!("Playing 440 Hz Square Wave"); | ||
stream_handle | ||
.play_raw( | ||
SignalGenerator::new(cpal::SampleRate(48000), 440.0, Function::Square) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
|
||
println!("Playing 20-10000 Hz Sweep"); | ||
stream_handle | ||
.play_raw( | ||
chirp( | ||
cpal::SampleRate(48000), | ||
20.0, | ||
10000.0, | ||
Duration::from_secs(1), | ||
) | ||
.amplify(0.1) | ||
.take_duration(test_signal_duration), | ||
) | ||
.unwrap(); | ||
|
||
thread::sleep(interval_duration); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!--- | ||
When 0.20.0 is released this announcement will be posted to r/rust and the | ||
rust user forum. Also post in rust audio discord: https://discord.gg/8qW6q2k | ||
--> | ||
|
||
# Announcing rodio 0.20 and call for help | ||
|
||
|
||
Rodio is an audio playback library. It can decode audio files, synthesize new | ||
sounds, apply effects to sounds & mix them. Rodio has been part of the Rust | ||
ecosystem for 9 years now! 🎉. | ||
|
||
## New release | ||
The rodio contributors have made many improvements in the last 5 months. Rodio can now: | ||
|
||
- Seek back and forth through sound efficiently | ||
- Track the playback position at sample accuracy! | ||
- Generate more signals such as chirps, white & pink noise and different | ||
wavesforms | ||
- Automatically adjust the gain to limit the peak volume and change in loudness | ||
|
||
This is ignoring the many fixes and smaller additions made by the many | ||
contributors who helped out expand rodio. | ||
|
||
## Call for help | ||
|
||
In its 9 years of existence Rust has changed a lot. Further more Rodio is being | ||
used for applications beyond its original scope. To improve rodio we believe its | ||
time for larger (breaking) changes. | ||
|
||
### User feedback | ||
To ensure we make the right changes we want | ||
to know what rodio is being used for and what you all would like to use it for. | ||
|
||
We can use any input you have but are especially looking for users who are: | ||
- using rodio and feel some part of the API is hard to use. | ||
- have experienced footguns/pain point | ||
- wanted to use rodio but could not make it fit their use-case (excluding complex | ||
game audio (best served by [kira](https://crates.io/crates/kira)) and advanced | ||
dsp). If you disagree and think rodio can server those excluded use-case too | ||
let us know! | ||
|
||
The best way to leave your feedback is a short user story on our issue | ||
[tracker](https://github.com/RustAudio/rodio/issues). If that is not your thing | ||
any other form posted there works too! | ||
|
||
### Architecture & API | ||
We can use input on our planned [changes](https://github.com/RustAudio/rodio/issues/614) and how to best implement them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.