Python

Adding Audio (mp3) to Python projects using vlc and PyCharm



In this tutorial we will add audio to a Python project by installing the VLC python module and importing the functionality. You will be able to use MP3, WAV and other file formats within your projects and use timers to ensure they play for their entirety. I will show you how to path your audio file and use simple scripts.

Remember you must install / activate the Python-vlc module within your project before you import the module into your file.

I like to use PyCharm Community version that…

Similar Posts

31 thoughts on “Adding Audio (mp3) to Python projects using vlc and PyCharm
  1. When I run the project after installing the VLC module I get this error message:

    Traceback (most recent call last):

    File "C:/Users/User/PycharmProjects/Giraffe/app.py", line 8, in <module>

    import vlc

    File "C:UsersUserPycharmProjectsGiraffevenvlibsite-packagesvlc.py", line 210, in <module>

    dll, plugin_path = find_lib()

    File "C:UsersUserPycharmProjectsGiraffevenvlibsite-packagesvlc.py", line 170, in find_lib

    dll = ctypes.CDLL(libname)

    File "C:UsersUserAppDataLocalProgramsPythonPython38-32libctypes_init__.py", line 373, in __init_

    self._handle = _dlopen(self._name, mode)

    FileNotFoundError: Could not find module 'libvlc.dll' (or one of its dependencies). Try using the full path with constructor syntax.

    Process finished with exit code 1

  2. this is my script:

    import vlc

    import time

    sound = vlc.MediaPlayer("C:/Users/trist/Documents/screaming sound")

    sound.start()

    time.sleep()

    this is my error:

    Traceback (most recent call last):

    File "C:/Users/trist/PycharmProject/sound/audio.py", line 1, in <module>

    import vlc

    File "C:UserstristPycharmProjectsoundvenvlibsite-packagesvlc.py", line 207, in <module>

    dll, plugin_path = find_lib()

    File "C:UserstristPycharmProjectsoundvenvlibsite-packagesvlc.py", line 167, in find_lib

    dll = ctypes.CDLL(libname)

    File "C:UserstristAppDataLocalProgramsPythonPython38-32libctypes_init__.py", line 373, in __init_

    self._handle = _dlopen(self._name, mode)

    FileNotFoundError: Could not find module 'libvlc.dll' (or one of its dependencies). Try using the full path with constructor syntax.

    please help

  3. Any way to display the current playlist or time left on a music file using the vlc module? The reason I'm asking is using a 3.5-inch display and the default VLC player is way to big to fit on the display.

  4. it just gives me this error message

    File "C:/Users/T/PycharmProjects/audio/a.py", line 4

    sound_file = vlc.MediaPlayer("C:UsersTDesktopMegalovania Shittyfluted.mp3")

    ^

    SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape

    is this because im using windows or is my computer just fucked up?
    thanks in advance

  5. Hello to everybody. I have a problem and is the next one:

    libdvdnav: Using dvdnav version 6.0.0
    libdvdread: Could not open D:BackuppcVideos with libdvdcss.
    libdvdread: Can't open D:BackuppcVideos for reading
    libdvdread: Device D:BackuppcVideos inaccessible, CSS authentication not available.
    libdvdread:DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.IFO failed
    libdvdread:DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.BUP failed
    libdvdread: Can't open file VIDEO_TS.IFO.
    libdvdnav: vm: failed to read VIDEO_TS.IFO

    someone knows what can i do?

Leave a Reply

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