I'm having a little bit of programing and conversion trouble. I'm designing an AI to recognize notes played by instruments and need to extract the raw sound data from a wave file. My objective is to perform a FFT operation over chunks of time in the file for use by the AI. For this I need an amplitude list of the audio file, but I can't seem to find a conversion technique that will work. The files start as MP3's and then I convert them to wav file, but I always end up with a compressed file that spits out gibberish when I try to read it. Does anyone know how I might convert the wav file to something that would be compatible with Python's wave module or even something that would directly convert the data into an amplitude list?
Extracting an amplitude list from *.wav file for use in Python
11.9k Views Asked by AlexL At
2
There are 2 best solutions below
0
Nash Rose
On
I believe Python can read .dat files. You can use SoX to turn mp3s or wavs or whatever into .dat files that are simply a text list of "time - Left amp - Right amp"
The code is simply sox soundfile.mp3 soundfile.dat
Sox is command line - I run it with Terminal on my mac, but anything that understands Bash or Linux commands should work depending on what cpu you're using.
Hope that helps!
You might want to look at Pure Data too, it's got some nice FFT transforms built into an intuitive graphical programming language.
Related Questions in PYTHON
- new thread blocks main thread
- Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
- Display images on Django Template Site
- Difference between list() and dict() with generators
- How can I serialize a numpy array while preserving matrix dimensions?
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Why is my program adding int as string (4+7 = 47)?
- store numpy array in mysql
- how to omit the less frequent words from a dictionary in python?
- Update a text file with ( new words+ \n ) after the words is appended into a list
- python how to write list of lists to file
- Removing URL features from tokens in NLTK
- Optimizing for Social Leaderboards
- Python : Get size of string in bytes
- What is the code of the sorted function?
Related Questions in WAV
- Release a wav file from being used by a process
- How to join mp3 and wav files
- Windows - sound recording program giving noise
- QSound::play("soundpath") call works but a QSound object doesn't
- How to save an audio capture in a wav file using ASIO and Naudio?
- Change WAV File In C
- Building OPENSMILE with portaudio in vs2012 fail
- Invalid format with getAudioInputStream, trying to play a sound in Java
- Loading and playing multiple .wav files in java
- Playing a wav file from a MemoryStream windows phone 8.1
- How to add echo effect to wav file in android?
- Export buffer to WAV in C++
- Reading WAV header renders wrong data
- Parsing a WAV/PCM audio
- WAV files at any rate except 44.1kHz have messed up sound
Related Questions in FFT
- 3D FFT with data larger than cache
- FFT Filtering of signal
- Changing the amount of points changes the result of the fft
- Finding peak frequency in a complex signal using Matlab
- fftw of 16bit Audio :: peak appearing wrong at 2f
- Detect repetition in text string / copied text
- FFT in Arrayfire is slower than in MATLAB
- FFT Fundamental frequency calculation from LomontFFT
- Polynomial multiplication in M2(R)?
- fftw slight peak inaccuracy/drifting
- Zoom in on np.fft2 result
- Giving large no of samples to KissFFT
- cross correlation using fft producing inaccurate results
- Weird but close fft and ifft of image in c++
- How to get complex64 output from numpy.fft?
Related Questions in FREQUENCY
- Sorting entire csv by frequency of occurence in one column
- Working of rand() and mt_rand() functions in php
- Frequency Count in Haskell
- csv to frequency polygon using R or python
- How to Send Specific Frequency Through Audio Jack
- How to do insert method on Word Frequency counter using linked list
- Python: Most frequent character counter
- Low and High Pass Filters with Specific Cutoff
- How to get the low, middle and high frequency components of an image?
- Dynamic programming: how to design algorithm for when there are two factors to consider?
- Scala first program issue
- Apply a Frequency to an Element in an Array
- How can I select a frequency if the frequency range is given?
- Sum if frequency countif unique cells
- Counting majority vote in R
Related Questions in AMPLITUDE
- Extracting an amplitude list from *.wav file for use in Python
- Matlab - Find Frequency - Amplitude of signal
- How to read the amplitude of mp3 file in java
- How to use getMaxAmplitude - Android
- How do I make python load a big(2hours) wave-file and convert it's contents into a time-frequency array?
- Specgram Amplitude Filtering - MATLAB R2008a
- How can I Remove a Wandering DC Offset from an Audio Clip?
- formula Amplitude using FFT
- How to specify a path when extracting data from Amplitude to s3 bucket?
- Abnormally low amplitude values in live audio processing
- How to carry out population-mean cosinor analysis in R using 'card' package
- get frequency and amplitude from wave file
- Modulate and demodulate binary data to/from audio - one or two frequencies?
- Is there a way to use the Amplitude class to analyze audio data from external sources in real time?
- Getting frequency and amplitude from an audio file using FFT - so close but missing some vital insights, eli5?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The default Python wave module isn't very thorough. You might try the one included in scipy as an alternative.
Check out: Reading *.wav files in Python
If you're going to do any numerical heavy lifting with the audio, scipy might be your best option anyway.