Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

I've just recorded about an hour of audio in Audacity. All the data appears to be there, but unfortunately it's all duplicated -- it seems that blocks of roughly three seconds are repeated, and the recording is twice as long as it should be. So if I was expecting to hear abc then I've actualy got aabbcc.

All the blocks seem to be the same length, although I've not determined that length yet, and I hypothesise that they must be bit-identical, but I've not checked that either. I'm looking for a way to de-duplicate the audio, leaving me with something I can use.

share|improve this question
add comment

migrated from avp.stackexchange.com Jan 27 at 14:59

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

1 Answer

up vote 3 down vote accepted

Since your profile says you are a programmer, then you can fix this fairly easily by writing a small program that will open your WAV file, then copy n bytes, skip n bytes, etc until the end of the file. You can also prove that the repeated chunks are bit identical too.

Off the top of my head, here's the C# code I would write using my own library of audio utils (NAudio). There are similar libraries available for other programming languages.

using (var reader = new WaveFileReader("myfile.wav"))
{
    using (var writer = new WaveFileWriter("fixed.wav", reader.WaveFormat);
    {
        // buffer size is the magic number - based on sample rate, bit depth, no of channels,
        // and duration of the repeated segment,
        byte[] buffer = new byte[5000];
        int read;
        do
        {
            // read the block to copy
            read = reader.Read(buffer, 0, buffer.Length);
            writer.Write(buffer, 0, read);
            // read the block to discard
            read = reader.Read(buffer, 0, buffer.Length);
        } while (read > 0);
    }
}
share|improve this answer
    
Unfortunately, this does appear to be my best bet. –  Andrew Aylett May 3 '11 at 21:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.