Uses 521K of libraries. Click here for Pure Java version (18864L/120K).
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<MakesBufferedImage> 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); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033048 |
Snippet name: | FrequencyImageFromURL |
Eternal ID of this version: | #1033048/8 |
Text MD5: | 4b7be0a4ca19d4fbcb69b3e06c4c1546 |
Transpilation MD5: | 28cf7516c67e6fb6ba75a2ca39b07392 |
Author: | stefan |
Category: | javax / audio analysis |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-11 19:15:15 |
Source code size: | 2162 bytes / 63 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 176 / 294 |
Version history: | 7 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |