.. a7 Graphics Object class .. _sound-label: Sound Support ============= These classes allow you to play sounds in your game. A sound is a WAV file that can be played on command via the method ``play``. While some platforms may support MP3s, we can only guarantee that WAVs work on all platforms. In order for Kivy to find a WAV file, you should put it in the **Sounds** directory. Sounds in that folder can be referenced directly by name. When a sound is played, it cannot be played again until it finishes, or is stopped. This means that if you want multiple, simultaneous sound effects from the same WAV file you will need to create multiple ``Sound`` objects. Class Sound ########### This is the primary class. It represents a sounds that can be played. Constructor ----------- .. autoclass:: game2d.Sound Attributes ---------- .. currentmodule:: game2d .. autoattribute:: Sound.volume .. autoattribute:: Sound.source Methods ------- .. automethod:: Sound.play Class SoundLibrary ################## This class implements to the dictionary interface to make it easier to load sounds and manage them. To load a sound, simply assign it to the library object, as follows:: soundlib['soundname'] = 'soundfile.wav' The sound library will load the sound and map it to ``'soundname'`` as the key. To play the sound, we access it as follows:: soundlib['soundname'].play()