1   package org.daisy.pipeline.audio;
2   
3   import java.io.File;
4   import java.io.FileInputStream;
5   import java.io.InputStream;
6   
7   import javax.sound.sampled.AudioInputStream;
8   import javax.sound.sampled.UnsupportedAudioFileException;
9   
10  public interface AudioDecoder {
11  
12  	/**
13  	 * Decode an audio file into raw (PCM encoded) audio.
14  	 *
15  	 * @param inputFile is the input audio file
16  	 * @return the raw output audio
17  	 * @throws UnsupportedAudioFileException if this decoder does not recognize
18  	 *                                       the file format of <code>inputFile</code>
19  	 * @throws Throwable when some other error happens
20  	 */
21  	default AudioInputStream decode(File inputFile) throws UnsupportedAudioFileException, Throwable {
22  		return decode(new FileInputStream(inputFile));
23  	}
24  
25  	AudioInputStream decode(InputStream input) throws UnsupportedAudioFileException, Throwable;
26  }