2

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.

2 Answers 2

3

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);
    }
}
1
  • Unfortunately, this does appear to be my best bet.
    – Andrew Aylett
    Commented May 3, 2011 at 21:38
-1

Dont know what version you have. I am stuck with 2.1 due to old opsys.

But it sounds like you have interleaved stereo instead of the dual stereo files. Maybe thats the other way around:)

So is it duplicated on screen in audacity or is it duplicated in the physical wav file?

Can you play the file okay or do you hear those repeats as stutter.

Really need a lot more detailed info to know what your sitrep is.

1
  • 1
    Might be worth reading the date of the OP before asking for further information. Also consider whether the answer you submit is of a higher quality than an existing accepted answer. Does it add value?
    – Mark
    Commented Jan 26, 2020 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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