Next revision | Previous revision |
1.0.0:fmodaudio [2023/02/22 14:57] – created - external edit 127.0.0.1 | 1.0.0:fmodaudio [2023/03/08 12:08] (current) – [Apply a DSP effect to a channel] admin |
---|
end; | end; |
</file> | </file> |
| |
| |
| ==== Apply a DSP effect to a channel ==== |
| |
| FMOD offers a large number of sound effects, f.e. echo, oscillator, distortion, ... |
| |
| <code> |
| FMOD_DSP_TYPE = ( |
| FMOD_DSP_TYPE_UNKNOWN, { This unit was created via a non FMOD plugin so has an unknown purpose. } |
| FMOD_DSP_TYPE_MIXER, { This unit does nothing but take inputs and mix them together then feed the result to the soundcard unit. } |
| FMOD_DSP_TYPE_OSCILLATOR, { This unit generates sine/square/saw/triangle or noise tones. } |
| FMOD_DSP_TYPE_LOWPASS, { This unit filters sound using a high quality, resonant lowpass filter algorithm but consumes more CPU time. Deprecated and will be removed in a future release (see FMOD_DSP_LOWPASS remarks for alternatives). } |
| FMOD_DSP_TYPE_ITLOWPASS, { This unit filters sound using a resonant lowpass filter algorithm that is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz). } |
| FMOD_DSP_TYPE_HIGHPASS, { This unit filters sound using a resonant highpass filter algorithm. Deprecated and will be removed in a future release (see FMOD_DSP_HIGHPASS remarks for alternatives). } |
| FMOD_DSP_TYPE_ECHO, { This unit produces an echo on the sound and fades out at the desired rate. } |
| FMOD_DSP_TYPE_FADER, { This unit pans and scales the volume of a unit. } |
| FMOD_DSP_TYPE_FLANGE, { This unit produces a flange effect on the sound. } |
| FMOD_DSP_TYPE_DISTORTION, { This unit distorts the sound. } |
| FMOD_DSP_TYPE_NORMALIZE, { This unit normalizes or amplifies the sound to a certain level. } |
| FMOD_DSP_TYPE_LIMITER, { This unit limits the sound to a certain level. } |
| FMOD_DSP_TYPE_PARAMEQ, { This unit attenuates or amplifies a selected frequency range. Deprecated and will be removed in a future release (see FMOD_DSP_PARAMEQ remarks for alternatives). } |
| FMOD_DSP_TYPE_PITCHSHIFT, { This unit bends the pitch of a sound without changing the speed of playback. } |
| FMOD_DSP_TYPE_CHORUS, { This unit produces a chorus effect on the sound. } |
| FMOD_DSP_TYPE_VSTPLUGIN, { This unit allows the use of Steinberg VST plugins } |
| FMOD_DSP_TYPE_WINAMPPLUGIN, { This unit allows the use of Nullsoft Winamp plugins } |
| FMOD_DSP_TYPE_ITECHO, { This unit produces an echo on the sound and fades out at the desired rate as is used in Impulse Tracker. } |
| FMOD_DSP_TYPE_COMPRESSOR, { This unit implements dynamic compression (linked/unlinked multichannel, wideband) } |
| FMOD_DSP_TYPE_SFXREVERB, { This unit implements SFX reverb } |
| FMOD_DSP_TYPE_LOWPASS_SIMPLE, { This unit filters sound using a simple lowpass with no resonance, but has flexible cutoff and is fast. Deprecated and will be removed in a future release (see FMOD_DSP_LOWPASS_SIMPLE remarks for alternatives). } |
| FMOD_DSP_TYPE_DELAY, { This unit produces different delays on individual channels of the sound. } |
| FMOD_DSP_TYPE_TREMOLO, { This unit produces a tremolo / chopper effect on the sound. } |
| FMOD_DSP_TYPE_LADSPAPLUGIN, { Unsupported / Deprecated. } |
| FMOD_DSP_TYPE_SEND, { This unit sends a copy of the signal to a return DSP anywhere in the DSP tree. } |
| FMOD_DSP_TYPE_RETURN, { This unit receives signals from a number of send DSPs. } |
| FMOD_DSP_TYPE_HIGHPASS_SIMPLE, { This unit filters sound using a simple highpass with no resonance, but has flexible cutoff and is fast. Deprecated and will be removed in a future release (see FMOD_DSP_HIGHPASS_SIMPLE remarks for alternatives). } |
| FMOD_DSP_TYPE_PAN, { This unit pans the signal, possibly upmixing or downmixing as well. } |
| FMOD_DSP_TYPE_THREE_EQ, { This unit is a three-band equalizer. } |
| FMOD_DSP_TYPE_FFT, { This unit simply analyzes the signal and provides spectrum information back through getParameter. } |
| FMOD_DSP_TYPE_LOUDNESS_METER, { This unit analyzes the loudness and true peak of the signal. } |
| FMOD_DSP_TYPE_ENVELOPEFOLLOWER, { This unit tracks the envelope of the input/sidechain signal. Deprecated and will be removed in a future release. } |
| FMOD_DSP_TYPE_CONVOLUTIONREVERB, { This unit implements convolution reverb. } |
| FMOD_DSP_TYPE_CHANNELMIX, { This unit provides per signal channel gain, and output channel mapping to allow 1 multichannel signal made up of many groups of signals to map to a single output signal. } |
| FMOD_DSP_TYPE_TRANSCEIVER, { This unit 'sends' and 'receives' from a selection of up to 32 different slots. It is like a send/return but it uses global slots rather than returns as the destination. It also has other features. Multiple transceivers can receive from a single channel, or multiple transceivers can send to a single channel, or a combination of both. } |
| FMOD_DSP_TYPE_OBJECTPAN, { This unit sends the signal to a 3d object encoder like Dolby Atmos. Supports a subset of the FMOD_DSP_TYPE_PAN parameters. } |
| FMOD_DSP_TYPE_MULTIBAND_EQ, { This unit is a flexible five band parametric equalizer. } |
| |
| FMOD_DSP_TYPE_MAX, { Maximum number of pre-defined DSP types. } |
| FMOD_DSP_TYPE_FORCEINT = 65536 { Makes sure this enum is signed 32bit. } |
| ); |
| </code> |
| |
| You can attach an effect easily onto a channel, but not directly to a sound instance. |
| |
| |
| <file pascal> |
| uses |
| Gorilla.Audio.FMOD, |
| Gorilla.Audio.FMOD.Custom, |
| Gorilla.Audio.FMOD.Lib.DSP.Effects, |
| Gorilla.Audio.FMOD.Intf.Channel, |
| Gorilla.Audio.FMOD.Intf.DSP; |
| |
| [..] |
| |
| /// CAUTION: For applying multiple effects, the AIndex argument has to start at zero and needs |
| /// to increase continously without gaps! |
| procedure TForm1.AttachEffect(AChannel : IGorillaFMODChannel; AIndex : Integer; AEffect : TFMOD_DSPType); |
| var LDSPEffect : IGorillaFMODDSP; |
| LWetDryMix : TGorillaFMODWetDryMix; |
| begin |
| // Access the system object of FMOD API |
| LDSPEffect := GorillaFMODAudioManager1.SystemObject.CreateDSPByType(AEffect); |
| |
| // Activate the effect |
| LDSPEffect.Active := true; |
| |
| // Setup the wet-dry mix record |
| LWetDryMix.PreWet := 0.75; |
| LWetDryMix.PostWet := 0.75; |
| LWetDryMix.Dry := 0.25; |
| |
| // Apply it to the dsp effect |
| LDSPEffect.WetDryMix := LWetDryMix; |
| |
| // Finally attach the dsp effect to our channel, where we play a sound |
| AChannel.AddDSP(AIndex, LDSPEffect); |
| end; |
| |
| [...] |
| |
| // Let's add some kind of echo |
| AttachEffect(FChannel, 0, FMOD_DSP_TYPE_ECHO); |
| </file> |
===== Android ===== | ===== Android ===== |
| |