i'm reading the audio data from a WAV in small chunks of about 8000 bytes, using a loop with the audioInputStream.read() method to read each chunk of data into a byte array. the app then processes the data in the byte array, then repeats the loop for each consecutive chunk of data.
i need to save the data to a new WAV file. ideally i'd like to stream the data out in a similar way as it's streaming in, so at the end of each iteration i can write the modified byte array out to the new file, and discard the data. i cannot seem to find ANY way of doing this at all.
really what i need is a version of the AudioInputStream class that allows me to write to it rather than read from it (AudioOutputStream anyone?). then i could use this to write a new WAV file chunk by chunk as i need to.
I have tried to save first chunk of byte that I have read in the first iteration in:
ByteArrayInputStream tt=new ByteArrayInputStream(byte audioBytes);
and then save this ByteArrayInputStream in audioInputStream to write it in the file
but in this way I will only write the first bytes from the first iteration only since that I don't know how to read another chuck of data and concatenating it to the previous one and then when I finish write all of then to a file
Sounds to me like you need to create an InputStream that merges many other InputStreams. I would expect it to have a method to append() an InputStream and exhaust that before processing the next InputStream. Obviously you should not allow the end-of-stream to propagate though and you would need to have a method to indicate when no more appends() are allowed and an end-of-stream can be reported.
15 minutes work!
P.S. Your urgency is your problem and by marking a post as urgent you are more likely to have the opposite effect to the one you desired.
I guess if it's urgent then you probably don't need any help at this point, so I'll be vague since I'm probably wasting my time answering your question anyway...
Rather than using a ByteArrayInputStream, you should use a PipedInputStream connected to a PipedOutputStream. You can use the PIS to build your AIS, and you can write directly into the POS and have it write automatically to the PIS which will write automatically to the AIS.
[ugg boots|http://outlet-ugg-boots.com] [hair straighteners|http://chi-ghd-hair-straighteners.com] [nfl jerseys |http://cheap-nfl-jerseys-store.com] [Christian Louboutin |http://www.cheap-louboutin-shoes.com] [vibram five fingers|http://vibram-store.com] Standard vibram five fingers digital audio file format Christian Louboutin used for storing waveform nfl jerseys data; allows audio recordings to be saved with different sampling rates and bitrates; often saved in a 44.1 KHz, 16-bit, stereo format, which is the standard format used for CD audio.
WAV is short for "Waveform Audio File Format," and is pronounced "wave;" WAV files are similar to .AIF files, but they are based on the Resource Interchange File Format (RIFF), rather than the Audio Interchange File Format (AIFF); WAV files are most ugg boots often seen on Windows-based computers, while AIF files are more common on Macintosh systems.hair straighteners