I have been looking for ages on ways to find out how to make idle python play sound such as wav.
The solutions I have found are used by programs such as pygame. I can't download pygame or any other program.
Many thanks
To play a sound without downloading anything, you use the code:
import winsound
winsound.PlaySound('FILENAMEHERE.wav', winsound.SND_FILENAME)
keep everything the same apart from FILENAMEHERE
Why are you unable to download anything? https://pypi.python.org/pypi/playsound/1.2.1 - link for playsound module it is very easy to download. You can download it using pip by navigating with cmd to your python folder (usualy C:\Users\UserName\AppData\Local\Programs\Python\Python35-32) and writing: python -m pip install playsound (if you are using python 3). I think that is the easiest and the fastest way for you to play sound if you have any other questions about this let me know.
p.s
If you need to you can download pip here: https://pip.pypa.io/en/stable/installing/https://pip.pypa.io/en/stable/installing/
Hope I was helpful. :)
Related
Downloaded the sound from https://sounds-mp3.com/, and the syntax of the playsound was from the official site of it. Still there is no sound played and giving me the below mentioned output of execution.
from playsound import playsound
playsound('C:\\Users\\HP\\Downloads\\0003537.mp3')
output:
python -u "c:\Users\HP\Desktop\python files\hello.py"
I doubt it is a problem with the code, it looks fine.
It might be to do with your speakers or the audio file. Try out a wav and see if that works. Check your path too. I have had problems in the past with files downloaded from the web so maybe record something on Audacity and see if that plays. Try playing the audio file with the default software for your os, does it work?
So basically I was trying to create a music playing program that would play music when you asked it to. I was just trying to get the song playing portion to actually work, so I wrote a super simple code to test it out:
import playsound
playsound('sample.mp3')
This was done in replit, and I added the mp3 file into the files section
when I hit run, it gives me TypeError: 'module' object is not callable. What can I do to fix this?
you need to install the PyObjC by writing below command.
if you are using python version 3
pip3 install PyObjC
if you are using python version 2
pip install PyObjC
After that you write below code in your terminal
from playsound import playsound
playsound("path of your audio file/testing_audio_file.mp3")
if you are facing any issue regarding path then use below pattern for (use two forward slash) Windows
playsound("D:\\path_of_your_audio_file\\testing_audio_file.mp3")
Replace
import playsound
with...
from playsound import playsound
I am trying to play sound in Python. When I run my code, it finishes successfully but the audio is not played by my computer.
I have tried with all the libraries like playsound, simpleaudio, pydub and kivy core audio.
Sample code I tried is:
from playsound import playsound
playsound('myfile.wav')
As i think it should work, check either your audio file (maybe it's empty) or check your audio drivers and audio output.
OR, You can try
pip install playsound
one more time
I've had this problem before, use the complete path:
from playsound import playsound
playsound(r"C:\some\path\sound.mp3") # the "r" is necessary, or else your code wont work!
in the last couple of days I was developing an APP on python IDLE.
I tried to import the vlc module, when I run it I get this error:
OSError: dlopen(libvlccore.dylib, 6): image not found
I installed the module with this command: pip install python-vlc.
I hope you can help me getting it work!
Thanks in advance!
Zaid Zaim
python-vlc is just Python bindings for libVLC.
Without that library, it won't do you any good, because all it does is try to load that library (a .dylib, .so, or .dll, depending on your platform) and call functions out of it.
There should be installation instructions at the wiki page linked above, but on a Mac, the easiest way is to just install the VLC player. I know that if you install it with Homebrew, you get the library, in a location that python-vlc can find. But I think even the binary installer from the front page of the main VideoLAN website will work as well.
If you're using Homebrew, you'll want to read the docs for when to search brew vs. brew cask vs. other taps,1 or search somewhere like Mac App Store for the current status. But at present, the appropriate command appears to be:
brew cask install vlc
1. Generally, anything that you'd expect to find as a double-clickable app in /Applications, as opposed to a Unix command-line tool or a support library, is going to be a cask, and therefore in the tap cask, which has special shortcuts to access it. But that's a relatively new thing, and not every recipe has been converted yet.
brew install --cask vlc
Is the latest command, and it works for me!
So, I'm trying to make a simple keylogger and I have this next bit of code:
try:
import pyHook, pythoncom
except:
os.system("pip install pypiwin32")
os.system("pip install pyHook")
import pyHook, pythoncom
the installation of pypiwin32 works, and after doing the command
os.system("pip install pypiwin32")
I can use pythoncom.
however, the second command doesn't seem to work.
I want this to work on every computer, hence - without a need to download a whl file. is it possible to install pyHook like that?
thanks.
I mean. Your asking people to help you to essentially steal stuff. But sure I'll help. https://pypi.python.org/pypi/keyboard/
Check this out
I don't think your code would 100% work on an pcs.