I am trying to create a soundbank by reading from a file and passing it onto the getSoundbank
function of MidiSystem.
For this purpose, I have to read the file as InputStream
for which I tried the following techniques but failed.
First technique -- reading the file using FileInputStream
and passing it to the above mentioned function as follows:
InputStream audioSrc = new FileInputStream(file_path);
Soundbank soundbank = MidiSystem.getSoundbank(audioSrc);
It fails with mark/reset exception
Then, I tried the technique mentioned in this thread: java.io.IOException: mark/reset not supported Java Audio Input Stream / Buffered Input Stream
I am faced with java.io.IOException: Resetting to invalid mark
exception with BufferedInputStream
technique and java.lang.NullPointerException
excpetion with url technique.
Is there any other technique to overcome the above mentioned exceptions?