Audio — Kivy v1.0.1-dev documentation

# Audio

Core class for loading and play sound.

Note

Recording audio is not supported.

class `kivy.core.audio.` `Sound`(**kwargs)

  Bases: `kivy.event.EventDispatcher`

  Represent a sound to play. This class is abstract, and cannot be used directly. Use SoundLoader to load a sound !

  Events : | on_play : None Fired when the sound is played on_stop : None Fired when the sound is stopped

  `filename`

    Get/set the filename/uri of the sound

  `length`

    Get length of the sound (in seconds)

  `load`()

    Load the file into memory

  `play`()

    Play the file

  `seek`(position)

    Seek to the <position> (in seconds)

  `status`

    Get the status of the sound (stop, play)

  `stop`()

    Stop playback

  `unload`()

    Unload the file from memory

  `volume`

    Get/set the volume of the sound

class `kivy.core.audio.` `SoundLoader`

  Load a sound, with usage of the best loader for a given filename. If you want to load an audio file

      sound = SoundLoader.load(filename='test.wav')
      if not sound:
          # unable to load this sound ?
          pass
      else:
          # sound loaded, let's play!
          sound.play()

  static `load`(filename)

    Load a sound, and return a Sound() instance

  static `register`(classobj)

    Register a new class to load sound