I am working on a group project. We are looking to develop a program that can receive audio via laptop microphone and compare it to a saved audio file and output a audio message if the input and saved files match. Audios may be speeches, music or songs.
We would like to compare audio files with some sort of python method, but we haven't been able to find any way to do this. We are looking for a library of some sort or another to be able to take data from each file and see if they are similar.
We have watched a lot of tutorials, searched the web and still need some major help. Could someone explain to us how to get started?
Instead of comparing audios, Try converting audio to spectrogram using python of both audio files & Compare both images. You can best results.
But if you want to process only audio files Yes, there some libraries which you can use.
1. Librosa - Python library for audio and music analysis
link for Librosa
Try project dejavu,it really helps.It's based on Numpy.
However, if you just want to filter audio files, Yes, there are some python libraries you can use.
Here is the link for one;
https://pypi.org/project/SpeechRecognition/
or use pip install SpeechRecognition to install
Hope this solves your problem.
Related
So I decided to try making a screen recorder and I was following a tutorial.
So, the code works exactly as it should but after I finish the code and try running the .avi file I get the following error:
I searched around the web but I couldn't find the answer for my question, you guys have any idea?
OpenCV uses FFMPEG under the hood and ships release builds without the proprietary codecs you often need. I’ve been compiling OpenCV from source for 10 years and have successfully gotten good and repeatable codecs maybe once. Here are my recommendations...
Did the video play in VLC? That often is more forgiving. Use VLC first to troubleshoot the rest of your code if it plays there.
Play with many different FOURCC codes. When using only free codecs, you have to iterate through a lot of them before finding a valid match. Also, I’ve found that settings such as too low a frame rate can cause players to not work well.
Build a copy of FFMPEG from source with non-free drivers, then build OpenCV from source using those. This is a rabbit hole of doom though cause each codec is itself a separate package and install. You will spend a lot of time learning how to build software.
Use OpenCV for image processing and write video using a video writer API directly. Libav/FFMPEG, libx264, and others all have direct callable APIs so you can use them.
I have a project. What I want to do is that I want to read audio data from soundcard without saving it but the main important thing is that the audio data that the python is reading I want to check if some certain audio is played
Before the answer:
In SO you should post your initial ideas, and say what you tried.
And then the answers can be more relevant and informative.
About your question: you can use pyaudio
It is:
PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms.
There are multiple code examples for it, you can Google it.
I'm looking to make an audio editor using Python for a project in which I'm not allowed to use modules that need be downloaded (I can only do a simple import ).
I want to be able to have users upload a file (preferably in mp3 or some other common format for all operating systems) and be able to play back and edit it. I also need to write out a mp3 file with the new audio.
Would this be feasible in Python 2.7 without outside modules?
EDIT: This will be hosted online if that makes any difference.
Would any of these audio modules help?
audioop is a built-in module to manipulate raw audio data. It requires a format such as .WAV but you could either convert that separately or in the program.
If you want to simply upload wav files to be used with audioop, consider looking at the wave module.
For a website i am developing in django i need users to be able to upload .wav or .aif files. I, of course, have to make sure these files really are what they pretend to be - audiofiles. The files then are provided on the webpage, where i need them to be either .ogg or .mp3
While searching for a solution i stumbled across some fearsome possibilities, like using ctypes to handle external libraries. I also found, of course, PyMedia, which i cannot use because i develop on MacOSX. And the python audio tools provide a lot of functionality i do not need.
So far i can see a few possibilities that would satisfy me and are within reach of my programming capabilities:
1 Get PyMedia to run on MacOSX
2 Find a way to use some modules of the python audio tools without the need to use libcdio
3 use python subprocess to run the command line tools of the converters
As i have used none of those tools yet, i can't tell which would possibly be the quickest way to solve my problem. If you Python-Audio-Gurus are out there, could you please share some thoughts? Or maybe you even have a fantastic 1-step-to-happiness solution?
Not strictly a pythonic answer, but perhaps take a look at sox which is a simple command line audio file converter. It can do resampling of audio files for you as well.
Check out the command line options of sox for details. This will of course involve calling the external program using the subprocess module(or other method).
I'm looking for python code that can convert .wav or other format to FLAC or mpeg. I hope there is one that doesn't depend on other binaries or libraries and just pure python so that it can run independently anywhere where python is installed ie also serverside. Do you know any examples?
Thanks
Python Audio Tools seems to fit your description.
Worst case, you'd have to rip the source code out and go from there.
As others have said, there are other alternatives.