org.cogchar.audio.spectrogram.SpectrogramFrame Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.cogchar.lib.sonograph Show documentation
Show all versions of org.cogchar.lib.sonograph Show documentation
Cogchar Sonograph - experimental/imported audio display code
The newest version!
/*
* Copyright 2011 by The Cogchar Project (www.cogchar.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* SpectrogramFrame.java
*
* Created on Dec 7, 2010, 7:25:50 PM
*/
package org.cogchar.audio.spectrogram;
import javax.sound.sampled.AudioFormat;
/**
*
* @author Matthew Stevenson
*/
public class SpectrogramFrame extends javax.swing.JFrame {
private RealtimeSpectrogram mySpect;
private boolean running;
/** Creates new form SpectrogramFrame */
public SpectrogramFrame() {
initComponents();
AudioFormat format = new AudioFormat(8000, 8, 1, false, true);
mySpect = new RealtimeSpectrogram(format, 1, 256, spectrogramPanel, 2.0);
running = false;
new Thread(mySpect).start();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
spectrogramPanel = new org.cogchar.audio.spectrogram.SpectrogramPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
spectrogramPanel.setMinimumSize(new java.awt.Dimension(0, 128));
spectrogramPanel.setPreferredSize(new java.awt.Dimension(400, 128));
javax.swing.GroupLayout spectrogramPanelLayout = new javax.swing.GroupLayout(spectrogramPanel);
spectrogramPanel.setLayout(spectrogramPanelLayout);
spectrogramPanelLayout.setHorizontalGroup(
spectrogramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 407, Short.MAX_VALUE)
);
spectrogramPanelLayout.setVerticalGroup(
spectrogramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 128, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spectrogramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spectrogramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// //GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SpectrogramFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.cogchar.audio.spectrogram.SpectrogramPanel spectrogramPanel;
// End of variables declaration//GEN-END:variables
}