How to create and use an Equalizer |
|
Audio DJ Studio for .NET comes with an embedded equalizer which allows setting up a pool of equalizer bands; each equalizer band works on a different frequency and the current available range of frequencies is from 1 to 16000 Hz.
Each equalizer band is always identified by its frequency expressed in Hertz: it's not possible defining more than one band having the same frequency. Note that a band's frequency cannot exceed one-third of the frequency of the sound under editing so, if you have loaded a sound with a frequency of 44100 Hz, the maximum allowed band's frequency will be 14700 Hz (14700 * 3 = 44100); in order to reach a band's frequency of 16000 Hz, you must load sounds whose frequency is at least 48000 Hz.
The first step for creating an equalizer band and for adding it to the control's equalizer is to call the Effects.EqualizerBandAdd method. Each band can be removed at a later time using the EqualizerBandRemove method and its settings can be retrieved through the Effects.EqualizerBandParamsGet method and modified through the Effects.EqualizerBandGainSet and Effects.EqualizerBandParamsSet methods.
Existing bands can be enumerated using the Effects.EqualizerBandCountGet and Effects.EqualizerBandFrequencyGet methods.
Once the equalizer has been defined, there is the possibility to store its bands and their respective settings into a destination file through the Effects.EqualizerSaveToFile method and retrieved at a later time through the Effects.EqualizerLoadFromFile method. Equalizer settings are stored into a XML based file (usually with .EDJ extension) and has a structure like the sample below:
<?xml version="1.0" ?> <Equalizer> <Bands> <Band FreqInHz="80" BandWidth="12" GainIndB="-5.200000">0</Band> <Band FreqInHz="170" BandWidth="12" GainIndB="3.750000">1</Band> <Band FreqInHz="310" BandWidth="12" GainIndB="0.000000">2</Band> <Band FreqInHz="600" BandWidth="12" GainIndB="-4.500000">3</Band> <Band FreqInHz="1000" BandWidth="12" GainIndB="-3.000000">4</Band> <Band FreqInHz="3000" BandWidth="12" GainIndB="1.125000">5</Band> <Band FreqInHz="6000" BandWidth="12" GainIndB="5.250000">6</Band> <Band FreqInHz="12000" BandWidth="12" GainIndB="6.750000">7</Band> <Band FreqInHz="14000" BandWidth="12" GainIndB="-3.120000">8</Band> </Bands> </Equalizer>
As you can see each band has a progressive number (in the case above from 0 to 8) and is identified by the frequency stored inside the FreqInHz attribute (expressed in Hertz) while its parameters are defined inside the BandWidth (expressed in semi-tones) and GainIndB (expressed in dB) attributes. EDJ format is also used by our Audio Sound Editor API for .NET component.
A further feature for setting up the equalizer is to load bands containing presets as defined by WinAmp™ using the Effects.EqualizerLoadPresets method.
The equalizer can be enabled or disabled, without changing parameters of various bands, through the Effects.EqualizerEnable method and the gain of available bands can be reset to 0 dB using the Effects.EqualizerReset method.
Existing equalizer's settings can be saved inside a memory stream, in the same XML format as seen for the .edj files, through the Effects.EqualizerSaveToMemoryStream method and retrieved at a later time through the Effects.EqualizerLoadFromMemoryStream method.
Audio DJ Studio for .NET supports automatic equalization of loaded sound files: for each sound file you have the possibility to create a specific EDJ file containing optimal equalization settings for the sound file to load; automatic equalization can be enabled through the EnableAutoEqualiz property and obtained by adding a .EDJ sound inside the same folder containing the loaded sound: if for example the loaded file should be named MySong.mp3, the corresponding EDJ file should be named MySong.mp3.edj : when the control will find this specific file inside the same folder of the loaded sound it will automatically create and apply the requested bands of the equalizer and will also invoke the CallbackForPlayersEvents delegate with the nEvent parameter set to EV_EQUALIZER_LOADED.
The creation and use of equalizer bands requires DirectX version 8 or higher to be installed on the target system: you can verify the availability of this DirectX version calling the IsDirectX8Avail method.
Samples of use of Equalizers in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package: - TestEqualizer - TestPlayers - TestVideoPlayer - SpecialEffects
|