BASS.NET API for the Un4seen BASS Audio LibraryVisuals ClassBASS.NET API for the Un4seen BASS Audio Library
Provides general visualisation methods to generate spectrum analyzers etc.

Requires: bass.dll - available @ www.un4seen.com

Inheritance Hierarchy

SystemObject
  Un4seen.Bass.MiscVisuals

Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[SerializableAttribute]
public sealed class Visuals

The Visuals type exposes the following members.

Constructors

  NameDescription
Public methodVisuals
Default constructor. Simply create an instance and use it.
Top
Properties

  NameDescription
Public propertyChannelIsMixerSource
Gets or Sets, if the channel being used in one of the Create methods (e.g. CreateSpectrum(Int32, Int32, Int32, Color, Color, Color, Boolean, Boolean, Boolean)) is a buffered mixer source channel. (Default=).
Public propertyMaxFFT
Gets or Sets the number of FFT data to get (can be either BASS_DATA_FFT512, BASS_DATA_FFT1024, BASS_DATA_FFT2048, BASS_DATA_FFT4096 or BASS_DATA_FFT8192 (Default is 4096).
Public propertyMaxFFTData
Gets the number of FFT data used (see MaxFFT (Defaut is 4096).
Public propertyMaxFFTSampleIndex
Gets the maximum FFT data index which can be used (according to MaxFFT, default is 2047).
Public propertyMaxFrequencySpectrum
Gets or Sets the maximum number of samples to use when the fullSpectrum option is used (Default=2047 - all).

By default the full spectrum is drawn, which are 2047 samples. With this option you might limit this, since very high frequencies are often not much relevant for a visual display. You might use the FFTFrequency2Index(Int32, Int32, Int32) method with a length value of MaxFFTData here to calculate an index for a desired upper limit frequency. E.g. if you want to limit the full spectrum display to an upper limit of around 11843Hz with a stream having a sampling rate of 44100Hz you might set this value to 1100.

Public propertyScaleFactorLinear
Gets or Sets the scaling factor to apply when linear spectrum drawing is selected. (Default=9).
Public propertyScaleFactorLinearBoost
Gets or Sets the boost factor for higher frequencies to apply when linear spectrum drawing is selected. (Default=0.05).
Public propertyScaleFactorSqr
Gets or Sets the scaling factor to apply when non-linear spectrum drawing is selected to make low values more visible. (Default=4).
Public propertyScaleFactorSqrBoost
Gets or Sets the boost factor for higher frequencies to apply when non-linear spectrum drawing is selected. (Default=0.005).
Top
Methods

  NameDescription
Public methodClearPeaks
Clears all last peak values. This is needed, if you changed from one peak spectrum to another or if you change a channel, to make sure no old history data is present.
Public methodCreateSpectrum(Int32, Graphics, Rectangle, Color, Color, Color, Boolean, Boolean, Boolean)
Draws the spectrum graph directly on the provided GDI+ graphics.
Public methodCode exampleCreateSpectrum(Int32, Int32, Int32, Color, Color, Color, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum graph.
Public methodCreateSpectrum3DVoicePrint
Draws one line of a 3D voice print spectrum at the given position.

horizontal=time, vertical=frequency, color=amplitude

Public methodCreateSpectrumBean(Int32, Graphics, Rectangle, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Draws the spectrum dancing beans graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumBean(Int32, Int32, Int32, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum dancing beans graph.
Public methodCreateSpectrumDot(Int32, Graphics, Rectangle, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Draws the spectrum line graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumDot(Int32, Int32, Int32, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum dot graph.
Public methodCreateSpectrumEllipse(Int32, Graphics, Rectangle, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Draws the spectrum ellipse graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumEllipse(Int32, Int32, Int32, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum ellipse graph.
Public methodCreateSpectrumLine(Int32, Graphics, Rectangle, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Draws the spectrum line graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumLine(Int32, Int32, Int32, Color, Color, Color, Int32, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum line graph.
Public methodCreateSpectrumLinePeak(Int32, Graphics, Rectangle, Color, Color, Color, Color, Int32, Int32, Int32, Int32, Boolean, Boolean, Boolean)
Draws the spectrum line graph with peak hold directly on the provided GDI+ graphics.
Public methodCreateSpectrumLinePeak(Int32, Int32, Int32, Color, Color, Color, Color, Int32, Int32, Int32, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum line graph with peak hold.
Public methodCreateSpectrumText(Int32, Graphics, Rectangle, Color, Color, Color, String, Boolean, Boolean, Boolean)
Draws the spectrum dancing text graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumText(Int32, Int32, Int32, Color, Color, Color, String, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum dancing text graph.
Public methodCreateSpectrumWave(Int32, Graphics, Rectangle, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Draws the spectrum wave graph directly on the provided GDI+ graphics.
Public methodCreateSpectrumWave(Int32, Int32, Int32, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a FFT spectrum wave graph.
Public methodCreateWaveForm(Int32, Graphics, Rectangle, Color, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Draws the sample data wave form graph directly on the provided GDI+ graphics.
Public methodCreateWaveForm(Int32, Int32, Int32, Color, Color, Color, Color, Int32, Boolean, Boolean, Boolean)
Creates a bitmap representing a sample data wave form graph.
Public methodDetectFrequency
Gets the interpolated amplification value for a given frequency band.
Public methodDetectPeakFrequency
Returns the frequency (in Hz) containing the maximum energy within the current FFT data when calling this method.
Public methodCode exampleGetAmplitudeFromPosY
Returns the amplitude (power) as a float value which is represented by the given Y coordinate position of a visual control.
Public methodCode exampleGetFrequencyFromPosX
Returns the frequency in Hz represented by the given X coordinate position of a visual control.
Top
Remarks

The Visuals class is an internal implementation of the BASS.NET API and does not require any additional extension or add-on to the BASS audio library, meaning only bass.dll is required.

There is the need to create an instance of the class in order to use it!

Most create spectrum methods have two overloads. One which directly creates a bitmap image (e.g. to be used with a PictureBox) and one which receives a Graphics GDI+ object (e.g. to be used when you build your own custom components).

Take a look at the Simple.cs demo code for a list of all spectrum graphs available. All methods accept a long list of parameters to even customize each spectrum graph.

See Also

Reference