at.tuwien.ifs.feature.extraction.audio.input
Class AudioFileSegmentReader
java.lang.Object
at.tuwien.ifs.feature.extraction.audio.input.AudioFileSegmentReader
public class AudioFileSegmentReader
- extends java.lang.Object
Copyright Vienna University of Technology
- Version:
- $Id: AudioFileSegmentReader.java 173 2010-06-17 16:28:05Z mayer $
- Author:
- Thomas Lidy, Jakob Frank
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
inStream
private java.io.InputStream inStream
audioInputStream
private javax.sound.sampled.AudioInputStream audioInputStream
mpegInputStream
private javax.sound.sampled.AudioInputStream mpegInputStream
audioFileFormat
private javax.sound.sampled.AudioFileFormat audioFileFormat
audioFormat
private javax.sound.sampled.AudioFormat audioFormat
open
private boolean open
isMpeg
private boolean isMpeg
sampleRate
private int sampleRate
sampleSizeInBits
private int sampleSizeInBits
nChannels
private int nChannels
lengthInFrames
private long lengthInFrames
durationMicrosec
private long durationMicrosec
streamLength
private long streamLength
AudioFileSegmentReader
public AudioFileSegmentReader(java.io.File file)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
AudioFileSegmentReader
public AudioFileSegmentReader(javax.sound.sampled.AudioInputStream inStream)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
convertFileToByteArray
private static byte[] convertFileToByteArray(java.io.File f)
throws java.io.IOException
- Throws:
java.io.IOException
getSampleRate
public int getSampleRate()
getSampleSizeInBits
public int getSampleSizeInBits()
getNumberOfSamples
public long getNumberOfSamples()
getDurationInSeconds
public int getDurationInSeconds()
readMpegProperties
private void readMpegProperties()
openStream
public void openStream()
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
resetStream
public void resetStream()
throws java.io.IOException
- Throws:
java.io.IOException
closeStream
public void closeStream()
throws java.io.IOException
- Throws:
java.io.IOException
readMono
public int readMono(short[] outputArray)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(short[] outputArray)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(byte[] outputArray)
throws java.io.IOException
- Parameters:
outputArray
- array into which input is read (# of bytes to read equals size of array)
- Returns:
- number of bytes actually read (can be smaller at the end of file, or -1 in case of
errors)
- Throws:
java.io.IOException