Saving part of audio file (java)
        Posted  
        
            by m159701m
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by m159701m
        
        
        
        Published on 2010-04-05T15:00:08Z
        Indexed on 
            2010/04/05
            15:03 UTC
        
        
        Read the original article
        Hit count: 310
        
java
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
© Stack Overflow or respective owner