       y: 'y'
       dw: MAX_FREQ
       dh: 'dh'
-      width: @canvas_width,
+      width: SPECTROGRAM_LENGTH,
       height: @canvas_height,
       image: 'image'
       palette:

FREQ_SAMPLES = NUM_SAMPLES / 8
SPECTROGRAM_LENGTH = 512

NGRAMS = 600

class Spectrogram
  constructor: () ->
    @canvas_width = SPECTROGRAM_LENGTH
    @canvas_height = NGRAMS

    @y = [0]

  on_data: (data) =>
    if not data[0]?
      return
    for i in [(@image[0].length-1)..SPECTROGRAM_LENGTH]
      @image[0][i] = @image[0][i-SPECTROGRAM_LENGTH]
    for i in [0..SPECTROGRAM_LENGTH-1]
