public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); Spectrogram signalSpectrum = new Spectrogram(ais); signalSpectrum.showInJFrame(args[i], true, true); } }
protected void initialiseDependentWindows() { addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { int imageX = e.getX() - paddingLeft; double x = imageX2X(imageX); for (int i = 0; i < graphsAtCursor.length; i++) { if (graphsAtCursor[i].show) { graphsAtCursor[i].update(x); } } } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent 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; drawSpectrum(g, (double[]) spectra.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[]) spectra.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); }
public void mouseClicked(MouseEvent e) { int imageX = e.getX() - paddingLeft; double x = imageX2X(imageX); for (int i = 0; i < graphsAtCursor.length; i++) { if (graphsAtCursor[i].show) { graphsAtCursor[i].update(x); } } }
/** * Determine the next free location for a dependent and put the window there. * * @param jf * jf */ protected void setDependentWindowLocation(JFrame jf) { if (nextDependentWindowX == 0 && nextDependentWindowY == 0) { // first dependent window: nextDependentWindowX = getTopLevelAncestor().getWidth(); } jf.setLocationRelativeTo(this); jf.setLocation(nextDependentWindowX, nextDependentWindowY); nextDependentWindowY += jf.getHeight(); }
signalGraph = new SignalGraph(signal, samplingRate, graphWidth, height * 15 / 100); allGraphs.add(signalGraph); spectrogram = new Spectrogram(signal, samplingRate, graphWidth, height * 40 / 100); allGraphs.add(spectrogram); f0Graph = new F0Graph(signal, samplingRate, graphWidth, height * 20 / 100);
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[]) spectra.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; drawSpectrum(g, (double[]) spectra.get(i), image_refX + indexX2imageX(i), spectrumWidth, image_refY, image_height);
public void mouseClicked(MouseEvent e) { int imageX = e.getX() - paddingLeft; double x = imageX2X(imageX); for (int i = 0; i < graphsAtCursor.length; i++) { if (graphsAtCursor[i].show) { graphsAtCursor[i].update(x); } } }
/** * Determine the next free location for a dependent and put the window there. * * @param jf * jf */ protected void setDependentWindowLocation(JFrame jf) { if (nextDependentWindowX == 0 && nextDependentWindowY == 0) { // first dependent window: nextDependentWindowX = getTopLevelAncestor().getWidth(); } jf.setLocationRelativeTo(this); jf.setLocation(nextDependentWindowX, nextDependentWindowY); nextDependentWindowY += jf.getHeight(); }
signalGraph = new SignalGraph(signal, samplingRate, graphWidth, height * 15 / 100); allGraphs.add(signalGraph); spectrogram = new Spectrogram(signal, samplingRate, graphWidth, height * 40 / 100); allGraphs.add(spectrogram); f0Graph = new F0Graph(signal, samplingRate, graphWidth, height * 20 / 100);
public static void main(String[] args) throws Exception { for (int i = 0; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); Spectrogram signalSpectrum = new Spectrogram(ais); signalSpectrum.showInJFrame(args[i], true, true); } }
protected void initialiseDependentWindows() { addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { int imageX = e.getX() - paddingLeft; double x = imageX2X(imageX); for (int i = 0; i < graphsAtCursor.length; i++) { if (graphsAtCursor[i].show) { graphsAtCursor[i].update(x); } } } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } }); }
FunctionGraph resultGraph = new SignalGraph(result, samplingRate); resultGraph.showInJFrame("result", true, true); Spectrogram resultSpectrogram = new Spectrogram(result, samplingRate); resultSpectrogram.showInJFrame("result", true, true); SignalSpectrum resultSpectrum = new SignalSpectrum(result, samplingRate); resultSpectrum.showInJFrame("result", true, true);
FunctionGraph resultGraph = new SignalGraph(result, samplingRate); resultGraph.showInJFrame("result", true, true); Spectrogram resultSpectrogram = new Spectrogram(result, samplingRate); resultSpectrogram.showInJFrame("result", true, true); SignalSpectrum resultSpectrum = new SignalSpectrum(result, samplingRate); resultSpectrum.showInJFrame("result", true, true);