Difference between revisions of "Spectrograms"

From WikiDelia
Jump to navigationJump to search
(Get spectrograms of your music!)
Line 38: Line 38:
  
 
There is another program that does log-frequency-axis spectrograms: the free audio editor Audacity.
 
There is another program that does log-frequency-axis spectrograms: the free audio editor Audacity.
 
 
<!--
 
<!--
For which we need a spectrum analyzer which:
 
* has a logarithmic frequency scale instead of the usual linear one
 
* can zoom and pan on both axes
 
* can overlay a grid to pinpoint conventional frequencies and to divide the piece into beats
 
 
 
=Linear frequency axis=
 
=Linear frequency axis=
 
[[Image:Sndfile-spectrogram analysis of The Pattern Emerges.png|thumb|right|The Pattern Emerges - linear spectrogram from 0 to 22kHz of the whole piece (177 sec)]]
 
[[Image:Sndfile-spectrogram analysis of The Pattern Emerges.png|thumb|right|The Pattern Emerges - linear spectrogram from 0 to 22kHz of the whole piece (177 sec)]]
Line 57: Line 51:
  
 
We achieve this here by using sndfile-spectrogram from the libsoundfile tools to produce a linear spectrogram and then distorting its frequency axis using an ImageMagick script. The code to do this is <code>mkjpg.sh</code> under https://github.com/martinwguy/delia-derbyshire/tree/master/anal
 
We achieve this here by using sndfile-spectrogram from the libsoundfile tools to produce a linear spectrogram and then distorting its frequency axis using an ImageMagick script. The code to do this is <code>mkjpg.sh</code> under https://github.com/martinwguy/delia-derbyshire/tree/master/anal
 
= Frequency and time grids =
 
To help convert the spectrograms to musical scores, it would be useful to overlay a grid of frequency markers, for example as horizontal white and black single-pixel lines, piano-style, to identify the semitones. A fixed grid the full length of the piece should suffice.
 
 
Similarly, it be useful to be able to overlay a time grid to be able to identify the piece's temporal structure. Positioning this is not as simple as the frequency grid, and may need to be interactive to be able to say, for example, "divide from here to here into 13 beats".
 
 
The GIMP photo editor can do this, but the size of each cell can only be a whole number of pixels, which is not as accurate as we would like, particularly for frequencies.
 
 
-->
 
-->
 
 
=References=
 
=References=
 
<references/>
 
<references/>

Revision as of 14:59, 19 December 2015

City Music - Spectrogram.jpg

Spectrograms are used in the WikiDelia to visualise the sonic content of Delia's pieces of music.

In each spectrgram, time runs from left to right, low frequencies are at the bottom and high ones at the top and the light at each point in the graph represents the energy in the sound at one frequency at a particular moment (or, rather, in one frequency band around a particular moment.)

As well as helping us understand the internal structure of Delia's pieces and her instruments and effects, these also help us recreate conventional scores from her sound files, for example:

Logarithmic frequency axis

The spectrograms used in the WikiDelia are not the usual kind, where the Y axis represents the linear frequency scale from 0 to 22050Hz and in which the top half of the graphic represents just the top octave of the sound, with all the musical detail crushed into the bottom few pixels. Here, the vertical scale is logarithmic, which gives the same number of pixel rows per semitone.

Usage in the WikiDelia

The spectrogram of a piece goes in three places:

  • On the piece's page in a section Spectrogram usually just above Availability so that the Listen button is near.
  • Spectrograms of complete pieces are on the Audio page
  • in delia-derbyshire.net/spectrograms

For example the piece Air has File:Air.ogg and File:Air - Spectrogram.jpg, used by the MediaWiki macros {{Spectrogram|Air - Spectrogram}} and {{Spectrogallery|Air}}

Get spectrograms of your music!

Moogies Bloogies - Spectrogram with piano staff (detail)

I am happy to run the log spectrum analyser on your music. You can specify:

  • lowest pitch (usually A0, 27.5Hz)
  • number of octaves (usually 9, to 14080Hz)
  • number of pixels per semitone on the frequency axis (usually 8)
  • number of pixel columns per second on the time axis (usually 50)

Optionally the software can superimpose single-pixel black and white lines at the frequencies of the piano keys and three-pixel-wide white lines at the positions of the manuscript stave lines, see the example on the right.

If this interests you, please Make a small donation and email delia.derbyshire.net@gmail.com attaching the sound file you would like turned into a picture.

Software

The WikiDelia's spectro-analyser was written specifically for it, using a modified version of sndfile-spectrogram and an ImageMagick script to distort the image giving it a logarithmic frequency axis.

A more precise technique would be to write a Constant-Q tranform directly instead of distorting a linear FFT.[1][2]

There is another program that does log-frequency-axis spectrograms: the free audio editor Audacity.

References

  1. The Constant Q Transform, an implementation in Matlab by Benjamin Blankertz
  2. C++ Constant-Q at soundsoftware.co.uk