I need a python library or module or whatever that can compare a .wav file to microphone input without too too much code. Sample code would be cool too. TY!
I don't know if there's a library already for that, but if you have the microphone input as a WAV file as well, you can use the wave and audioop modules and write it yourself.
If you're trying to compare something like, what words people are saying, this would have to be a fairly complex piece of code. You could directly compare them at a frequency/wave level, but you'll very rarely if ever get a match.
Related
I am learning python. I thought of a fun and do-able(for me as a noob) exercise to test myself with.
I want to write a script that asks the user for a string.. and then it translates the string into morse code and plays it. I just dont know how to access/play a sound file in Python... Doesnt really matter what type.. .wav .mp3 or whatever, just whatever works best with Python. It obviously will just be a short beep that will be played for a certain(very short) time length. I saw that people suggest using pygame.. is that the only option? For educational purposes I'd like to know how to do this with the standard library(if possible). If not a module is fine.
Or better yet, is there a way to create a beep sound with only python code? In other words no sound file needed at all. A function that says "make a sound at x frequency for x time"?
You could try the winsound library (built in).
By using winsound.PlaySound(filename,winsound.SND_FILENAME) you are able to play WAV audio files.
By using winsound.Beep(frequency(in Hz),duration(in miliseconds)) you should be able to produce a beeping sound.
There is a slight chance the Beep() function won't work, as is in my case, and i am currently looking into it.
Take a look at the docs here: https://docs.python.org/3.7/library/winsound.html
I am writing a basic piano style program that uses functions with winsound.Beep to play different note. I am new to multi-processing, and was wondering how I would be able to play two notes at once. If that is not possible, perhaps there is a way to combine frequencies that I do not know. Thanks for reading
~Jimnebob
It seems like Beep function couldn't play several notes at the same time. You can record the sound of 'Beep' through sounddevice library, save the sound in wav files. Then, use subprocess.Popen to achieve multiprocess. The subprocess would play the wav files.
I'm trying to write something that catches the audio being played to the speakers/headphones/soundcard and see whether it is playing and what the longest silence is. This is to test an application that is being executed and to see if it stops playing audio after a certain point, as such i don't actually need to really know what the audio itself is, just whether or not there is audio playing.
I need this to be fully programmatic (so not requiring the use of GUI tools or the like, to set up an environment). I know applications like projectM do this, I just can't for the life of me find anything anywhere that denotes how.
An audio level meter would also work for this, as would ossiliscope data or the like, really would take any recommendation.
Here is a very similar question: record output sound in python
You could try to route your output to a new device with jack and record this with portaudio. There are Python Bindings for portaudio called pyaudio and for jack called PyJack. I have never used the latter one but pyaudio works great.
Is it possible to get the system output audio (the exact same thing that goes through the speakers) and analyze it in real time with Python? My intention is to build a sound visualizer. I know that it is possible to access the microphone with pyaudio, but I was not able to access the sound card output in any way, I'm looking for a solution that works on Windows.
Thank you for reading.
Not sure how this project is doing these days, it's been a long time since it's been updated. PyVST allows you to run python code in a VST inside a VST host, which makes it possible to handle realtime audio events.
You might want to look at http://code.google.com/p/pyo/ for some ideas about how to handle DSP data as well.
I am searching for a way to write a simple python
program to perform an automatic edit on an audio file.
I wrote with PIL automatic picture resizing to a predefined size.
I would like to write the same for automatic file re-encoding into a predefined bitrate.
similarly, i would like to write a python program that can stretch an audio file and re-encode it.
do i have to parse MP3's by myself, or is there a library that can be used for this?
Rather than doing this natively in Python, I strongly recommend leaving the heavy lifting up to FFMPEG, by executing it from your script.
It can chop, encode, and decode just about anything you throw at it. You can find a list of common parameters here: http://howto-pages.org/ffmpeg/
This way, you can leave your Python program to figure out the logic of what you want to cut and where, and not spend a decade writing code to deal with all of the audio formats available.
If you don't like the idea of directly executing it, there is also a Python wrapper available for FFMPEG.
There is pydub. It's an easy to use library.