!include once #1018630 // Spectro Edit static BWImage clipToFrequencyImage(Clip clip, IF1 colorizer default lambda1 abs) ctex { //print("spectro min/max: " + spectro_minMaxValues(clip)); int w = clip.getFrameCount(), h = clip.getFrameFreqSamples(); int h2 = min(h, audio_frequencyImageHeight()); BWImage img = new(w, h2); Rectangle region = new(0, 0, w, h); //toClipCoords(region, clip); region.y = clip.getFrameFreqSamples() - (region.y + region.height); //print(+region); int endCol = region.x + region.width; int endRow = min(region.y + region.height, h2); for (int col = region.x; col < endCol; col++) { net.bluecow.spectro.Frame f = clip.getFrame(col); for (int row = region.y; row < endRow; row++) img.setPixel(col, h2-1-row, toFloat(colorizer.get(f.getReal(row)))); } ret img; }