How to create a huge wav file containing multiple tracks?

2 views (last 30 days)
I recorded five audio tracks (48kHz, 32bit, 1h) which I would like to write into one file with 5 channels à (48kHz, 32bit, 1h). When I simply read the tracks with audioread , I run out of memory. Using system objects didn't help as it turned out that dsp.AudioFileWriter does not allow to write more than two channels at once. Is there another technique how I could achieve that?
  1 Comment
Roman
Roman on 12 Dec 2014
In version R2013b dsp.AudioFileWriter can handle more than 2 channels. However, if I copy one channel with the system object approach as shown below,
hafw = dsp.AudioFileWriter(RecFile,'FileFormat','WAV','SampleRate',hafr0.SampleRate);
hafr0 = dsp.AudioFileReader(PlayFile0,'SamplesPerFrame',SamplesPerFrame);
playbuff = zeros(SamplesPerFrame,5);
while ~isDone(hafr0)
playbuff(:,1) = step(hafr0);
step(hafw,playbuff);
end
I get the following error after some time:
Error using AudioFileReader/step the audio input stream has become unresponsive.
Error in combine (line 31) playbuff(:,1) = step(hafr0);
Any idea what could have gone wrong?

Sign in to comment.

Accepted Answer

Roman
Roman on 15 Dec 2014
I couldn't solve the problem right in Matlab but with "SoX, the Swiss Army knife of sound processing programs" I was able to merge the tracks.

More Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!