scale utility scales the amplitude of sound files by constant factors, time-varying curves, or normalizes to a target level. It can also analyze and report the maximum possible scaling without clipping.
Syntax
Output options
| Option | Description |
|---|---|
-o <filename> | Output sound filename (default: test) |
-A | Create AIFF format output |
-W | Create WAV format output |
-J | Create IRCAM format output |
-h | No header (raw output) |
Output sample format
| Option | Description |
|---|---|
-c | 8-bit signed char |
-a | A-law encoded |
-u | μ-law encoded |
-s | 16-bit short int (default) |
-l | 32-bit long int |
-f | 32-bit float |
Scaling options
Choose one of these methods:| Option | Description |
|---|---|
-F <factor> | Fixed scale factor |
-F <filename> | Time-varying scale curve file |
-M <maximum> | Scale to given maximum amplitude |
-P <percent> | Scale to percentage of full scale |
Additional options
| Option | Description |
|---|---|
-R | Continuously rewrite header during writing |
-H <n> | Heartbeat: 1=spinner, 2=dots, 3=numeric |
-N | Ring bell when complete |
-- <file> | Log output to file |
Examples
Fixed amplitude scaling
Reduce by 6 dB (50%):Normalize to maximum level
Normalize to 100% full scale:Scale to percentage
Scale to 75% full scale:Find maximum possible scaling
Time-varying amplitude curve
envelope.txt containing:
sample_number scale_factor
This creates a fade in (0-1s) and fade out (5-6s) at 44.1kHz.
Scaling methods
Fixed factor (-F)
- Multiplies all samples by constant value
factor = 0.5reduces amplitude by 6 dBfactor = 2.0increases amplitude by 6 dB- Linear scaling:
output = input × factor
Maximum amplitude (-M)
- Analyzes peak level in input
- Calculates factor to reach target maximum
- Formula:
factor = target / current_peak - Preserves relative dynamics
Percentage (-P)
- Similar to
-Mbut specified as percentage -P 100= full scale (same as-M 1.0)-P 50= half scale (same as-M 0.5)-P 75= 75% of full scale (same as-M 0.75)
Time-varying curve (-F filename)
- Reads breakpoint file with sample/gain pairs
- Linear interpolation between breakpoints
- Allows complex amplitude envelopes
- Good for fades, dynamics, automation
Amplitude and decibels
Conversion between linear and dB:| Factor | dB | Effect |
|---|---|---|
| 0.1 | -20 dB | Very quiet |
| 0.25 | -12 dB | Quiet |
| 0.5 | -6 dB | Half amplitude |
| 0.707 | -3 dB | Half power |
| 1.0 | 0 dB | No change |
| 1.414 | +3 dB | Double power |
| 2.0 | +6 dB | Double amplitude |
| 4.0 | +12 dB | Loud |
| 10.0 | +20 dB | Very loud |
- dB to factor:
factor = 10^(dB/20) - Factor to dB:
dB = 20 × log10(factor)
Normalization strategies
Peak normalization
Most common, using-M or -P:
- Maximizes level without clipping
- Simple and predictable
- Preserves dynamics
- Peak may be isolated transient
- Average level may still be low
- Different perceived loudness across files
Conservative normalization
Leave headroom for safety:- Further processing planned
- Preventing inter-sample peaks
- Working with lossy codecs
Batch normalization
Normalize multiple files to same level:Creating scale curves
Manual curve creation
Linear fade in (0 to 1 over 2 seconds at 44.1kHz):Generated curves
Python script for exponential fade:Common use cases
Prepare for mastering
Match levels across files
Find peak levels:Add fade in/out
Create envelope filefade.txt:
Prevent clipping after mixing
Technical notes
Floating point accuracy
Use float output to avoid quantization:- No quantization noise
- Can exceed ±1.0 range
- Useful for intermediate processing
Clipping behavior
Integer formats clip at maximum value:- 16-bit: ±32767
- 24-bit: ±8388607
- 32-bit: ±2147483647