0

How do i play a audio file in python?

i googled this and i only got more confused.

18th Oct 2018, 12:42 AM
LONGTIE👔
LONGTIE👔 - avatar
13 Antworten
+ 2
DESKTOP answer...you could leverage the strength of VideoLAN--they wrote the FOSS (free+open source) VLC media player. Prerequisites: VLC media player from https://www.videolan.org/ git (Linux easy, Windows: https://gitforwindows.org/ ) Get the Python bindings for VLC: ~ From a command-line prompt, change to your project dir, then type this to retrieve the repository files: git clone http://git.videolan.org/git/vlc/bindings/python.git And test with this source code: from python.generated.dev import vlc p = vlc.MediaPlayer("C:\\path\\to\\your.mp3") p.play()
18th Oct 2018, 2:18 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Kirk Schafer the third link gave me a 404 error. what dose VideoLAN mean?
18th Oct 2018, 2:29 AM
LONGTIE👔
LONGTIE👔 - avatar
+ 2
[Corrected post] I updated the text to clarify "VLC media player" from the VideoLAN open source project group: https://en.wikipedia.org/wiki/VideoLAN Sorry about the confusion. That link does work for me, can you copy+paste it from the answer using "Copy Text" from the menu on the right edge of each answer? I can look for a GUI method + post the text in a code if that helps. (Note, the "git clone ..." line has to be typed from a command line)
18th Oct 2018, 2:47 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Underneath the repository title, there's a link symbol next to https://gitforwindows.org/ which actually has the friendly [Download] button. I'll fix that too. This is version control software as described in expanded Lessons here on SoloLearn. Once you install it you should be able to type the "git clone ..." line at a command prompt. (If you type it in the same place you have your Python source code, it will create a subdirectory called "python" containing the VLC library)
18th Oct 2018, 3:07 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Kirk Schafer sorry if im bothering you with stupid questions.
18th Oct 2018, 3:09 AM
LONGTIE👔
LONGTIE👔 - avatar
+ 2
Yep, at the command prompt; you only have to get ("git clone") it once. I went this way because I read that this method got the most recent / not buggy code. I'm looking at how to make this a normally-installed package (like from pip), but hoped to just have it work first.
18th Oct 2018, 3:57 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
LONGTIE👔 I think you're really close here, but because this is all about one import...I'm personally okay with it if you relabeled this + wanted to explore other audio methods in a new thread. That might give you more simultaneous contributors too.
18th Oct 2018, 4:15 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
Ah, but you're teaching me all the steps I omit because of "experience". This is not a problem.
18th Oct 2018, 3:14 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
In the directory from which you plan to run the Python code: git clone http://git.videolan.org/git/vlc/bindings/python.git
18th Oct 2018, 3:41 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
LONGTIE👔 , i had that same question myself, best i could do was snoop around but in the end it left me always feeling that i just wasted time.. but a couple of days ago i happened to see this app on googlePlayStore called : openHub i used it once and absolutely loved it! i still barely know whats going on at gitHub but i'm enjoying my time spent there. The app openHub takes you to places and does all of the interfacing details for you, anyways that's how i feel about , perhaps my view won't be the same next time. i used it only once and that was in the wee hours of the early morn when you hear the birds begin to sing.. but do checkit out as soon as possible, i think you'll love it!
18th Oct 2018, 4:07 AM
niteOwLTwO
niteOwLTwO - avatar
0
Kirk Schafer what do i do at the github link?
18th Oct 2018, 3:00 AM
LONGTIE👔
LONGTIE👔 - avatar
0
Kirk Schafer ok, github thing installed, whats the exact command?
18th Oct 2018, 3:31 AM
LONGTIE👔
LONGTIE👔 - avatar
0
Kirk Schafer so i would type that in the command prompt, if thats where im running the code.
18th Oct 2018, 3:47 AM
LONGTIE👔
LONGTIE👔 - avatar