[FFmpeg-user] Convert Audio Track To Numbers and Back

Luke Davis l1 at newanswertech.com
Mon Mar 13 13:25:04 EET 2017


On Tue, 7 Mar 2017, Michele Monteferrante wrote:

> Sorry,
> I was not clear. What I want is a function of time, a graph.
> x: time in seconds
> Y: amplitude in whatever format
> This file must be a simple text file which,for example, I can plot with
> Gnuplot and edit whit vim.

Would maybe SoX be a better tool for this?  Something like the --plot option?

Or, possibly using the .dat output mechanism?
(I.E. sox infile.mp3 outfile.dat)
>From the soxformat man page:

.dat   Text  Data files.  These files contain a textual representation of the 
sample data.  There is one line at the beginning that contains the sam-
               ple rate, and one line that contains the number of channels. 
Subsequent lines contain two or more numeric data intems:  the  time  since  the
               beginning of the first sample and the sample value for each 
channel.

               Values  are  normalized so that the maximum and minimum are 1 and 
-1.  This file format can be used to create data files for external programs
               such as FFT analysers or graph routines.  SoX can also convert a 
file in this format back into one of the other file formats.

               Example containing only 2 stereo samples of silence:

                   ; Sample Rate 8012
                   ; Channels 2
                               0   0    0
                   0.00012481278   0    0


More information about the ffmpeg-user mailing list