shithub: sox

Download patch

ref: c732806642d50570b6ab392467df07b78b216f97
parent: 98c0f2834f32b28ca0582aeef91fc602a9ea6517
author: cbagwell <cbagwell>
date: Tue Apr 11 10:33:31 EDT 2000

Added a speed effect.  Fixed final buffer problem in stat effect.

--- a/Changelog
+++ b/Changelog
@@ -66,6 +66,9 @@
   o Richard Kent fixed a byte alignment problem in aiff comment code.
   o Loring Holden added support to create missing directories on install
     and support for installs from outside the source directory.
+  o Fabien COELHO added a pan and volume effect.
+  o Fabien COELHO added a speed effect to sox (like speeding up a tape
+    machine).
 
 sox-12.16
 ---------
--- a/Makefile.dos
+++ b/Makefile.dos
@@ -20,7 +20,7 @@
 	  echos.obj filter.obj flanger.obj highp.obj highpass.obj lowp.obj \
           lowpass.obj map.obj mask.obj phaser.obj pick.obj pan.o \
 	  polyphase.obj rate.obj resample.obj reverb.obj \
-	  reverse.obj split.obj stat.obj swap.obj vibro.obj vol.obj
+	  reverse.obj speed.obj split.obj stat.obj swap.obj vibro.obj vol.obj
 
 LIBOBJS   = $(FOBJ) $(EOBJ) handlers.obj libst.obj misc.obj getopt.obj util.obj
 
--- a/Makefile.gcc
+++ b/Makefile.gcc
@@ -37,7 +37,7 @@
           copy.o cut.o deemphas.o echo.o echos.o filter.o flanger.o \
           highp.o highpass.o lowp.o lowpass.o map.o mask.o pan.o \
           phaser.o pick.o polyphas.o rate.o resample.o reverb.o \
-          reverse.o split.o stat.o swap.o vibro.o vol.o
+          reverse.o speed.o split.o stat.o swap.o vibro.o vol.o
 
 SOUNDLIB = libst.a
 LIBOBJS = $(FOBJ) $(EOBJ) handlers.o libst.o misc.o util.o getopt.o
--- a/Makefile.os9
+++ b/Makefile.os9
@@ -30,8 +30,8 @@
 	  $(RDIR)/pan.r $(RDIR)/phaser.r $(RDIR)/pick.r \
 	  $(RDIR)/polyphas.r $(RDIR)/rate.r \
 	  $(RDIR)/resample.r $(RDIR)/reverb.r $(RDIR)/reverse.r \
-	  $(RDIR)/split.r $(RDIR)/stat.r $(RDIR)/swap.r $(RDIR)/vibro.r \
-	  $(RDIR)/vol.r
+	  $(RDIR)/speed.r $(RDIR)/split.r $(RDIR)/stat.r $(RDIR)/swap.r \
+	  $(RDIR)/vibro.r $(RDIR)/vol.r
 
 
 LIBOBJS	=	$(FOBJ) $(EOBJ) $(RDIR)/handlers.r $(RDIR)/libst.r \
--- a/README
+++ b/README
@@ -39,8 +39,9 @@
   o Add an echo 
   o Add a sequence of echos
   o Apply a flanger effect
-  o Apply a high-pass filters
-  o Apply a low-pass filters
+  o Apply a high-pass filter
+  o Apply a low-pass filter
+  o Pan sound between channels
   o Display a list of loops in a file
   o Add masking noise to a signal
   o Apply a phaser effect
@@ -50,10 +51,13 @@
      changes using real signal theory!
   o Apply a reverb effect
   o Reverse the sound samples (to search for Satanic messages ;-)
+  o Change the speed of samples being played (like speeding up the motor
+    on a tape recorder)
   o Convert from mono to stereo
   o Swap stereo channels
   o Display general stats on a sound sample
   o Add the world-famous Fender Vibro-Champ effect
+  o Adjust volume of samples
 
 History:
 
--- a/sox.1
+++ b/sox.1
@@ -107,6 +107,8 @@
 .br
 	reverse
 .br
+	speed \ffactor\f
+.br
 	split
 .br
 	stat [ \fIdebug\fB | \fI-v\fB ]
@@ -848,6 +850,14 @@
 Reverse the sound sample completely.
 Included for finding Satanic subliminals.
 .TP 10
+speed \ffactor\f
+Speed up or down the sound, as a magnetic tape with a speed control. 
+It affects both pitch and time. A factor of 1.0 means no change, 
+and is the default. 
+2.0 doubles speed, thus time length is cut by a half and pitch 
+is one octave higher. 
+0.5 halves speed thus time length doubles and pitch is one octave lower. 
+.TP 10
 split
 Turn a mono sample into a stereo sample by copying
 the input channel to the left and right channels.
@@ -908,7 +918,7 @@
 .br
 When type is 
 .I dB
-the amplitude is change logrithmically.
+the amplitude is change logarithmically.
 0.0 is constant while +6 doubles the amplitude.
 .P
 .I Sox
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -49,7 +49,7 @@
 	  copy.o cut.o deemphas.o echo.o echos.o filter.o flanger.o \
 	  highp.o highpass.o lowp.o lowpass.o map.o mask.o pan.o \
 	  phaser.o pick.o polyphas.o rate.o resample.o reverb.o \
-	  reverse.o split.o stat.o swap.o vibro.o vol.o
+	  reverse.o speed.o split.o stat.o swap.o vibro.o vol.o
 
 OSSOBJ_0    =
 OSSOBJ_1    = oss.o
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -581,6 +581,12 @@
 extern int st_reverse_drain();
 extern int st_reverse_stop();
 
+extern int st_speed_getopts();
+extern int st_speed_start();
+extern int st_speed_flow();
+extern int st_speed_drain();
+extern int st_speed_stop();
+
 extern int st_split_getopts();
 extern int st_split_start();
 extern int st_split_flow();
@@ -702,6 +708,9 @@
 	{"reverse", 0, 
 		st_reverse_getopts, st_reverse_start, 
 		st_reverse_flow, st_reverse_drain, st_reverse_stop},
+	{"speed", 0, 
+		st_speed_getopts, st_speed_start, 
+		st_speed_flow, st_speed_drain, st_speed_stop},
 	{"split", ST_EFF_CHAN | ST_EFF_MCHAN, 
 		st_split_getopts, st_split_start, st_split_flow, 
 		st_null_drain, st_split_stop},
--- a/src/stat.c
+++ b/src/stat.c
@@ -185,6 +185,7 @@
 		stat->last = samp;
 	}
 	stat->read += len;
+	*isamp = *osamp = len;
 	/* Process all samples */
 	return (ST_SUCCESS);
 }