[MPlayer-dev-eng] [PATCH] af_scaletempo

Diego Biurrun diego at biurrun.de
Tue Oct 9 14:35:58 CEST 2007


On Sun, Sep 30, 2007 at 12:50:31PM -0400, Robert Juliano wrote:
> 
> Anything else?
> 
> --- /dev/null
> +++ b/libaf/af_scaletempo.c
> @@ -0,0 +1,550 @@
> +/*
> + * scaletempo audio filter
> + * Copyright (c) 2007 Robert Juliano
> + *
> + * This file is part of MPlayer.
> + *
> + * MPlayer is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * MPlayer is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with MPlayer; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + * scale tempo while maintaining pitch
> + * (WSOLA technique with cross correlation)
> + * inspired by SoundTouch library by Olli Parviainen
> + *
> + * basic algorithm
> + *   - produce 'stride' output samples per loop
> + *   - consume stride*scale input samples per loop
> + *
> + * to produce smoother transitions between strides, blend next overlap
> + * samples from last stride with correlated samples of current input
> + *
> + */

Thanks, that's better, but I still prefer putting the license text at
the end of the block.

> --- a/DOCS/man/en/mplayer.1
> +++ b/DOCS/man/en/mplayer.1
> @@ -5112,6 +5112,79 @@ Beware that this filter will turn your signal into mono.
>  .
> +.TP
> +.B scaletempo[=option1:option2:...]
> +Scales audio tempo without altering pitch, optionally synced to playback
> +speed (default).
> +.br
> +This works by playing \'stride\' ms of audio at normal speed then
> +consuming \'stride*scale\' ms of input audio.

What is stride and scale?

> +It pieces the strides together by blending 'overlap'% of stride with
> +audio following the previous stride.
> +It optionally performs a short statistical analysis on the next \'search\'
> +ms of audio to determine the best overlap position.

What is 'search'?

> +.PD 0
> +.RSs
> +.IPs scale=<amount>
> +Nominal amount to scale tempo.
> +Scales this amount in addition to speed.
> +(default: 1.0)
> +.IPs stride=<amount>
> +Length in milliseconds to output each stride.
> +Too high of value will cause noticable skips at high scale amounts and

Too high values

> +an echo at low scale amounts.
> +Very low values will alter pitch.
> +Increasing improves performance.

Increasing stride improves performance.

> +(default: 60)
> +.IPs overlap=<percent>
> +Percentage of stride to overlap.
> +Decreasing improves performance.

ditto

> +(default: .20)
> +.IPs search=<amount>
> +Length in milliseconds to search for best overlap position.
> +Decreasing improves performance greatly.

ditto

> +.IPs tempo
> +Scale tempo in sync with speed (default)

missing period

> +.I WARNING:
> +Looses synch with video.

Loses sync with video.

> +.IPs both
> +Scale both tempo and pitch

missing period

> +.IPs none
> +Ignore speed changes

missing period

> +.RSs
> +.IPs "mplayer \-af scaletempo \-speed 1.2 media.ogg"
> +Would playback media at 1.2x normal speed, with audio at normal pitch.

Would play media.ogg at 1.2x normal speed with audio at normal pitch.

> +Changing playback speed, would change audio tempo to match.

Leave out the comma.

> +.IPs "mplayer \-af scaletempo=scale=1.2:speed=none \-speed 1.2 media.ogg"
> +Would playback media at 1.2x normal speed, with audio at normal pitch,
> +but changing playback speed has no effect on audio tempo.

see above

> +.IPs "mplayer \-af format=floatne,scaletempo media.ogg"
> +Would make scaletempo use float code.

floating point

> +Maybe faster on some platforms.

May be

> +.IPs "mplayer \-af scaletempo=scale=1.2:speed=pitch audio.ogg"
> +Would playback audio file at 1.2x normal speed, with audio at normal pitch.
> +Changing playback speed, would change pitch, leaving audio tempo at 1.2x.

see above

Diego



More information about the MPlayer-dev-eng mailing list