0

I am trying to play an mp3 file with Python's kivy.

My code is:

from kivy.core.audio import SoundLoader

sound = SoundLoader.load('s.mp3')
if sound:
    print("Sound found at %s" % sound.source)
    print("Sound is %.3f seconds" % sound.length)
    sound.play()

It gives the following error:

[INFO   ] [Logger      ] Record log in /home/mohanraj/.kivy/logs/kivy_20-06-02_2.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "/home/mohanraj/Environments/kivy/lib/python3.7/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.7.7 (default, Apr 18 2020, 02:59:53) 
[GCC 9.3.0]
[INFO   ] [Python      ] Interpreter at "/home/mohanraj/Environments/kivy/bin/python3.7"
[INFO   ] [Audio       ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
[CRITICAL] [AudioSDL2   ] Unable to open mixer: b'No such audio device'
[WARNING] [Audio       ] Unable to find a loader for </home/mohanraj/Desktop/kivy/s.mp3>

When I try to play the audio with playsound library, the program is running successfully and finishes after 2min which is the length of the mp3 but audio is not played in my speaker.

I am using ubuntu20.04 operating system and Python3.7

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Mohan Raj
  • 167
  • 12

0 Answers0