WAV files sound high pitched - how do I bulk fix the sample rate in the metadata?

3

For stupid reasons, I think I recorded a bunch of stuff through a USB microphone that reported to the OS as a 48.0 kHz input device while it was actually 44.1 kHz. Oddly enough it worked normally until suddenly my sound files sounded high pitched. I can only speculate what happened exactly, but these are the facts:

  • I usually record through an aggregate device on macOS that is set to 48 kHz. Normally I initialize my microphone (which is part of the aggregate device) to 48 as well, but this time it accidentally recorded to 44.1.
  • My recordings report a 48 kHz sample rate and sound high pitched.

I assume that I somehow have to edit the metadata of all my sound files to report a sample rate of 44.1 kHz instead of 48.0 kHz. How do I do that? I have Reaper.

Pieter

Posted 2020-11-14T17:49:25.450

Reputation: 383

Answers

5

Nevermind, I found something. The command line tool sox seems to do the trick:

find . -name '*.wav' | xargs -I {} basename {} .wav | xargs -I {} sox -r 44100 {}.wav {}.edited.wav
find . -name '*.edited.wav' | xargs -I {} basename {} .edited.wav | xargs -I {} mv {}.edited.wav {}.wav

First line takes all of the WAV files in the current directory and saves a copy of every file with 44.1 kHz set as the sample rate. Second line takes all of the edited copies and renames them to the original input files, overwriting the file in the process. This second command is a destructive operation.

Pieter

Posted 2020-11-14T17:49:25.450

Reputation: 383

Okay, I will. According to the website I can't do that for another 20 hours but I'll come back tomorrow. – Pieter – 2020-11-15T21:09:07.140