5

I am intending to take my entire music collection and change the pitch from the original recorded a=440hz to the more natural sounding/feeling a=432hz.

For those of you who are not familiar with this concept, or the "why" for doing this, I highly encourage you to do a google search and see what it's all about. But that is not entirely relevant.

I understand that I could even take Audacity and one-by-one, convert and re-export the files with the new pitch. I have tried this and yes, it does work. However, my collection is quite large and I was excited to find are more fitting command-line option, SOX. Any idea ?

Sylvain Leroux
  • 50,096
  • 7
  • 103
  • 125
user2946608
  • 51
  • 1
  • 3

3 Answers3

6
$ sox your_440Hz_music_file.wav your_432Hz_music_file.wav pitch -31
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Prana
  • 69
  • 2
4

This is asking way more than one question. Break it down into subproblems, for instance:

  • how to batch-process files (in whatever language you like: perl, bash, .bat, ruby)
  • how to structure a set of directories to simplify that task
  • how to change the pitch (with or without changing duration) of a single audio file
  • how to detect the mean pitch (concert, baroque, or whatever) of a recording of tonal music, by using a wide FFT, so you don't accidentally change something that's already 432 to 424

As you work through these, when you get stuck, ask a question in the form of a "simplest possible example" (SO gives much more advice about how to ask). Often, while formulating such a question, you'll find the answer in the related questions that SO offers you.

Camille Goudeseune
  • 2,934
  • 2
  • 35
  • 56
2

sox's pitch filter only accepts 'cents' (100th of a semitone), so you have to calculate the distance between 432Hz and 440Hz in 'cents'. This involves the following logarithmic calculation:

2x/12 = 432/440
x/12 = log(432/440) / log(2)
   x = log(432/440) / log(2) * 12
   x = -0.3176665363342927165015877324608 semitones
   x = -31.76665363342927165015877324608 'cents'

So this sox command should work:

sox input.wav output.wav pitch -31.76665363342927165015877324608

For those interested; this can also be done with sox's open-source counterpart :

ffmpeg -i input.wav -af "asetrate=44100*432/440,aresample=44100,atempo=440/432" output.wav

Or if ffmpeg is compiled with the Rubberband library:

ffmpeg -i input.wav -af "rubberband=pitch=432/440" output.wav
Reino
  • 3,203
  • 1
  • 13
  • 21