srecord FrequencyImageFromURL(S url) { // all broken?! //S url = "https://gaz.ai/dl/audiostreams/gigsauntppvwjyrq.ogg"; //S url = "https://gaz.ai/dl/audiostreams/zgmyptzpqlvafoyz.ogg"; //S url = "https://gaz.ai/dl/audiostreams/jlokvemsxqhuaups.ogg"; *() { url = "https://gaz.ai/dl/audiostreams/bjfxzzpdtuhxewdx.ogg"; } BWImage image; run { temp var opus = new DecodeOpusStream(url); opus.minBytesPreloaded = 65536*2; temp var samples = opus!; opus.machine.init(); opus.machine.opusDecoder.printResets = true; var querySound = SampleIteratorToQuerySound(1, samples); new PianoSampler2 sampler; //sampler.debug = true; sampler.frequencies = intersperseHalfTones(sampler.frequencies); sampler.loadSound(querySound, 1); sampler.fixedFactor = 5e-4; var windowSeconds = .05; var windowSamples = windowSeconds*sampler.sampleRate; printVars(+windowSeconds, +windowSamples); var relativeWindowSpeed = .5; int peekSize = iceil(max(windowSamples, sampler.minWindowSizeForBase())*2); var totalSeconds = 5; var startAtSeconds = 0; var endAtSample = (startAtSeconds+totalSeconds)*sampler.sampleRate; var seconds = doubleRangeWithLength(startAtSeconds, windowSeconds); DoubleRange sampleRange = scaleDoubleRange(seconds, sampler.sampleRate); // make initial window print(+peekSize); sampler.makeWindowAround(sampleRange.start, peekSize); printVars(+seconds, +sampleRange, bounds := sampler.bounds()); new L images; int safety = 0; while ping (sampleRange.end <= endAtSample && safety++ <= 1000) { //print(+sampleRange); images.add(sampler.imageColumn(sampler.measureWindow(sampleRange))); sampleRange = shiftDoubleRange(sampleRange, windowSamples*relativeWindowSpeed); } image = mergeBWImagesHorizontally(map toBWImage(images), spacing := 0); print(nSamples := opus.samplesSeen()); print(sampler.stats()); } void showImage { dm_showPixelatedImage(image); } }