Ubuntu: How can I use pitch and speed control for audio CDs?



Question:

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.


Solution: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  


Solution: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

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »