earwax.ambiance module

Provides the Ambiance class.

class earwax.ambiance.Ambiance(protocol: str, path: str, coordinates: earwax.point.Point)

Bases: object

A class that represents a positioned sound on a map.

If you want to know more about the stream and path attributes, see the documentation for synthizer.StreamingGenerator.

Variables:
  • protocol – The protocol argument to pass to synthizer.StreamingGenerator``.
  • path – The path argument to pass to synthizer.StreamingGenerator.
  • coordinates – The coordinates of this ambiance.
  • sound

    The playing sound.

    This value is initialised as part of the play() method.

classmethod from_path(path: pathlib.Path, coordinates: earwax.point.Point) → earwax.ambiance.Ambiance

Return a new instance from a path.

Parameters:
  • path

    The path to build the ambiance from.

    If this value is a directory, then a random file will be chosen.

  • coordinates – The coordinates of this ambiance.
play(sound_manager: earwax.sound.SoundManager, **kwargs) → None

Load and position the sound.

Parameters:
  • sound_manager – The sound manager which will be used to play this ambiance.
  • kwargs – The additional keyword arguments to pass to play_path().
stop() → None

Stop this ambiance from playing.