B
Big D
Hey there. I'd like to concatenate multiple wav files together. I've
got an almost completely working system for it, actually... I'm using
AudioSystem.write and my own subclass of AudioInputStream to do it.
Basically, my AudioInputStream contains a List of AudioInputStreams that
came from the wav files I want to concatenate, and
for each stream added, I add its frameLength to my subclass's framelength
so it reports as being the
right length. All my source wav files are the same type, so that is a safe
assumption to make.
Then when it comes time to read, my AudioInputStream just overrides the
read methods and calls read on each subsequent stream in its List.
It all works pretty well. When I open the resulting output in Audacity, it
plays perfectly. However, when I open it with Windows Media Player, it
reports an error mid-way through and then stops playing 2 seconds from the
end of the file.
When I export the file I created from Audacity as a wav, it creates a wav
of exactly the same number of bytes, however when I compare my output and
Audacity's output in a hex editor, I see that some of the bytes are
different throughout the files.
Can anyone tell me what I'm doing wrong / how to get the wavs I create to
work in media player?
I considered that maybe I'm getting the headers repeatedly in there, but
I've discounted that possibility because I can successfully concatenate my
test wavs 20+ times with repetitions and it plays fine every time until 2
seconds before the end. If I'd gotten headers in there, I'd expect them to
make popping sounds or screw things up earlier.
Thanks for any advice!
got an almost completely working system for it, actually... I'm using
AudioSystem.write and my own subclass of AudioInputStream to do it.
Basically, my AudioInputStream contains a List of AudioInputStreams that
came from the wav files I want to concatenate, and
for each stream added, I add its frameLength to my subclass's framelength
so it reports as being the
right length. All my source wav files are the same type, so that is a safe
assumption to make.
Then when it comes time to read, my AudioInputStream just overrides the
read methods and calls read on each subsequent stream in its List.
It all works pretty well. When I open the resulting output in Audacity, it
plays perfectly. However, when I open it with Windows Media Player, it
reports an error mid-way through and then stops playing 2 seconds from the
end of the file.
When I export the file I created from Audacity as a wav, it creates a wav
of exactly the same number of bytes, however when I compare my output and
Audacity's output in a hex editor, I see that some of the bytes are
different throughout the files.
Can anyone tell me what I'm doing wrong / how to get the wavs I create to
work in media player?
I considered that maybe I'm getting the headers repeatedly in there, but
I've discounted that possibility because I can successfully concatenate my
test wavs 20+ times with repetitions and it plays fine every time until 2
seconds before the end. If I'd gotten headers in there, I'd expect them to
make popping sounds or screw things up earlier.
Thanks for any advice!