stegosphere.containers.audio package

Submodules

stegosphere.containers.audio.audio module

Defines containers for audio files.

class stegosphere.containers.audio.audio.AudioContainer(audio)

Bases: Container

General audio file container using pysoundfile (libsndfile). Supports reading, flushing new frames, and saving while preserving metadata.

flush(frames)

Buffer a new frame-array for later saving.

Parameters:

frames (numpy.ndarray) – Frames

Returns:

None

Raises:

ValueError – if provided frames is not in the correct format

read()

Read frames

save(path, flush=None, keep_meta=True)

Write audio to path. If flush is provided, buffers it first.

Parameters:
  • path (str) – output filepath

  • flush (numpy.ndarray, optional) – optional 2D numpy array to write instead of original

  • keep_meta (bool, optional) – whether to preserve samplerate/subtype/format

Module contents

class stegosphere.containers.audio.AudioContainer(audio)

Bases: Container

General audio file container using pysoundfile (libsndfile). Supports reading, flushing new frames, and saving while preserving metadata.

flush(frames)

Buffer a new frame-array for later saving.

Parameters:

frames (numpy.ndarray) – Frames

Returns:

None

Raises:

ValueError – if provided frames is not in the correct format

read()

Read frames

save(path, flush=None, keep_meta=True)

Write audio to path. If flush is provided, buffers it first.

Parameters:
  • path (str) – output filepath

  • flush (numpy.ndarray, optional) – optional 2D numpy array to write instead of original

  • keep_meta (bool, optional) – whether to preserve samplerate/subtype/format