com.speech4j.sound
Class AudioBuffer

java.lang.Object
  |
  +--com.speech4j.sound.AudioBuffer

public class AudioBuffer
extends java.lang.Object

Chunk of audio data

Version:
1.1
Author:
Pavel Vlasov

Constructor Summary
AudioBuffer()
           
 
Method Summary
 AudioBuffer convert(javax.sound.sampled.AudioFormat newFormat)
          Converts the buffer to a new format
 byte[] getData()
          Audio data
 javax.sound.sampled.AudioFormat getFormat()
          Audio format of the buffer
 void load(java.lang.String fileName)
          Reads an audio file to the buffer.
 void save(java.lang.String fileName)
          Saves the buffer to a wav file.
 void setData(byte[] data)
          Audio data
 void setFormat(javax.sound.sampled.AudioFormat format)
          Audio format of the buffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioBuffer

public AudioBuffer()
Method Detail

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Audio format of the buffer

Returns:
audio format

setFormat

public void setFormat(javax.sound.sampled.AudioFormat format)
Audio format of the buffer

Parameters:
format - Audio format

getData

public byte[] getData()
Audio data

Returns:
audio data

setData

public void setData(byte[] data)
Audio data

Parameters:
data - Audio data

load

public void load(java.lang.String fileName)
          throws java.io.IOException,
                 javax.sound.sampled.UnsupportedAudioFileException
Reads an audio file to the buffer.

Parameters:
fileName - File name
Throws:
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException

save

public void save(java.lang.String fileName)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Saves the buffer to a wav file.

Parameters:
fileName - File name
Throws:
java.io.FileNotFoundException
java.io.IOException

convert

public AudioBuffer convert(javax.sound.sampled.AudioFormat newFormat)
                    throws SoundException
Converts the buffer to a new format

Parameters:
newFormat - New format
Returns:
Audio buffer with converted data
SoundException


Copyright © 2003 Pavel Vlasov. All Rights Reserved.