-
Notifications
You must be signed in to change notification settings - Fork 61
Description
I copied the code to encode to an OPUS audio file from the following link. The audio file will play back in Windows, and I think it sounds correct. However, Audacity won't import it (incorrect filetype, even though the file extension is ".opus") and the properties for the audio (via the file explorer) show the media length is 0s.
It occurred to me that the loop doesn't process all bytes from the input stream.
while (fileIn.available() >= inBuf.length) {
It misses a number of bytes. After the loop is done, there are still bytes left in the stream:
fileIn.available()
Results in - Available: 1836
I tried encoding the remaining bytes after the loop, but I got an error:
Exception in thread "main" java.lang.IllegalArgumentException: Not enough samples provided in input signal: Expected 960 samples, found 918
Any suggestions appreciated.
Thanks