3 releases

Uses old Rust 2015

0.3.2 May 14, 2020
0.3.1 Jun 11, 2019
0.3.0 Mar 6, 2017

#418 in Audio

Download history 401/week @ 2024-11-17 489/week @ 2024-11-24 387/week @ 2024-12-01 573/week @ 2024-12-08 448/week @ 2024-12-15 513/week @ 2024-12-22 520/week @ 2024-12-29 333/week @ 2025-01-05 498/week @ 2025-01-12 421/week @ 2025-01-19 463/week @ 2025-01-26 476/week @ 2025-02-02 384/week @ 2025-02-09 321/week @ 2025-02-16 358/week @ 2025-02-23 349/week @ 2025-03-02

1,462 downloads per month
Used in 9 crates (3 directly)

MIT license

52KB
1K SLoC

portaudio-rs

Build Status

Documentation

PortAudio bindings for Rust

See http://portaudio.com/

Example

extern crate portaudio_rs as portaudio;

fn demo() -> portaudio::PaResult
{
    let stream = try!(portaudio::stream::Stream::open_default(
                          0, // input channels
                          1, // output channels
                          44100.0, // sample rate
                          portaudio::stream::FRAMES_PER_BUFFER_UNSPECIFIED,
                          None // no callback
                     ));

    try!(stream.start());

    let mut phase = 0.0f32;
    let mut buffer = Vec::with_capacity(44100);
    for _i in (0..44100)
    {
        // Small amplitude such that the test does not produce sound
        buffer.push(phase * 0.001);

        phase += 0.03;
        if phase > 1.0 { phase -= 2.0; }
    }

    try!(stream.write(&buffer));

    Ok(())
}

fn main()
{
    portaudio::initialize().unwrap();
    println!("{:?}", demo());
    portaudio::terminate().unwrap();
}

Dependencies

~165KB