Playing MP3 File in Kivy Using Python

Learn how to play MP3 file in Python using Kivy.

Play MP3 File in Kivy Using SoundLoader in Python

Here we are going to play mp3 file in kivy using Python Programming Language. In kivy mp3 sound files are implemented using the SoundLoader module which is present in It is imported as follows

from import SoundLoader

The SoundLoader consists of various operations to be performed on sound files as follows

  • load(): This will help us to load the mp3 file.
  • play(): This is used to play the mp3 file.
  • stop(): It is used to stop playing an mp3 file.

The following code gives a complete implementation of playing a sound file.

import kivy
from import App
from kivy.uix.label import Label
from import SoundLoader
class music(App):
    def build(self):
        return Label(text="music playing")
    if sound:


Play MP3 File in Kivy Using SoundLoader in Python

We get the output as a kivy window with description music playing and the mp3 file gets played as soon as the kivy window is opened.

from import App

This will help us to create a window on which we will perform our operations.

from import SoundLoader

It will import the modules that are necessary for executing sound files in kivy.


This will load the mp3 file and we are assigning this to an object called sound.

if sound:

Here, the sound object returns True only if it’s a sound file and we are playing sound using play() with the help of a sound object.

3 responses to “Playing MP3 File in Kivy Using Python”

  1. Lemarchand says:

    Hello, this was what I’ve been looking for. I mean I have the ideas but you code it.
    Now I have to gain more practice with kivy and try to make something more complicated.

  2. sunil shrimali says:

    after building app i cannot able to access music file, i am using os module to fetch all mp3 files

  3. Deepak says:

    Place .py file and music files in same folder.

Leave a Reply

Your email address will not be published. Required fields are marked *