API

Sources

Each AudioSource is a subtype of AbstractAudioSource and allows to load audio data in a unified format.

AudioSources.AbstractAudioSourceType
abstract type AbstractAudioSource end

Abstract class for all audio sources. Possible sources are:

  • CmdAudioSource
  • FileAudioSource
  • RawAudioSource
  • URLAudioSource

Lib:

  • Recorder
source

Command

File

Raw

URL

Functions

AudioSources.loadFunction
load(s::AbstractAudioSource, subrange::Union{AbstractRange, Colon} = :, ch=1)

Get the audio data and sampling rate for desired subrange and channel. Return (data, fs)

source
Base.showMethod
Base.show(io::IO, ::MIME"text/html", s::AbstractAudioSource)

In HTML context, show an AbstractAudioSource as audio tag.

source

Recorder Lib

AudioSources.RecorderLib.RecorderType
mutable struct Recorder

Object to store recording parameters and recorded data.

Fields

  • fs::Int sampling rate, in Hz
  • chunkduration::Float64 record by chunks of chunkduration length
  • chunksize::Int ≈ chunkduration*fs
  • channel::Channel used for async communication
  • data::AbstractArray store the recorded audio
  • datatype::DataType type of the data array elements
source
AudioSources.RecorderLib.RecorderType
Recorder(; <keyword arguments>)

Initialize Recorder with default values if not specified.

Arguments

  • fs::Int = 16000 sampling rate, in Hz
  • chunkduration::Float64 = 0.5 record by chunks of chunkduration length
  • datatype::DataType = Float32 data type to store the data, Floats are recommanded
source
AudioSources.RecorderLib.startFunction
start(r::Recorder, erase=true)

Start recording. Recommended to run it asynchronously (@async start(rec)). Set erase to true to reset the previously recorded data, otherwise the new recording is appended to the previous one.

source

Index