History

Added multiband compander effect

cbagwell committed 22 years ago

Commit fec8e041 parent bd0eddd10 files · +79 −16Browse files

Unified · Split

10 files
  1. Changelog +2 −0
  2. scripts/fmsim +18 −0
  3. sox.1 +16 −0
  4. sox.txt +28 −11
  5. src/Makefile.dos +1 −1
  6. src/Makefile.gcc +2 −2
  7. src/Makefile.in +1 −1
  8. src/handlers.c +3 −0
  9. src/play.in +1 −1
  10. src/st_i.h +7 −0
Changelog+2−0
@@ -49,6 +49,8 @@ sox-12.17.6 · 48 unmodified lines
49 o Added patch from Eric Benson that attempts to do a seek()49 o Added patch from Eric Benson that attempts to do a seek()
50 if the first effect is trim. This greatly speeds up50 if the first effect is trim. This greatly speeds up
51 processing large files.51 processing large files.
52 o Daniel Pouzzner implemented a multi-band compander (using
53 the butterworth filters to split the audio into bands).
52 54
53sox-12.17.555sox-12.17.5
54-----------56-----------
scripts/fmsim+18−0
@@ -0,0 +1,18 @@
1#!/bin/sh
2#
3# fmsim - simulates FM radio sound (or broadcast signal condition if the
4# lowp at the end is skipped - not that the pipeline is set up with
5# US-style 75us preemphasis).
6#
7# Thats signed 32-bit 44100Hz audio from stdin and outputs to stdout.
8
9
10../src/sox -V -t raw -r 44100 -s -w -c 2 - -t raw -r 44100 -s -l -c 2 \
11 - vol -3 db filter 8000- 32 100 mcompand ".005,.1 \
12 -47,-40,-34,-34,-17,-33 0 0 0" 100 ".003,.05 \
13 -47,-40,-34,-34,-17,-33 0 0 0" 400 ".000625,.0125 \
14 -47,-40,-34,-34,-15,-33 0 0 0" 1600 ".0001,.025 \
15 -47,-40,-34,-34,-31,-31,-0,-30 0 0 0" 6400 \
16 "0,.025 -38,-31,-28,-28,-0,-25 0 0 0" vol 27 db vol -12 \
17 db highpass 22 highpass 22 filter -17500 256 vol +12 db \
18 vol -3 db lowp 17801
sox.1+16−0
@@ -93,6 +93,12 @@ sox \- Sound eXchange : universal sound sample translator · 92 unmodified lines
93 \fBlowpass\fR \fIfrequency\fR93 \fBlowpass\fR \fIfrequency\fR
94.br94.br
95 \fBmask\fR95 \fBmask\fR
96.br
97 \fBmcompand\fR "\fIattack1\fR,\fIdecay1\fR[,\fIattack2\fR,\fIdecay2\fR...]
98.br
99 \fIin-dB1\fR,\fIout-dB1\fR[,\fIin-dB2\fR,\fIout-dB2\fR...]
100.br
101 [ \fIgain\fR [ \fIinitial-volume\fR [ \fIdelay\fR ] ] ]" xover_freq
96.br102.br
97 \fBpan\fR \fIdirection\fR103 \fBpan\fR \fIdirection\fR
98.br104.br
@@ -907,6 +913,16 @@ created by the process of playing a sound digitally. · 808 unmodified lines
907It tends to mask buzzing voices, for example.913It tends to mask buzzing voices, for example.
908It adds 1/2 bit of noise to the sound file at the914It adds 1/2 bit of noise to the sound file at the
909output bit depth.915output bit depth.
916.TP
917mcompand "\fIattack1,decay1\fR[,\fIattack2,decay2\fR...]
918.TP
919 \fIin-dB1,out-dB1\fR[,\fIin-dB2,out-dB2\fR...]
920.TP 10
921 [\fIgain\fR [\fIinitial-volume\fR [\fIdelay\fR ] ] ]" \fIxover_freq\fR
922
923Multi-band compander is similar to the single band compander but
924the audio file is first divided up into bands and then the compander
925is ran on each band. See the \fBcompand\fR effect for definition of its options. Compand options are specified between double quotes and the crossover frequency for that band is specefied seperately with \fIxover_fre\fR. This can be repeated multiple times to create multiple bands.
910.TP 10926.TP 10
911pan \fIdirection\fB927pan \fIdirection\fB
912Pan the sound of an audio file from one channel to another. This is done by928Pan the sound of an audio file from one channel to another. This is done by
sox.txt+28−11
@@ -54,6 +54,9 @@ SYNOPSIS · 53 unmodified lines
54 lowp frequency54 lowp frequency
55 lowpass frequency55 lowpass frequency
56 mask56 mask
57 mcompand "attack1,decay1[,attack2,decay2...]
58 in-dB1,out-dB1[,in-dB2,out-dB2...]
59 [ gain [ initial-volume [ delay ] ] ]" xover_freq
57 pan direction60 pan direction
58 phaser gain-in gain-out delay decay speed < -s | -t >61 phaser gain-in gain-out delay decay speed < -s | -t >
59 pick [ -1 | -2 | -3 | -4 | -l | -r | -f | -b ]62 pick [ -1 | -2 | -3 | -4 | -l | -r | -f | -b ]
@@ -192,9 +195,9 @@ OPTIONS · 132 unmodified lines
192 ADPCM, IMA_ADPCM, GSM, or Floating-point.195 ADPCM, IMA_ADPCM, GSM, or Floating-point.
193 U-law (actually shorthand for mu-law) and A-law are the U.S.196 U-law (actually shorthand for mu-law) and A-law are the U.S.
194 and international standards for logarithmic telephone sound197 and international standards for logarithmic telephone sound
195 compression. When uncompressed u-law has roughly the preci-198 compression. When uncompressed u-law has roughly the
196 sion of 14-bit PCM audio and A-law has roughly the precision199 precision of 14-bit PCM audio and A-law has roughly the pre-
197 of 13-bit PCM audio.200 cision of 13-bit PCM audio.
198 A-law and u-law data is sometimes encoded using a reversed201 A-law and u-law data is sometimes encoded using a reversed
199 bit-ordering (ie. MSB becomes LSB). Internally, SoX under-202 bit-ordering (ie. MSB becomes LSB). Internally, SoX under-
200 stands how to work with this encoding but there is currently203 stands how to work with this encoding but there is currently
@@ -605,11 +608,11 @@ EFFECTS · 404 unmodified lines
605 the fourth (optional) parameter is an initial volume to be608 the fourth (optional) parameter is an initial volume to be
606 assumed for each channel when the effect starts. This per-609 assumed for each channel when the effect starts. This per-
607 mits the user to supply a nominal level initially, so that,610 mits the user to supply a nominal level initially, so that,
608 for example, a very large gain is not applied to initial sig-611 for example, a very large gain is not applied to initial
609 nal levels before the companding action has begun to operate:612 signal levels before the companding action has begun to oper-
610 it is quite probable that in such an event, the output would613 ate: it is quite probable that in such an event, the output
611 be severely clipped while the compander gain properly adjusts614 would be severely clipped while the compander gain properly
612 itself.615 adjusts itself.
613 616
614 The fifth (optional) parameter is a delay in seconds. The617 The fifth (optional) parameter is a delay in seconds. The
615 input signal is analyzed immediately to control the compan-618 input signal is analyzed immediately to control the compan-
@@ -674,9 +677,9 @@ EFFECTS · 58 unmodified lines
674 stop-time is not specified.677 stop-time is not specified.
675 All times can be specified in either periods of time or sam-678 All times can be specified in either periods of time or sam-
676 ple counts. To specify time periods use the format679 ple counts. To specify time periods use the format
677 hh:mm:ss.frac format. To specify using sample counts, spec-680 hh:mm:ss.frac format. To specify using sample counts,
678 ify the number of samples and append the letter ’s’ to the681 specify the number of samples and append the letter ’s’ to
679 sample count (for example 8000s).682 the sample count (for example 8000s).
680 An optional type can be specified to change the type of enve-683 An optional type can be specified to change the type of enve-
681 lope. Choices are q for quarter of a sinewave, h for half a684 lope. Choices are q for quarter of a sinewave, h for half a
682 sinewave, t for linear slope, l for logarithmic, and p for685 sinewave, t for linear slope, l for logarithmic, and p for
@@ -734,6 +737,20 @@ EFFECTS · 51 unmodified lines
734 tends to mask buzzing voices, for example. It adds 1/2 bit737 tends to mask buzzing voices, for example. It adds 1/2 bit
735 of noise to the sound file at the output bit depth.738 of noise to the sound file at the output bit depth.
736 739
740 mcompand "attack1,decay1[,attack2,decay2...]
741
742 in-dB1,out-dB1[,in-dB2,out-dB2...]
743
744 [gain [initial-volume [delay ] ] ]" xover_freq
745
746 Multi-band compander is similar to the single band compander
747 but the audio file is first divided up into bands and then
748 the compander is ran on each band. See the compand effect
749 for definition of its options. Compand options are specified
750 between double quotes and the crossover frequency for that
751 band is specefied seperately with xover_fre. This can be
752 repeated multiple times to create multiple bands.
753
737 pan direction754 pan direction
738 Pan the sound of an audio file from one channel to another.755 Pan the sound of an audio file from one channel to another.
739 This is done by changing the volume of the input channels so756 This is done by changing the volume of the input channels so
src/Makefile.dos+1−1
@@ -22,7 +22,7 @@ FOBJ = 8svx.obj adpcm.obj aiff.obj alsa.obj au.obj auto.obj \ · 21 unmodified lines
22EOBJ = avg.obj band.obj bandpass.obj breject.obj btrworth.obj chorus.obj \22EOBJ = avg.obj band.obj bandpass.obj breject.obj btrworth.obj chorus.obj \
23 compand.obj copy.obj dcshift.obj deemphas.obj earwax.o \23 compand.obj copy.obj dcshift.obj deemphas.obj earwax.o \
24 echo.obj echos.obj fade.obj filter.obj flanger.obj highp.obj \24 echo.obj echos.obj fade.obj filter.obj flanger.obj highp.obj \
25 highpass.obj lowp.obj lowpass.obj mask.obj phaser.obj \25 highpass.obj lowp.obj lowpass.obj mask.obj mcompand.obj phaser.obj \
26 pitch.obj pan.obj polyphase.obj rate.obj repeat.obj resample.obj \26 pitch.obj pan.obj polyphase.obj rate.obj repeat.obj resample.obj \
27 reverb.obj reverse.obj silence.obj speed.obj stat.obj \27 reverb.obj reverse.obj silence.obj speed.obj stat.obj \
28 stretch.obj swap.obj synth.obj trim.obj vibro.obj vol.obj28 stretch.obj swap.obj synth.obj trim.obj vibro.obj vol.obj
src/Makefile.gcc+2−2
@@ -28,8 +28,8 @@ FOBJ = 8svx.o adpcm.o aiff.o alsa.o au.o auto.o avr.o cdr.o cvsd.o dat.o \ · 27 unmodified lines
28EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \28EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
29 copy.o dcshift.o deemphas.o earwax.o echo.o echos.o fade.o \29 copy.o dcshift.o deemphas.o earwax.o echo.o echos.o fade.o \
30 filter.o flanger.o highp.o highpass.o lowp.o lowpass.o \30 filter.o flanger.o highp.o highpass.o lowp.o lowpass.o \
31 mask.o pan.o phaser.o pitch.o polyphas.o rate.o repeat.o \31 mask.o mcompand.o pan.o phaser.o pitch.o polyphas.o rate.o \
32 resample.o reverb.o reverse.o silence.o speed.o \32 repeat.o resample.o reverb.o reverse.o silence.o speed.o \
33 stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o33 stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o
34 34
35SOUNDLIB = libst.a35SOUNDLIB = libst.a
src/Makefile.in+1−1
@@ -49,7 +49,7 @@ FOBJ = 8svx.o adpcm.o aiff.o au.o auto.o avr.o cdr.o \ · 48 unmodified lines
49EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \49EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
50 copy.o dcshift.o deemphas.o earwax.o echo.o echos.o \50 copy.o dcshift.o deemphas.o earwax.o echo.o echos.o \
51 fade.o filter.o flanger.o highp.o highpass.o lowp.o \51 fade.o filter.o flanger.o highp.o highpass.o lowp.o \
52 lowpass.o mask.o pan.o phaser.o pitch.o polyphas.o \52 lowpass.o mask.o mcompand.o pan.o phaser.o pitch.o polyphas.o \
53 rate.o repeat.o resample.o reverb.o reverse.o silence.o speed.o \53 rate.o repeat.o resample.o reverb.o reverse.o silence.o speed.o \
54 stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o54 stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o
55 55
src/handlers.c+3−0
@@ -465,6 +465,9 @@ st_effect_t st_effects[] = { · 464 unmodified lines
465 {"mask", ST_EFF_MCHAN,465 {"mask", ST_EFF_MCHAN,
466 st_mask_getopts, st_effect_nothing, st_mask_flow,466 st_mask_getopts, st_effect_nothing, st_mask_flow,
467 st_effect_nothing_drain, st_effect_nothing},467 st_effect_nothing_drain, st_effect_nothing},
468 {"mcompand", ST_EFF_MCHAN,
469 st_mcompand_getopts, st_mcompand_start, st_mcompand_flow,
470 st_mcompand_drain, st_mcompand_stop},
468 {"pan", ST_EFF_MCHAN | ST_EFF_CHAN,471 {"pan", ST_EFF_MCHAN | ST_EFF_CHAN,
469 st_pan_getopts, st_pan_start, st_pan_flow,472 st_pan_getopts, st_pan_start, st_pan_flow,
470 st_effect_nothing_drain, st_pan_stop},473 st_effect_nothing_drain, st_pan_stop},
src/play.in+1−1
@@ -72,7 +72,7 @@ formats, and effect options." · 71 unmodified lines
72# loop over arguments72# loop over arguments
73while [ $# -ne 0 ]; do73while [ $# -ne 0 ]; do
74 case "$1" in74 case "$1" in
75 avg|band|bandpass|bandreject|chorus|compand|copy|cut|deemph|earwax|echo|echos|fade|filter|flanger|highp|highpass|lowp|lowpass|map|mask|pan|phaser|pick|pitch|polyphase|rate|repeat|resample|reverb|reverse|silence|speed|split|stat|stretch|swap|trim|vibro|vol)75 avg|band|bandpass|bandreject|chorus|compand|copy|cut|deemph|earwax|echo|echos|fade|filter|flanger|highp|highpass|lowp|lowpass|map|mask|mcompand|pan|phaser|pick|pitch|polyphase|rate|repeat|resample|reverb|reverse|silence|speed|split|stat|stretch|swap|trim|vibro|vol)
76 effects="$@"76 effects="$@"
77 break77 break
78 ;;78 ;;
src/st_i.h+7−0
@@ -487,6 +487,13 @@ int st_mask_getopts(eff_t effp, int argc, char **argv); · 486 unmodified lines
487int st_mask_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,487int st_mask_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
488 st_size_t *isamp, st_size_t *osamp);488 st_size_t *isamp, st_size_t *osamp);
489 489
490int st_mcompand_getopts(eff_t effp, int argc, char **argv);
491int st_mcompand_start(eff_t effp);
492int st_mcompand_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
493 st_size_t *isamp, st_size_t *osamp);
494int st_mcompand_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
495int st_mcompand_stop(eff_t effp);
496
490int st_pan_getopts(eff_t effp, int argc, char **argv);497int st_pan_getopts(eff_t effp, int argc, char **argv);
491int st_pan_start(eff_t effp);498int st_pan_start(eff_t effp);
492int st_pan_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,499int st_pan_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t