Saving part of audio file (java)
- by m159701m
Hi evryone,
While playing an audio file (.wav) I want , if I resort to ctrl+c , to stop the playback and save
part of the audio file in a file called "file2.wav".
Here's the thread I'd like to add to my code.
Unfortunately it doesn't work at all.
Thanks in advance
class myThread extends Thread{
public void run(){
try {
PipedOutputStream poStream = new PipedOutputStream();
PipedInputStream piStream = new PipedInputStream();
poStream.connect(piStream);
File cutaudioFile = new File ("file2.wav");
AudioInputStream ais = new AudioInputStream(piStream, AudioFileFormat.Type.WAVE , cutaudioFile);
poStream.write(ais,AudioFileFormat.Type.WAVE,cutaudioFile);
}catch (Exception e){
e.printStackTrace();
}
} // end run
} // end myThread