Tuning the option attributes parameters
From BASS FX
Remarks
_MS options are not fully tested, use it
carefully as they may crash your application.
Tuning the option attributes parameters
The time-stretch algorithm has few parameters that can be tuned to optimize sound quality for certain application. The current default parameters have been chosen by iterative if-then analysis (read: "trial and error") to obtain best subjective sound quality in pop/rock music processing, but in applications processing different kind of sound the default parameter set may result into a sub-optimal result.
The default attribute parameter values are:
BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MS AUTOMATIC BASS_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MS AUTOMATIC BASS_ATTRIB_TEMPO_OPTION_OVERLAP_MS 8
These parameters affect to the time-stretch algorithm as follows:
- BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MS: This is the default
length of a single processing sequence in milliseconds which determines the
how the original sound is chopped in the time-stretch algorithm. Larger values
mean fewer sequences are used in processing. In principle a larger value
sounds better when slowing down the tempo, but worse when increasing the tempo
and vice versa.
- BASS_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MS: The seeking
window default length in milliseconds is for the algorithm that seeks the best
possible overlapping location. This determines from how wide a sample "window"
the algorithm can use to find an optimal mixing location when the sound
sequences are to be linked back together.
By default, this setting value is calculated automatically according to tempo value.
The bigger this window setting is, the higher the possibility to find a better mixing position becomes, but at the same time large values may cause a "drifting" sound artifact because neighboring sequences can be chosen at more uneven intervals. If there's a disturbing artifact that sounds as if a constant frequency was drifting around, try reducing this setting.
- BASS_ATTRIB_TEMPO_OPTION_OVERLAP_MS: Overlap length in
milliseconds. When the sound sequences are mixed back together to form again a
continuous sound stream, this parameter defines how much the ends of the
consecutive sequences will overlap with each other.
By default, this setting value is calculated automatically according to tempo value.
This shouldn't be that critical parameter. If you reduce the BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MS setting by a large amount, you might wish to try a smaller value on this.
The table below summarizes how the parameters can be adjusted for different applications:
| Parameter name | Default value magnitude | Larger value affects... | Smaller value affects... | Music | Speech | Effect in CPU burden |
SEQUENCE_MS |
Default value is relatively large, chosen for slowing down music tempo | Larger value is usually better for slowing down tempo. Growing the value decelerates the "echoing" artifact when slowing down the tempo. | Smaller value might be better for speeding up tempo. Reducing the value accelerates the "echoing" artifact when slowing down the tempo | Default value usually good | A smaller value than default might be better | Increasing the parameter value reduces computation burden |
SEEKWINDOW_MS |
Default value is relatively large, chosen for slowing down music tempo | Larger value eases finding a good mixing position, but may cause a "drifting" artifact | Smaller reduce possibility to find a good mixing position, but reduce the "drifting" artifact. | Default value usually good, unless a "drifting" artifact is disturbing. | Default value usually good | Increasing the parameter value increases computation burden |
OVERLAP_MS |
Default value is relatively large, chosen to suit with above parameters. | If you reduce the "sequence ms" setting, you might wish to try a smaller value. | Increasing the parameter value increases computation burden |
Performance Optimizations
General optimizations:
The time-stretch routine has a 'quick' mode that substantially speeds up the algorithm but may degrade the sound quality by a small amount. This mode is activated by BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO and value "TRUE", i.e.
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO, TRUE);
CPU-specific optimizations:
- Intel SSE/SSE2 optimized routines are used with compatible CPUs when floating point sample type is used. Processors compatible with SSE extension are Intel processors starting from Pentium-III, and AMD processors starting from Athlon XP.
See also
BASS_FX_TempoCreate, BASS_FX_TempoGetSource, BASS_FX_TempoGetRateRatio, Tempo
Attributes