The mp3 file is made up the following way according to this file:
<a title="Traced by User:Stannered, original by en:User:Kim Meyrick, CC BY 2.5 <https://creativecommons.org/licenses/by/2.5>, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Mp3filestructure.svg"><img width="512" alt="Mp3filestructure" src="https://upload.wikimedia.org/wikipe...estructure.svg/512px-Mp3filestructure.svg.png"></a>
Opening an mp3 file in a text editor results in the following picture. Is there a way to view the mp3 file data values, I have used Audacity, but maybe as a set of values in a text file.
<a title="Traced by User:Stannered, original by en:User:Kim Meyrick, CC BY 2.5 <https://creativecommons.org/licenses/by/2.5>, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Mp3filestructure.svg"><img width="512" alt="Mp3filestructure" src="https://upload.wikimedia.org/wikipe...estructure.svg/512px-Mp3filestructure.svg.png"></a>
Opening an mp3 file in a text editor results in the following picture. Is there a way to view the mp3 file data values, I have used Audacity, but maybe as a set of values in a text file.
The problem is the text editor doesn't understand the mp3 file structure, so its displaying the raw data.
You are going to need to find dedicated software to extract the mp3 data frames.
If you have sufficient software knowledge there's a write-up of the difficulty of doing this - Extracting Data From An MP3 With PHP
You are going to need to find dedicated software to extract the mp3 data frames.
If you have sufficient software knowledge there's a write-up of the difficulty of doing this - Extracting Data From An MP3 With PHP
Wow Indiglo thanks! I wonder if there is a way in Python or BASIC? Let's see.
Some helpful links here. Maybe convert to .wav and then analyse.
https://docs.python.org/3/library/wave.html
this code reads and displays the file. Python is so easy...
https://stackoverflow.com/questions...act-the-raw-data-from-a-mp3-file-using-python
Some helpful links here. Maybe convert to .wav and then analyse.
https://docs.python.org/3/library/wave.html
this code reads and displays the file. Python is so easy...
https://stackoverflow.com/questions...act-the-raw-data-from-a-mp3-file-using-python
First I want to see the values of the sound values for each 1/144K second. I want a list of these so I can import it into a spreadsheet and do some charting and analysis. Then, ideally, I would like to write back the mp3 file after processing it, or use a tool to write it back.Audacity features difference tracing between files but I am not sure how to use it: for example how does a .wav file minus the .mp3 of the same file sound? What is the difference, value wise.
The above links really look very promising, especially with Python.
The above links really look very promising, especially with Python.
Progress:
Python Code:
https://www.tutorialspoint.com/read-and-write-wav-files-using-python-wave
Output:
Python Code:
Python:
import wave
obj = wave.open('Track1.wav','r')
print( "Number of channels",obj.getnchannels())
print ( "Sample width",obj.getsampwidth())
print ( "Frame rate.",obj.getframerate())
print ("Number of frames",obj.getnframes())
print ( "parameters:",obj.getparams())
obj.close()
https://www.tutorialspoint.com/read-and-write-wav-files-using-python-wave
Output:
Code:
Number of channels 2
Sample width 2
Frame rate. 44100
Number of frames 12028716
parameters: _wave_params(nchannels=2, sampwidth=2, framerate=44100, nframes=12028716, comptype='NONE', compname='not compressed')
I was able to use the above code to extract data from 10 frames. Using this data in a spreadsheet, (Open Office Calc) I was able to create the chart shown below. I am not sure if the data is from two channels, probably is. The data is for 10 frames, which is not a lot of time, at 14.1 k Hz, each second will need 14,000 cycles out of the 12 million or so total. Still it is a start.
This is the method I plan to use: extract the data from each channel into a numerical format, and use a spreadsheet to plot and analyse the data, for example, how a compressed file, converted to .wav, loses data compared to an uncompressed .wav of the same file. I have not come across anyone
doing this analysis yet
.
This is the method I plan to use: extract the data from each channel into a numerical format, and use a spreadsheet to plot and analyse the data, for example, how a compressed file, converted to .wav, loses data compared to an uncompressed .wav of the same file. I have not come across anyone
doing this analysis yet
.
The code for generating the above data only (hard coded to 100 frames ) is listed below.
Python:
import wave , struct
obj = wave.open('Track1.wav','r')
print( "Number of channels",obj.getnchannels())
print ( "Sample width",obj.getsampwidth())
print ( "Frame rate.",obj.getframerate())
print ("Number of frames",obj.getnframes())
print ( "parameters:",obj.getparams())
obj.close()
wavefile = wave.open('Track1.wav','r')
length = wavefile.getnframes()
for i in range(0, 100):
wavedata = wavefile.readframes(1)
print(wavedata[0])
Mostly it's done in a wave editor with the results being audible or analyzed by typical audio tools. There is also Audio DiffMaker software by Bill Waslo who is on this forum.I have not come across anyone doing this analysis yet
- Home
- Design & Build
- Software Tools
- mp3 data viewing software