File file = new File(filename); AudioInputStream in= AudioSystem.getAudioInputStream(file); AudioInputStream din = null; AudioFormat baseFormat = in.getFormat(); AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); din = AudioSystem.getAudioInputStream(decodedFormat, in);
private void bDisplayActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_bDisplayActionPerformed try { AudioInputStream audio = AudioSystem.getAudioInputStream(new File(testPlaybackPathString)); if (audio.getFormat().getChannels() > 1) { audio = new MonoAudioInputStream(audio, getInputMode()); } MultiDisplay d = new MultiDisplay(audio, "Test recording", false); } catch (Exception e) { e.printStackTrace(); } }// GEN-LAST:event_bDisplayActionPerformed
public static void main(String[] args) throws Exception { double samplingRateFactor = Double.valueOf(args[0]).doubleValue(); for (int i = 1; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); AudioFormat af = new AudioFormat((int) (ais.getFormat().getSampleRate() * samplingRateFactor), ais.getFormat() .getSampleSizeInBits(), ais.getFormat().getChannels(), true, ais.getFormat().isBigEndian()); DDSAudioInputStream ais2 = new DDSAudioInputStream(new AudioDoubleDataSource(ais), af); String outFileName = args[i].substring(0, args[i].length() - 4) + "_child.wav"; AudioSystem.write(ais2, AudioFileFormat.Type.WAVE, new File(outFileName)); } } }
public static void main(String[] args) throws Exception { double samplingRateFactor = Double.valueOf(args[0]).doubleValue(); for (int i = 1; i < args.length; i++) { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(args[i])); AudioFormat af = new AudioFormat((int) (ais.getFormat().getSampleRate() * samplingRateFactor), ais.getFormat() .getSampleSizeInBits(), ais.getFormat().getChannels(), true, ais.getFormat().isBigEndian()); DDSAudioInputStream ais2 = new DDSAudioInputStream(new AudioDoubleDataSource(ais), af); String outFileName = args[i].substring(0, args[i].length() - 4) + "_child.wav"; AudioSystem.write(ais2, AudioFileFormat.Type.WAVE, new File(outFileName)); } } }
public F0Graph(AudioInputStream ais, 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"); } AudioDoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, signal.getSamplingRate(), width, height); }
public Spectrogram(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 F0Graph(AudioInputStream ais, 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"); } AudioDoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, signal.getSamplingRate(), width, height); }
public EnergyGraph(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
public SignalGraph(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] audioData = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(audioData, samplingRate, width, height); }
public SignalGraph(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] audioData = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(audioData, samplingRate, width, height); }
public SilenceMarker(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
public SilenceMarker(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
public SignalSpectrum(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] signal = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(signal, samplingRate, width, height); }
public SignalSpectrum(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] signal = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(signal, samplingRate, width, height); }
public EnergyHistogram(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
public MultiDisplay(AudioInputStream ais, String title, int width, int height, boolean exitOnClose) { super(title); 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] audioData = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(audioData, samplingRate, width, height, exitOnClose); }
public EnergyHistogram(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
public MultiDisplay(AudioInputStream ais, String title, int width, int height, boolean exitOnClose) { super(title); 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); double[] audioData = MaryAudioUtils.getSamplesAsDoubleArray(ais); initialise(audioData, samplingRate, width, height, exitOnClose); }
public EnergyGraph(AudioInputStream ais, 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"); } int samplingRate = (int) ais.getFormat().getSampleRate(); DoubleDataSource signal = new AudioDoubleDataSource(ais); initialise(signal, samplingRate, width, height); }
private void jButton_DisplayActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton_DisplayActionPerformed Prompt selectedPrompt = promptArray[getCurrentRow()]; try { File f = selectedPrompt.getRecording().getFile(); AudioInputStream audio = AudioSystem.getAudioInputStream(f); if (audio.getFormat().getChannels() > 1) { audio = new MonoAudioInputStream(audio, optionsDialog.getInputMode()); } MultiDisplay d = new MultiDisplay(audio, selectedPrompt.getBasename(), false); } catch (Exception e) { e.printStackTrace(); } }// GEN-LAST:event_jButton_DisplayActionPerformed