No download module to manipulate sound with MP3 in Python? - python

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.

Related

Audio Recognition using python

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.

Python reading audio from sound card

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.

Library Host audio OSX

Currently running a project in python which create a bunch of midi files, then map them to the OSX Host audio unit.
We've been using pyau, which worked fined with some library, but won't work now with kontakt5 and library like Shevannay (also not maintained since along time ago).
I've been over github, the python page music, google over the last week, to find a project up to date, that would fill our need (read midi file, create an host, load vst and presets and export it in any audio format).
If the library isn't in python that doesn't matter, our python script are writting midi file, so i'm okay to do read and map it to a host in any other language.
But all answer i could get were rewritting an host in c++ using juce, I don't think i actually need to writte my own code for that, they are probably people that have done that in a better way that i could do it.

Best python solution to play ALL kinds of audio on Windows (and Linux)?

I'm trying to write some scripts to play some of my music collection with python. Finding python modules that will play ogg and mp3 is not a problem. However, I'm having repeated failures with aac-encoded m4a files from iTunes (not DRM). pygame's audio machinery doesn't support them, so I tried pymedia:
a = pymedia.player.Player()
a.start()
a.startPlayback("myM4a.m4a", format='aac')
I've tried several versions of the last line of code, including omitting the format argument, changing the files to mp4, etc. mp3's work fine, however.
pymedia even claims to support aac encoded files, but the project appears to have been abandoned anyway.
Is there a good, up to date, solution for playing ALL types of audio in python? What is used by existing python media centers/players?
I should add that I intend to use this primarily on windows, so windows support for the library is a must, but cross-platform would obviously be preferable.
You should look at the gStreamer API. It has plugins for many major audio types, is used by many audio players including Banshee and Rhythmbox and it can run on Linux, Windows and Mac. It has Python bindings as well as bindings for many other languages:
http://gstreamer.freedesktop.org/bindings/
MPlayer plays most known audio formats, and there's Python wrapper for it:
http://code.google.com/p/python-mplayer/
And a list of audio codecs supported by MPlayer:
http://www.mplayerhq.hu/DOCS/codecs-status.html#ac

Quick way to validate and convert Audio Files with Python?

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).

Categories

Resources