WavFileGenerator

org.llm4s.speech.io.WavFileGenerator

Eliminates code duplication in WAV file generation across the speech module. Provides centralized WAV file creation, format conversion, and temporary file management.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

sealed trait WavError extends LLMError

Attributes

Supertypes
trait LLMError
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
final case class WavGenerationFailed(message: String, context: Map[String, String]) extends WavError

Attributes

Supertypes
trait WavError
trait LLMError
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class WavSaveFailed(message: String, context: Map[String, String]) extends WavError

Attributes

Supertypes
trait WavError
trait LLMError
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def createJavaAudioFormat(meta: AudioMeta): AudioFormat

Create a Java AudioFormat from AudioMeta

Create a Java AudioFormat from AudioMeta

Attributes

def createTempWavFile(prefix: String): Result[Path]

Create a temporary WAV file with the given prefix

Create a temporary WAV file with the given prefix

Attributes

def createWavFromBytes(data: Array[Byte], meta: AudioMeta): Result[GeneratedAudio]

Create WAV file from raw bytes with metadata

Create WAV file from raw bytes with metadata

Attributes

def createWavHeader(dataSize: Int, meta: AudioMeta): Array[Byte]

Utility for creating WAV headers manually (advanced usage) Uses implicit binary writers for clean little-endian format

Utility for creating WAV headers manually (advanced usage) Uses implicit binary writers for clean little-endian format

Attributes

def managedTempWavFile(prefix: String): ManagedResource[Path]

Create a managed temporary WAV file that gets deleted automatically

Create a managed temporary WAV file that gets deleted automatically

Attributes

def readWavFile(path: Path): Result[GeneratedAudio]

Read WAV file and return GeneratedAudio

Read WAV file and return GeneratedAudio

Attributes

def saveAsWav(audio: GeneratedAudio, path: Path): Result[Path]

Save GeneratedAudio as WAV file using ManagedResource (eliminates duplication from AudioIO.saveWav)

Save GeneratedAudio as WAV file using ManagedResource (eliminates duplication from AudioIO.saveWav)

Attributes

def saveRawPcmAsWav(data: Array[Byte], meta: AudioMeta, path: Path): Result[Path]

Save raw PCM data as WAV file (eliminates duplication from AudioIO.saveRawPcm16)

Save raw PCM data as WAV file (eliminates duplication from AudioIO.saveRawPcm16)

Attributes

def writeToTempWav(data: Array[Byte], meta: AudioMeta, prefix: String): Result[Path]

Write audio data to temporary WAV file and return the path (eliminates duplication in TTS implementations)

Write audio data to temporary WAV file and return the path (eliminates duplication in TTS implementations)

Attributes