title: Get a spectrum of frequencies from WAV/RIFF using Linux command line
body: <p>How to generate a file that contains the spectrum of frequencies of a WAV/RIFF sound file?</p>
  <p>I would like to use the Linux command line.</p>
  <p>I know the cool <a href="https://linux.die.net/man/1/sox" rel="nofollow noreferrer">SoX</a> function to generate PNG spectrograms:</p>
  <pre><code>sox sound.wav -n spectrogram
  </code></pre>
  <p><img src="https://i.imgur.com/q4s2DZE.png" alt="example spectrogram created with SoX" /></p>
  <p>But I do not need a visual representation of the spectrum of frequencies. I just want to get the spectrum of frequencies in a data file so I can work on them. I believe that there must be an option using SoX. SoX needs to generate that data before plotting it. How to get this?</p>
  <p>Not sure, maybe the second solution is exporting the WAV file into the data file. Each sample from the data file is a measurement of the position of the membrane at a moment in time. So this is not a spectrum of frequencies.</p>
  <pre><code>sox sound.wav file.dat
  </code></pre>
  <p>How to convert those membrane positions into the spectrum I need?</p>