public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); LogSpectrum signalSpectrum = new LogSpectrum(ais); signalSpectrum.showInJFrame(args[i], true, false); } }
public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); LogSpectrum signalSpectrum = new LogSpectrum(ais); signalSpectrum.showInJFrame(args[i], 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 HanningWindow(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 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 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 HanningWindow(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 BartlettWindow(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 BartlettWindow(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(); float asymmetry = 1.5f; // length of right window half relative to left half // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int leftHalfLength = windowLength / 2; int rightHalfLength = (int) (leftHalfLength * asymmetry); windowLength = leftHalfLength + rightHalfLength; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); int windowType = Window.HANNING; Window wLeft = Window.get(windowType, 2 * leftHalfLength); Window wRight = Window.get(windowType, 2 * rightHalfLength); double window[] = new double[windowLength]; System.arraycopy(wLeft.window, 0, window, 0, leftHalfLength); System.arraycopy(wRight.window, rightHalfLength, window, leftHalfLength, rightHalfLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, window); timeGraph.showInJFrame("Asymmetric " + wLeft.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(window); for (int i = 0; i < window.length; i++) { fftSignal[i] = window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame("Asymmetric " + wLeft.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(); float asymmetry = 1.5f; // length of right window half relative to left half // If both are given, use window length in milliseconds: if (windowLengthMs != 0) windowLength = windowLengthMs * samplingRate / 1000; int leftHalfLength = windowLength / 2; int rightHalfLength = (int) (leftHalfLength * asymmetry); windowLength = leftHalfLength + rightHalfLength; int fftSize = Math.max(4096, MathUtils.closestPowerOfTwoAbove(windowLength)); int windowType = Window.HANNING; Window wLeft = Window.get(windowType, 2 * leftHalfLength); Window wRight = Window.get(windowType, 2 * rightHalfLength); double window[] = new double[windowLength]; System.arraycopy(wLeft.window, 0, window, 0, leftHalfLength); System.arraycopy(wRight.window, rightHalfLength, window, leftHalfLength, rightHalfLength); FunctionGraph timeGraph = new FunctionGraph(0, 1. / samplingRate, window); timeGraph.showInJFrame("Asymmetric " + wLeft.toString() + " in time domain", true, false); double[] fftSignal = new double[fftSize]; // fftSignal should integrate to one, so normalise amplitudes: double sum = MathUtils.sum(window); for (int i = 0; i < window.length; i++) { fftSignal[i] = window[i] / sum; } LogSpectrum freqGraph = new LogSpectrum(fftSignal, samplingRate); freqGraph.showInJFrame("Asymmetric " + wLeft.toString() + " log frequency response", true, false); }