public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); Cepstrogram signalSpectrum = new Cepstrogram(ais); signalSpectrum.showInJFrame(args[i], true, true); } }
public Cepstrogram(double[] signal, int samplingRate, Window window, int windowShift, int fftSize, int width, int height) { initialise(signal, samplingRate, window, windowShift, fftSize, width, height); }
protected String getLabel(double x, double y) { int precisionX = -(int) (Math.log(getXRange()) / Math.log(10)) + 2; if (precisionX < 0) precisionX = 0; int indexX = X2indexX(x); double[] spectrum = (double[]) cepstra.get(indexX); int precisionY = -(int) (Math.log(getYRange()) / Math.log(10)) + 2; if (precisionY < 0) precisionY = 0; double E = spectrum[Y2indexY(y)]; int precisionE = 1; return "E(" + new PrintfFormat("%." + precisionX + "f").sprintf(x) + "," + new PrintfFormat("%." + precisionY + "f").sprintf(y) + ")=" + new PrintfFormat("%." + precisionE + "f").sprintf(E); }
protected void drawData(Graphics2D g, int image_fromX, int image_toX, int image_refX, int image_refY, int startY, int image_height, double[] data, Color currentGraphColor, int currentGraphStyle, int currentDotStyle) { int index_fromX = imageX2indexX(image_fromX); int index_toX = imageX2indexX(image_toX); int spectrumWidth = indexX2imageX(1); if (spectrumWidth == 0) spectrumWidth = 1; drawCepstrum(g, cepstra.get(i), image_refX + indexX2imageX(i), spectrumWidth, image_refY, image_height);
protected String getLabel(double x, double y) { int precisionX = -(int) (Math.log(getXRange()) / Math.log(10)) + 2; if (precisionX < 0) precisionX = 0; int indexX = X2indexX(x); double[] spectrum = (double[]) cepstra.get(indexX); int precisionY = -(int) (Math.log(getYRange()) / Math.log(10)) + 2; if (precisionY < 0) precisionY = 0; double E = spectrum[Y2indexY(y)]; int precisionE = 1; return "E(" + new PrintfFormat("%." + precisionX + "f").sprintf(x) + "," + new PrintfFormat("%." + precisionY + "f").sprintf(y) + ")=" + new PrintfFormat("%." + precisionE + "f").sprintf(E); }
protected void drawData(Graphics2D g, int image_fromX, int image_toX, int image_refX, int image_refY, int startY, int image_height, double[] data, Color currentGraphColor, int currentGraphStyle, int currentDotStyle) { int index_fromX = imageX2indexX(image_fromX); int index_toX = imageX2indexX(image_toX); int spectrumWidth = indexX2imageX(1); if (spectrumWidth == 0) spectrumWidth = 1; drawCepstrum(g, cepstra.get(i), image_refX + indexX2imageX(i), spectrumWidth, image_refY, image_height);
public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); Cepstrogram signalSpectrum = new Cepstrogram(ais); signalSpectrum.showInJFrame(args[i], true, true); } }
public Cepstrogram(double[] signal, int samplingRate, Window window, int windowShift, int fftSize, int width, int height) { initialise(signal, samplingRate, window, windowShift, fftSize, width, height); }
public Cepstrogram(AudioInputStream ais, Window window, int windowShift, int fftSize, int width, int height) { super(); if (!ais.getFormat().getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)) { ais = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, ais); } if (ais.getFormat().getChannels() > 1) { throw new IllegalArgumentException("Can only deal with mono audio signals"); } if (!MathUtils.isPowerOfTwo(fftSize)) throw new IllegalArgumentException("fftSize must be a power of two"); AudioDoubleDataSource signalSource = new AudioDoubleDataSource(ais); initialise(signalSource.getAllData(), signalSource.getSamplingRate(), window, windowShift, fftSize, width, height); }
public Cepstrogram(AudioInputStream ais, Window window, int windowShift, int fftSize, int width, int height) { super(); if (!ais.getFormat().getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)) { ais = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, ais); } if (ais.getFormat().getChannels() > 1) { throw new IllegalArgumentException("Can only deal with mono audio signals"); } if (!MathUtils.isPowerOfTwo(fftSize)) throw new IllegalArgumentException("fftSize must be a power of two"); AudioDoubleDataSource signalSource = new AudioDoubleDataSource(ais); initialise(signalSource.getAllData(), signalSource.getSamplingRate(), window, windowShift, fftSize, width, height); }