public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
public Microphone( float sampleRate, int sampleSize, boolean signed, boolean bigEndian) { AudioFormat format = new AudioFormat(sampleRate, sampleSize, 1, signed, bigEndian); try { line = AudioSystem.getTargetDataLine(format); line.open(); } catch (LineUnavailableException e) { throw new IllegalStateException(e); } inputStream = new AudioInputStream(line); }
public CaptureThread(@Nonnull AudioFormat audioFormat, @Nonnull SoundFormat soundFormat) throws CaptureException { super("Microphone Capture Thread"); try { this.audioFormat = audioFormat; this.currentLine = AudioSystem.getTargetDataLine(audioFormat); this.result = null; this.soundFormat = soundFormat; } catch (FileException | IllegalArgumentException | LineUnavailableException exception) { throw new CaptureException("Could not create capture thread", exception); } }
/** * Creates a new local audio environment with the given audio formats. * * @param inputFormat * The format of the microphone input line. * @param outputFormat * The format of the speaker output line. * @throws LineUnavailableException * When either the input or output line can't be opened with the given format. */ public LocalAudioEnvironment(AudioFormat inputFormat, AudioFormat outputFormat) throws LineUnavailableException { this.sdl = AudioSystem.getSourceDataLine(outputFormat); this.tdl = AudioSystem.getTargetDataLine(inputFormat); }
public Microphone( float sampleRate, int sampleSize, boolean signed, boolean bigEndian) { AudioFormat format = new AudioFormat(sampleRate, sampleSize, 1, signed, bigEndian); try { line = AudioSystem.getTargetDataLine(format); line.open(); } catch (LineUnavailableException e) { throw new IllegalStateException(e); } inputStream = new AudioInputStream(line); }
public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
public JavaSoundAudioRecorder (int samplingRate, boolean isMono) { try { AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, samplingRate, 16, isMono ? 1 : 2, isMono ? 2 : 4, samplingRate, false); line = AudioSystem.getTargetDataLine(format); line.open(format, buffer.length); line.start(); } catch (Exception ex) { throw new GdxRuntimeException("Error creating JavaSoundAudioRecorder.", ex); } }
line = AudioSystem.getTargetDataLine(fmt); line.open(fmt, bufferByteSize); } catch(LineUnavailableException e) {
int numChannels = 1; // Mono AudioFormat format = new AudioFormat(sampleRate, sampleSizeBits, numChannels, true, true); TargetDataLine tdl = AudioSystem.getTargetDataLine(format); tdl.open(format); tdl.start();
microphone = AudioSystem.getTargetDataLine(format);
in = AudioSystem.getTargetDataLine(fmt); out = AudioSystem.getSourceDataLine(fmt); ctrl = (FloatControl)out.getControl(FloatControl.Type.MASTER_GAIN);
SourceDataLine sourceDataLine; try { microphone = AudioSystem.getTargetDataLine(format);
this.info = new DataLine.Info(SourceDataLine.class, format); this.sourceDataLine = (SourceDataLine) AudioSystem.getLine(info); TargetDataLine tdl = AudioSystem.getTargetDataLine(format);