OpenJTalk.Wav (open_jtalk_elixir v0.3.0)

View Source

Minimal WAV utilities: parse and concatenate WAVs that share the same format.

Supported formats:

  • PCM (audio_format = 1)
  • IEEE float (audio_format = 3)

Notes:

  • All inputs must have identical: audio_format, channels, sample_rate, bits_per_sample, block_align, byte_rate, and any format-extra bytes.
  • This module ignores non-essential chunks (e.g., LIST, cue). The output contains a canonical fmt (format) and data only, sized correctly for the combined audio.

Summary

Types

Parsed fmt (format) information.

Functions

Concatenate multiple WAV binaries into a single valid WAV.

Read and concatenate multiple WAV files indicated by paths.

Types

format()

@type format() :: %{
  audio_format: 1 | 3,
  channels: pos_integer(),
  sample_rate: pos_integer(),
  byte_rate: pos_integer(),
  block_align: pos_integer(),
  bits_per_sample: pos_integer(),
  extra: binary()
}

Parsed fmt (format) information.

Functions

concat_binaries(list)

@spec concat_binaries([binary()]) :: {:ok, binary()} | {:error, term()}

Concatenate multiple WAV binaries into a single valid WAV.

All inputs must have the same format parameters (PCM/float, channels, rate, etc.).

Returns {:ok, binary} or {:error, reason}.

concat_files(paths)

@spec concat_files([Path.t()]) :: {:ok, binary()} | {:error, term()}

Read and concatenate multiple WAV files indicated by paths.

Returns {:ok, binary} or {:error, {:file_read_failed, path, reason}}.