View Source ExAzureSpeech.Common.ReplayableAudioStream (ex_azure_speech v0.1.0)
Implements a way to read audio-streams with the capability to rewing and restart from a specific offset point.
Summary
Types
stream: Underlying stream of audio data.
buffer: The binary buffer to hold streammed data.
buffer_offset: The current offset in the buffer, each 1 increase in the offset represents 100ns of audio.
last_read_offset: The last offset reead from the source stream.
bytes_per_second: The number of bytes per second in the audio stream. Calculated as sample_rate bits_per_sample channels.
chunk_size: The size in bytes of the chunk to read from the buffer.
Functions
Reads a chunk of audio from a streamable source, buffering it and returning the chunk. This approach allows rewinding the stream to a specific offset point, replay it and continue reading from the stream from point onwards.
Shrinks the buffer, discarding everything before the current offset.
Types
@type t() :: %ExAzureSpeech.Common.ReplayableAudioStream{ buffer: binary(), buffer_offset: non_neg_integer(), bytes_per_second: non_neg_integer(), chunk_size: non_neg_integer(), last_read_offset: non_neg_integer(), stream: Enumerable.t() }
stream: Underlying stream of audio data.
buffer: The binary buffer to hold streammed data.
buffer_offset: The current offset in the buffer, each 1 increase in the offset represents 100ns of audio.
last_read_offset: The last offset reead from the source stream.
bytes_per_second: The number of bytes per second in the audio stream. Calculated as sample_rate bits_per_sample channels.
chunk_size: The size in bytes of the chunk to read from the buffer.
Functions
Reads a chunk of audio from a streamable source, buffering it and returning the chunk. This approach allows rewinding the stream to a specific offset point, replay it and continue reading from the stream from point onwards.
Shrinks the buffer, discarding everything before the current offset.