[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

speeding up mp3 playback in mpg123 mode



Hi Folks,

I have added a way to vary the playback speed in mpg123 mode.  I have
had partial success.  I can change speed just fine, but I sometimes
lose the ability to go forward and backward (the "F", "f", "b" and "B"
commands) in the mpeg file.

As more and more spoken texts have become available in mpeg format I
wanted a way to increase speed durring playback (without increasing
pitch).  I have found that mpg123 can do this and made a minor
modification to mpg123-el to allow the user to change playback speed.

Unlike changing the speed of a wav file which increases or decreases
the pitch as the speed changes but does not change the quality of the
playback, adding these parameters to mpg123 keep the pitch the same,
change the speed but do have a detrimental effect on the quality of
the playback in some cases.

Mpg123 (the program, not the mode) has 2 parameters that affect
playback speed "-d n" or "--doublespeed n", which multiplys speed by
"n" and "-h n" or "--halfspeed n", which divides speed by "n".  See
the man page for mpg123 for a full explanation, but in both cases, "n" is
a positive integer.  So "-d 2" will double playback speed, "-h 2" will
half it.  Doubling speed is comparatively clean sounding.  Sometimes
double speed is too fast, in that case you can combine the "-d" and
"-h", so that "-h 2 -d 3" will reduce the speed in half and increase
that by 3, so you get 3/2 or 150% that is to say a 50% speed increase.
However, while producing the desired speed increase, specifying
fractional changes produce choppy sounding output and produces
undesireable results when trying to move forward or backward in the
playback.

So, to try this out I added the -h n and -d n in mpg123.el so that
from inside emacs you can manipulate the speed of playback.  This is
accomplished by setting the new variables "mpg123-speed-double" and
"mpg123-speed-half".  These variables expect to be given a positive
integer enclosed in quotation marks.  They each have a default
setting of "1".  Setting mpg123-speed-double to "2" (that is
double-quote, the number two, double-quote) will double the
playback speed of the mpg file without changing the pitch.

As long as I only double the speed moving forward and backward in the
mpeg file works as well (or as poorly) as it does normaly.  Adding
halfing of the speed messes up moving forward or back in the file by 1
or 10 seconds.  Sometimes this does not matter, so I use it anyway.

Enough babbling, for those of you who want to try this, after loading
mpg123.el load mpg123-mods.el with M-x load-file.  Then at any time
you can do:

M-x set-variable 
mpg123-speed-double 
"2"

and start the playback.  To go back to normal speed, change the value of
mpg123-speed-double back to "1".

To play with the half speed setting the variable name is
mpg123-speed-half.

If enough people find this usefull I will clean it up and try to make
setting it more elegant.

Here is mpg123-mods.el, try it out and let me know what you think.

elisp add-on to mpg123.el


-Greg

--
 Greg Priest-Dorman
 priestdo@cs.vassar.edu