Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Defines an audio format
- */
- AudioFormat getAudioFormat() {
- float sampleRate = 16000;
- int sampleSizeInBits = 8;
- int channels = 1;
- boolean signed = true;
- boolean bigEndian = false;
- AudioFormat format = new AudioFormat(sampleRate, sampleSizeInBits,
- channels, signed, bigEndian);
- return format;
- }
- //How I open the line:
- AudioFormat format = getAudioFormat();
- DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
- if (!AudioSystem.isLineSupported(info)) {
- System.out.println("Line not supported");
- System.exit(0);
- }
- line = (TargetDataLine) AudioSystem.getLine(info);
- line.open(format);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement