Uses 11894K of libraries. Click here for Pure Java version (20968L/136K).
svoid audioRestorationDemo_v1() { S text = //"please tell me something nice"; "you can almost understand this now"; bool sine = false; double seconds = 1.0; new ContinuousOscillators_TestAudioRestoration test; test.showImage(true); var co = test.co; S waveName; test.separateFrequencies(true); test.separateRealAndImag(false); test.cumulative(true); co.renderUsingSine = false; if (sine) { test.setAudio(seconds, new SineSoundSource(440.0, test.inputSampleRate)); //if (true) ret; waveName = "sine"; } else { test.loadMP3(new GSay(text).audioFile()); waveName = text; } //test.co.setFrequencies(pianoFrequencies88()); test.co.setFrequencies(map toFrequency(geometricIterator(55.0, test.inputSampleRate, 2.0))); test.silence = 0.01; //test.minFreq = 440; //test.maxFreq = 440*4; test.wavOut = javaxDataDir("Restored Audio/" + waveName + ".restored." + (test.co.renderUsingSine ? "sine" : "square") + ".wav"); test.run(); /* double interval = co.sampleRate/880; print(+interval); int n = 3; L<Double> period = map(x -> x/32767.0, asList(takeFirst(iceil(interval*n), test.resampled))); L<Average> partSum = AutoCreateList(Average); for i over period: { var sample = period.get(i); int part = ifloor(i/interval*4); var sum = partSum.get(part); sum.add(sample); printVars(+i, +part, sample := formatDouble2(sample), sum := formatDouble2(sum!)); } pnl(partSum); for (int i = 0; i+3 < l(partSum); i += 4) { double[] vals = new[2]; for phase to 2: { double a = partSum.get(i+((4-phase)&3))!; double b = partSum.get(i+((5-phase)&3))!; double c = partSum.get(i+((6-phase)&3))!; double d = partSum.get(i+((7-phase)&3))!; printVars(+a, +b, +c, +d); double hi = avg(a, b), lo = avg(c, d); double val = hi-lo; vals[phase] = val; print("i=" + i + ", phase " + phase + ": " + formatDouble2(hi) + " - " + formatDouble2(lo) + " = " + formatDouble2(val)); } print("c=" + renderComplexWithAngle(complex(vals))); } */ // test linear interpolation /*for (t : countIterator(0.0, 2.0, 0.1)) print(t + "=" + co.audio.sampleSum(0, 0, t));*/ }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): bhatertpkbcr, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033276 |
Snippet name: | audioRestorationDemo_v1 |
Eternal ID of this version: | #1033276/2 |
Text MD5: | 8b6b1b80b33ca8f58082d5a4855da1c9 |
Transpilation MD5: | 34dac4f4c8a29128997aac594a187719 |
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-18 05:11:30 |
Source code size: | 2300 bytes / 70 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 135 / 188 |
Version history: | 1 change(s) |
Referenced in: | [show references] |