PortAudio.jl is a wrapper for [libportaudio](http://www.portaudio.com/), which gives cross-platform access to audio devices. It is compatible with the types defined in [SampleTypes.jl](https://github.com/JuliaAudio/SampleTypes.jl), so it provides `PortAudioSink` and `PortAudioSource` types, which can be read from and written to.
The easiest way to open a source or sink is with the default `PortAudioSource()` and `PortAudioSink()` constructors, which will open a 2-channel stream to your system's default devices. The constructors also take a variety of positional arguments:
```julia
function PortAudioSink(eltype=Float32, sr=48000Hz, channels=2, bufsize=4096)
```
You can open a specific device by adding it as the first argument, either as a `PortAudioDevice` instance or by name.
```julia
function PortAudioSink(device::PortAudioDevice, args...)
function PortAudioSink(devname::AbstractString, args...)
```
You can get a list of your system's devices with the `PortAudio.devices()` function:
`PortAudioSource` and `PortAudioSink` are subtypes of `SampleSource` and `SampleSink`, respectively (from [SampleTypes.jl](https://github.com/JuliaAudio/SampleTypes.jl)). This means they support all the stream and buffer features defined there. You can read to a buffer with `buf = read(source)`