You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The crates rodio or cpal could possibly be used for the audio.
Creating an 'beep' sound with rodio is easy, but a new instance of source is needed everytime the audio is played.
Ex. code for 'beep' in rodio:
use std::time::Duration;
use rodio::{OutputStream, Sink};
use rodio::source::{SineWave, Source};
fn main() {
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap();
// Add a dummy source of the sake of the example.
let source = SineWave::new(440.0).take_duration(Duration::from_secs_f32(0.25)).amplify(0.20);
sink.append(source);
// The sound plays in a separate thread. This call will block the current thread until the sink
// has finished playing all its queued sounds.
sink.sleep_until_end();
}
Things to note:
Does rodio (or cpal) affect the timing of the CPU cycle?
Does rodio or cpal have WASM support?
The text was updated successfully, but these errors were encountered:
The crates rodio or cpal could possibly be used for the audio.
Creating an 'beep' sound with
rodio
is easy, but a new instance ofsource
is needed everytime the audio is played.Ex. code for 'beep' in
rodio
:Things to note:
rodio
(orcpal
) affect the timing of the CPU cycle?rodio
orcpal
have WASM support?The text was updated successfully, but these errors were encountered: