0

On the inner flap of a CD I just purchased and encoded to FLAC, there was a note saying that in order to experience the music at the appropriate pitch level (important for classical music), the pitch has to be adjusted by -3%, resulting in a similar decrease in tempo, which is also appropriate. How can I obtain the decrease in pitch and speed when playing back the .flac files? Doing it via CLI would be a plus but not necessary.

Note: not the same as How can I modify the pitch of my audio output?, Ubuntu Audio Pitch Shifting filter, How to control Banshee playback speed?, Music/podcast player with speed control?, or any other question that requires pitch is affected but not speed, or vice versa. Also, I am not asking about changing the system-wide audio pitch and speed.

Richard
  • 8,502
  • 11
  • 47
  • 72
  • it seems to me you would want to do this permanently no? there are tools like sox that would do the trick. – wxl Sep 09 '14 at 03:30
  • No, I would not like to do this permanently - as I said in my question, it's only one CD that has this issue. – Richard Sep 09 '14 at 14:37
  • what i'm suggesting is having new FLACs for this one CD that are permanently set to the right speed and pitch. – wxl Sep 09 '14 at 15:23
  • Oh I see. Actually that would be wonderful. I will check out that tool you suggested. – Richard Sep 09 '14 at 20:49

2 Answers2

2
  • If you can import your sound file in Audacity, you will have, in "Effects" menu, a "change speed " function : you can precisely set speed to any percent between -100 and +400 .
  • Or with mplayer and speed option, command line would be :
    mplayer -speed 0.97 soundfile.mp3
laugeo
  • 2,827
  • to mplayer wouldn't you need to add --af=scaletempo=scale:both to be sure that both pitch and tempo are affected? default is only pitch. – wxl Sep 09 '14 at 21:30
  • I suppose --af=scale tempo is mainly for changing tempo but keeping sound tuning (or reverse), so more complex than the simple -speed option – laugeo Sep 10 '14 at 12:51
1

I think the Audacity option mentioned by @laugeo is a good one, but not CLI as you would prefer. The mplayer option is a command line one, but is not permanent.

Since this really only affects one set of files and you don't want to have to think about changing these factors every single time you play them in exclusion to other files that don't need this application, I think it would be better to simply re-encode the files into a version that you can play normally, without having to do something special.

You can use the command line tool sox to do this for you. According to its manpage, the speed effect will do the trick:

   speed factor[c]
          Adjust  the  audio  speed (pitch and tempo together).  factor is
          either the ratio of the new speed to the old speed: greater than
          1  speeds  up,  less than 1 slows down, or, if appended with the
          letter `c', the number of cents (i.e. 100ths of a  semitone)  by
          which  the  pitch (and tempo) should be adjusted: greater than 0
          increases, less than 0 decreases.

So for each file you would do:

sox /path/to/input.flac /path/to/output.flac speed 0.97 

If you want to go crazy with it, you can try to mess with the rate effect, as mentioned in the end of the notes on speed:

          Technically, the speed  effect  only  changes  the  sample  rate
          information, leaving the samples themselves untouched.  The rate
          effect is invoked automatically to resample to the output sample
          rate,  using  its  default quality/speed.  For higher quality or
          higher speed  resampling,  in  addition  to  the  speed  effect,
          specify the rate effect with the desired quality option.

Here's the info on rate summarized for you.

   rate [-q|-l|-m|-h|-v] [override-options] RATE[k]
          Change  the audio sampling rate (i.e. resample the audio) to any
          given RATE (even non-integer if this is supported by the  output
          file format) using a quality level defined as follows:
                       Quality   Band-   Rej dB   Typical Use
                                 width
                 -q     quick     n/a    ≈30 @    playback on
                                          Fs/4    ancient hardware
                 -l      low      80%     100     playback on old
                                                  hardware
                 -m    medium     95%     100     audio playback
                 -h     high      95%     125     16-bit mastering
                                                  (use with dither)
                 -v   very high   95%     175     24-bit mastering
          The simple quality selection described above  provides  settings
          that satisfy the needs of the vast majority of resampling tasks.
          Occasionally, however, it may  be  desirable  to  fine-tune  the
          resampler's   filter   response;  this  can  be  achieved  using
          override options, as detailed in the following table:
          -M/-I/-L     Phase response = minimum/intermediate/linear
          -s           Steep filter (band-width = 99%)
          -a           Allow aliasing/imaging above the pass-band
          -b 74-99.7   Any band-width %
          -p 0-100     Any phase response (0 = minimum, 25 = intermediate,
                       50 = linear, 100 = maximum)

So if you wanted highest standard quality and 48kHz sample rate your command would grow to:

sox /path/to/input.flac /path/to/output.flac speed 0.97 rate -v 48k
wxl
  • 901
  • 5
  • 23
  • Very useful, and the method will ensure I get maximum quality through resampling. +1 – Richard Sep 09 '14 at 23:22
  • happy to help. i LOVE SoX and like to spread word about it wherever i can. its only problem is that it's often too complex for non-audio geeks, e.g. the overriding options for rate! – wxl Sep 09 '14 at 23:24
  • Yeah, sox does seem like a very powerful and useful tool. – Richard Sep 09 '14 at 23:31