Kerbi
Kerbi

Reputation: 1

Kivy sound not looping

I am fairly new to kivy and python and have been working on an idea for an app for some time now. I would like sound to 'loop' at certain points in the app so I have been experimenting with SoundLoader recently.

Interesting thing is when I first used started using it, sound worked and looped as expected. However, after some additions to implement the sound as I would like I noticed that it no longer loops but rather just plays the sound once.

I using Ubuntu 14.04 LTS and kivy version 1.9.0.

Code I am using for sound:

from kivy.core.audio import SoundLoader
tmp=SoundLoader.load('tmp.wav')
tmp.loop = True
tmp.play()

Upvotes: 0

Views: 1519

Answers (1)

user4612771
user4612771

Reputation:

this can be implemented by using the Clock module to sort of repeat the playing of the sound, i adapted this from the kivy app fast perception..

def check_sound(self, dt = None):
        self.sound.play()



from kivy.core.audio import SoundLoader
tmp=SoundLoader.load('tmp.wav')
tmp.play()
Clock.schedule_interval(self.check_sound, 1)

i hope this helps..

Upvotes: 1

Related Questions