protected static JFrame showGraph(double[] array, String title) { FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, array); JFrame frame = graph.showInJFrame(title, 500, 300, true, false); return frame; } }
public static void plot(double[] x, boolean bAutoClose, int milliSecondsToClose) { FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, x); JFrame frame = graph.showInJFrame("wgt2", 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
protected static JFrame showGraph(double[] array, String title) { FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, array); JFrame frame = graph.showInJFrame(title, 500, 300, true, false); return frame; } }
public static void plot(double[] x, boolean bAutoClose, int milliSecondsToClose) { FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, x); JFrame frame = graph.showInJFrame("wgt2", 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
public static void plot(float[] xIn, int startInd, int endInd, String strTitle, boolean bAutoClose, int milliSecondsToClose) { if (xIn != null) { double[] xd = new double[endInd - startInd + 1]; for (int i = startInd; i <= endInd; i++) xd[i - startInd] = xIn[i]; FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, xd); JFrame frame = graph.showInJFrame(strTitle, 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
public static void plot(float[] xIn, int startInd, int endInd, String strTitle, boolean bAutoClose, int milliSecondsToClose) { if (xIn != null) { double[] xd = new double[endInd - startInd + 1]; for (int i = startInd; i <= endInd; i++) xd[i - startInd] = xIn[i]; FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, xd); JFrame frame = graph.showInJFrame(strTitle, 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
public static void plot(double[] xIn, int startInd, int endInd, String strTitle, boolean bAutoClose, int milliSecondsToClose) { if (xIn != null) { endInd = MathUtils.CheckLimits(endInd, 0, xIn.length - 1); startInd = MathUtils.CheckLimits(startInd, 0, endInd); double[] x = new double[endInd - startInd + 1]; System.arraycopy(xIn, startInd, x, 0, x.length); FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, x); JFrame frame = graph.showInJFrame(strTitle, 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
public static void plot(double[] xIn, int startInd, int endInd, String strTitle, boolean bAutoClose, int milliSecondsToClose) { if (xIn != null) { endInd = MathUtils.CheckLimits(endInd, 0, xIn.length - 1); startInd = MathUtils.CheckLimits(startInd, 0, endInd); double[] x = new double[endInd - startInd + 1]; System.arraycopy(xIn, startInd, x, 0, x.length); FunctionGraph graph = new FunctionGraph(400, 200, 0, 1, x); JFrame frame = graph.showInJFrame(strTitle, 500, 300, true, false); if (bAutoClose) { try { Thread.sleep(milliSecondsToClose); } catch (InterruptedException e) { } frame.dispose(); } } }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new RectWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new BlackmanWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new BlackmanWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new HammingWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new GaussWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new RectWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
public static void main(String[] args) { int samplingRate = Integer.getInteger("samplingrate", 1).intValue(); int windowLengthMs = Integer.getInteger("windowlength.ms", 0).intValue(); int windowLength = Integer.getInteger("windowlength.samples", 512).intValue(); // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); Window w = new HammingWindow(windowLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, w.window); timeGraph.showInJFrame(w.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(w.window); for (int i = 0; i < w.window.length; i++) { fftSignal[i] = w.window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame(w.toString() + " log frequency response", true, false); }
protected FunctionGraph showGraph(double[] array, String title) { FunctionGraph graph = new FunctionGraph(400, 200, 0, 1. / ONE, array); graph.showInJFrame(title, 500, 300, true, false); try { Thread.sleep(1000); } catch (InterruptedException e) { } return graph; }
public static void main(String[] args) throws Exception { F0TrackerAutocorrelationHeuristic tracker = new F0TrackerAutocorrelationHeuristic(new PitchFileHeader()); tracker.pitchAnalyzeWavFile(args[0]); FunctionGraph f0Graph = new FunctionGraph(0, tracker.params.skipSizeInSeconds, tracker.f0s); f0Graph.showInJFrame("F0 curve for " + args[0], false, true); }
public static void main(String[] args) throws Exception { F0TrackerAutocorrelationHeuristic tracker = new F0TrackerAutocorrelationHeuristic(new PitchFileHeader()); tracker.pitchAnalyzeWavFile(args[0]); FunctionGraph f0Graph = new FunctionGraph(0, tracker.params.skipSizeInSeconds, tracker.f0s); f0Graph.showInJFrame("F0 curve for " + args[0], false, true); }
public void update(double x) { if (Double.isNaN(x)) return; int centerIndex = (int) (x * samplingRate); assert centerIndex >= 0 && centerIndex < signal.length; int windowLength = 1024; int leftIndex = centerIndex - windowLength / 2; if (leftIndex < 0) leftIndex = 0; double[] signalExcerpt = new HammingWindow(windowLength).apply(signal, leftIndex); double[] spectrum = FFT.computeLogPowerSpectrum(signalExcerpt); if (graph == null) { graph = new FunctionGraph(300, 200, 0, samplingRate / windowLength, spectrum); } else { graph.updateData(0, samplingRate / windowLength, spectrum); } super.updateGraph(graph, "Spectrum at " + new PrintfFormat("%.3f").sprintf(x) + " s"); }
public void update(double x) { if (Double.isNaN(x)) return; int centerIndex = (int) (x * samplingRate); assert centerIndex >= 0 && centerIndex < signal.length; int windowLength = 1024; int leftIndex = centerIndex - windowLength / 2; if (leftIndex < 0) leftIndex = 0; double[] signalExcerpt = new HammingWindow(windowLength).apply(signal, leftIndex); double[] spectrum = FFT.computeLogPowerSpectrum(signalExcerpt); if (graph == null) { graph = new FunctionGraph(300, 200, 0, samplingRate / windowLength, spectrum); } else { graph.updateData(0, samplingRate / windowLength, spectrum); } super.updateGraph(graph, "Spectrum at " + new PrintfFormat("%.3f").sprintf(x) + " s"); }