File talk:The Pattern Emerges - log spectrogram 50-3600Hz.jpg

From WikiDelia
Jump to navigationJump to search

Spectral analysis of Delia Derbyshire's "The Pattern Emerges" with logarithmic y (frequency) axis and 50 pixel columns per second.

Produced by the following Makefile:

WIDTH=8654
LIN_HEIGHT=8192
LOG_HEIGHT=1024

MAX_Y_IN=`expr $(LIN_HEIGHT) - 1`
MAX_Y_OUT=`expr $(LOG_HEIGHT) - 1`
MAX_FREQ_IN=22050
MIN_FREQ_OUT=50
MAX_FREQ_OUT=3600

pattern.png: pattern.wav
        sndfile-spectrogram --dyn-range=90 --no-border $< \
                $(WIDTH) $(LIN_HEIGHT) $@

pattern-log.png: pattern.png Makefile
        -rm -f $@
        time convert -size $(WIDTH)x$(LOG_HEIGHT) xc: $< \
                -virtual-pixel White \
                -interpolate Mesh \
                -fx "freq = $(MIN_FREQ_OUT) * pow($(MAX_FREQ_OUT) / $(MIN_FREQ_OUT), ($(MAX_Y_OUT) - j) / $(MAX_Y_OUT)); \
                     yy = $(MAX_Y_IN) - freq * $(MAX_Y_IN) / $(MAX_FREQ_IN); \
                     v.p{i,yy}" \
                $@