The SNES-style echo of one bus: a delay, feedback and an 8-tap FIR filter. More...
| Import Statement: | import Clayground.Sound |
Not created in QML; every bus has one, reached through SoundMixer (sfxEcho, musicEcho, voiceEcho). The bus mix is written into a delay line; the delayed signal runs through the FIR filter, whose output is added to the bus at volume and fed back into the line at feedback. A low-pass FIR darkens every repeat a little more than the one before.
The echo runs before the bus's reverb and before its volume. Turning it off drops its tail; turning it on again starts from silence. Its values belong to the process-wide engine.
import Clayground.Sound
Component.onCompleted: {
SoundMixer.musicEcho.delay = 120
SoundMixer.musicEcho.feedback = 0.5
SoundMixer.musicEcho.fir = [0.25, 0.25, 0.25, 0.25]
SoundMixer.musicEcho.enabled = true
}
Whether the echo runs. Default false: the bus sounds as without it.
Time from a sound to its first repeat in milliseconds, 1..1000, default 120.
Share of the filtered echo written back into the delay line, -1..1, default 0.5. With the default taps every repeat is this times the one before; a negative value flips the sign of every other repeat.
Level at which the filtered echo is added to the bus, 0..1, default 0.5.
The eight FIR coefficients, -1..1 each, tap 0 the newest sample. Default [1, 0, 0, 0, 0, 0, 0, 0], which passes the delayed signal unchanged. Fewer than eight values leave the remaining taps 0; more are refused with a warning. The taps are consecutive samples at the engine's rate. Taps that sum to more than 1 can make the repeats grow; the delay line clips, so they cannot run away.
See also SoundMixer and ReverbEffect.