#port-audio

portaudio-rs

PortAudio bindings for Rust

3 releases

Uses old Rust 2015

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

#4 in #port-audio

Download history 225/week @ 2024-06-18 194/week @ 2024-06-25 148/week @ 2024-07-02 192/week @ 2024-07-09 297/week @ 2024-07-16 195/week @ 2024-07-23 210/week @ 2024-07-30 188/week @ 2024-08-06 241/week @ 2024-08-13 218/week @ 2024-08-20 297/week @ 2024-08-27 289/week @ 2024-09-03 249/week @ 2024-09-10 368/week @ 2024-09-17 513/week @ 2024-09-24 347/week @ 2024-10-01

1,527 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

~155KB