AUKit
Loading...
Searching...
No Matches
Public Member Functions | List of all members
aukit::stream Class Reference

Loader functions for streaming audio from a remote resource. These are usually used with aukit.play. More...

Public Member Functions

function‚ number ¦ nil adpcm (string ¦ fun() →string input, number blockAlign, number? channels, number? sampleRate, boolean? mono)
 Returns an iterator to stream data from IMA ADPCM data. aukit.Audio will automatically be resampled to 48 kHz, and mixed to mono if desired. Data must be in the interleaving format used in WAV files (i.e. periodic blocks with 4/8-byte headers, channels alternating every 4 bytes, lower nibble first). reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.
 
function‚ number aiff (string ¦ fun() →string data, boolean? mono, boolean? ignoreHeader)
 Returns an iterator to stream audio from an AIFF or AIFC file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.
 
function‚ number au (string ¦ fun() →string data, boolean? mono, boolean? ignoreHeader)
 Returns an iterator to stream data from an AU file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.
 
function‚ number ¦ nil dfpwm (string ¦ fun() →string data, number? sampleRate, number? channels, boolean? mono)
 Returns an iterator to stream audio from DFPWM data. aukit.Audio will automatically be resampled to 48 kHz. Multiple channels are expected to be interleaved in the encoded DFPWM data. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.
 
function‚ number flac (string ¦ fun() →string data, boolean? mono)
 Returns an iterator to stream data from a FLAC file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.
 
function‚ number ¦ nil g711 (string ¦ fun() →string input, boolean ulaw, number? channels, number? sampleRate, boolean? mono)
 Returns an iterator to stream data from u-law/A-law G.711 data. aukit.Audio will automatically be resampled to 48 kHz, and mixed to mono if desired. reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.
 
function‚ number ¦ nil mdfpwm (string ¦ fun() →string data, boolean? mono)
 Returns an iterator to stream audio from MDFPWMv3 data. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.
 
function‚ number ¦ nil msadpcm (string ¦ fun() →string input, number blockAlign, number? channels, number? sampleRate, boolean? mono, table? coefficients)
 Returns an iterator to stream audio from Microsoft ADPCM data. aukit.Audio will automatically be resampled to 48 kHz. reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.
 
function‚ number pcm (string ¦ function ¦ table data, number? bitDepth,("float" ¦ "signed" ¦ "unsigned")? dataType, number? channels, number? sampleRate, boolean? bigEndian, boolean? mono)
 Returns an iterator to stream raw PCM audio in CC format. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. Data must be interleaved - this will not work with planar audio. table of values (in the format specified by bitDepth and dataType), or a function that returns either of those types. Functions will be called at least once before returning to get the type of data to use. chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds the first chunk if using a function.
 
function‚ number ¦ nil wav (string ¦ fun() →string data, boolean? mono, boolean? ignoreHeader)
 Returns an iterator to stream audio from a WAV file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. This accepts PCM files up to 32 bits, including float data, as well as DFPWM files as specified here. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.
 

Detailed Description

Loader functions for streaming audio from a remote resource. These are usually used with aukit.play.

Member Function Documentation

◆ adpcm()

function‚ number ¦ nil aukit::stream::adpcm ( string ¦ fun() →string input,
number blockAlign,
number? channels,
number? sampleRate,
boolean? mono )

Returns an iterator to stream data from IMA ADPCM data. aukit.Audio will automatically be resampled to 48 kHz, and mixed to mono if desired. Data must be in the interleaving format used in WAV files (i.e. periodic blocks with 4/8-byte headers, channels alternating every 4 bytes, lower nibble first). reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.

Parameters
input(string ¦ fun()→string) The audio data as a raw string or
blockAlign(number) The number of bytes in each block
channels(number?) The number of channels present in the audio
sampleRate(number?) The sample rate of the audio in Hertz
mono(boolean?) Whether to mix the audio down to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds‚ or nil if data

◆ aiff()

function‚ number aukit::stream::aiff ( string ¦ fun() →string data,
boolean? mono,
boolean? ignoreHeader )

Returns an iterator to stream audio from an AIFF or AIFC file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.

Parameters
data(string ¦ fun()→string) The AIFF file to decode, or a function
mono(boolean?) Whether to mix the audio to mono
ignoreHeader(boolean?) Whether to ignore additional headers
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number) The total length of the audio in seconds

◆ au()

function‚ number aukit::stream::au ( string ¦ fun() →string data,
boolean? mono,
boolean? ignoreHeader )

Returns an iterator to stream data from an AU file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.

Parameters
data(string ¦ fun()→string) The AU file to decode, or a function
mono(boolean?) Whether to mix the audio to mono
ignoreHeader(boolean?) Whether to ignore additional headers
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number) The total length of the audio in seconds

◆ dfpwm()

function‚ number ¦ nil aukit::stream::dfpwm ( string ¦ fun() →string data,
number? sampleRate,
number? channels,
boolean? mono )

Returns an iterator to stream audio from DFPWM data. aukit.Audio will automatically be resampled to 48 kHz. Multiple channels are expected to be interleaved in the encoded DFPWM data. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.

Parameters
data(string ¦ fun()→string) The DFPWM data to decode, or a function
sampleRate(number?) The sample rate of the audio in Hertz
channels(number?) The number of channels present in the audio
mono(boolean?) Whether to mix the audio down to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds‚ or nil if data

◆ flac()

function‚ number aukit::stream::flac ( string ¦ fun() →string data,
boolean? mono )

Returns an iterator to stream data from a FLAC file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.

Parameters
data(string ¦ fun()→string) The FLAC file to decode, or a function
mono(boolean?) Whether to mix the audio to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number) The total length of the audio in seconds

◆ g711()

function‚ number ¦ nil aukit::stream::g711 ( string ¦ fun() →string input,
boolean ulaw,
number? channels,
number? sampleRate,
boolean? mono )

Returns an iterator to stream data from u-law/A-law G.711 data. aukit.Audio will automatically be resampled to 48 kHz, and mixed to mono if desired. reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.

Parameters
input(string ¦ fun()→string) The audio data as a raw string or
ulaw(boolean) Whether the audio uses u-law (true) or A-law (false).
channels(number?) The number of channels present in the audio
sampleRate(number?) The sample rate of the audio in Hertz
mono(boolean?) Whether to mix the audio down to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds‚ or nil if data

◆ mdfpwm()

function‚ number ¦ nil aukit::stream::mdfpwm ( string ¦ fun() →string data,
boolean? mono )

Returns an iterator to stream audio from MDFPWMv3 data. returning chunks to decode chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.

Parameters
data(string ¦ fun()→string) The MDFPWM data to decode, or a function
mono(boolean?) Whether to mix the audio down to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds‚ or nil if data

◆ msadpcm()

function‚ number ¦ nil aukit::stream::msadpcm ( string ¦ fun() →string input,
number blockAlign,
number? channels,
number? sampleRate,
boolean? mono,
table? coefficients )

Returns an iterator to stream audio from Microsoft ADPCM data. aukit.Audio will automatically be resampled to 48 kHz. reader function chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds is a function.

Parameters
input(string ¦ fun()→string) The audio data as a raw string or
blockAlign(number) The number of bytes in each block
channels(number?) The number of channels present in the audio
sampleRate(number?) The sample rate of the audio in Hertz
mono(boolean?) Whether to mix the audio down to mono
coefficients(table?) Two lists of coefficients to use
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds‚ or nil if data

◆ pcm()

function‚ number aukit::stream::pcm ( string ¦ function ¦ table data,
number? bitDepth,
("float" ¦ "signed" ¦ "unsigned")? dataType,
number? channels,
number? sampleRate,
boolean? bigEndian,
boolean? mono )

Returns an iterator to stream raw PCM audio in CC format. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. Data must be interleaved - this will not work with planar audio. table of values (in the format specified by bitDepth and dataType), or a function that returns either of those types. Functions will be called at least once before returning to get the type of data to use. chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds the first chunk if using a function.

dataType:
| "signed"
| "unsigned"
| "float"
Parameters
data(string ¦ function ¦ table) The audio data, either as a raw string, a
bitDepth(number?) The bit depth of the audio (8, 16, 24, 32); if dataType is "float" then this must be 32
dataType(("float" ¦ "signed" ¦ "unsigned")?) The type of each sample
channels(number?) The number of channels present in the audio
sampleRate(number?) The sample rate of the audio in Hertz
bigEndian(boolean?) Whether the audio is big-endian or little-endian; ignored if data is a table
mono(boolean?) Whether to mix the audio down to mono
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number) The total length of the audio in seconds‚ or the length of

◆ wav()

function‚ number ¦ nil aukit::stream::wav ( string ¦ fun() →string data,
boolean? mono,
boolean? ignoreHeader )

Returns an iterator to stream audio from a WAV file. aukit.Audio will automatically be resampled to 48 kHz, and optionally mixed down to mono. This accepts PCM files up to 32 bits, including float data, as well as DFPWM files as specified here. returning chunks to decode (the first chunk MUST contain the ENTIRE header) if they appear later in the audio stream chunks of each channel's data as arrays of signed 8-bit 48kHz PCM, as well as the current position of the audio in seconds.

Parameters
data(string ¦ fun()→string) The WAV file to decode, or a function
mono(boolean?) Whether to mix the audio to mono
ignoreHeader(boolean?) Whether to ignore additional headers
Returns
(fun()→number❲❳❲❳ ¦ nil‚ number ¦ nil) An iterator function that returns
(number ¦ nil) The total length of the audio in seconds

The documentation for this class was generated from the following file: