Class BaseSonogram
Assembly: AudioAnalysisTools.dll
public abstract class BaseSonogram
Constructors
|
Improve this Doc
View Source
Initializes a new instance of the BaseSonogram class.
BASE CONSTRUCTOR: Use this when want to extract time segment of existing sonogram.
Declaration
public BaseSonogram(SonogramConfig config)
Parameters
|
Improve this Doc
View Source
Initializes a new instance of the BaseSonogram class.
BASE CONSTRUCTOR.
Declaration
public BaseSonogram(SonogramConfig config, WavReader wav)
Parameters
|
Improve this Doc
View Source
Initializes a new instance of the BaseSonogram class.
BASE CONSTRUCTOR.
Declaration
public BaseSonogram(SonogramConfig config, FrequencyScale freqScale, WavReader wav)
Parameters
|
Improve this Doc
View Source
Initializes a new instance of the BaseSonogram class.
Use this BASE CONSTRUCTOR when already have the amplitude spectrogram in matrix.
Init normalised signal energy array but do nothing with it. This has to be done from outside.
Declaration
public BaseSonogram(SonogramConfig config, double[, ] amplitudeSpectrogramData)
Parameters
Type |
Name |
Description |
SonogramConfig |
config |
the spectrogram config.
|
Double[,] |
amplitudeSpectrogramData |
data of an amplitude Spectrogram.
|
Properties
|
Improve this Doc
View Source
Gets or sets the config information.
The Configuration object should contain all the parameters required to construct an amplitude spectrogram given a recording.
Declaration
public SonogramConfig Configuration { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets the spectrogram data matrix of doubles.
Declaration
public double[, ] Data { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets decibel reference with which to NormaliseMatrixValues the dB values for MFCCs.
Declaration
public double DecibelReference { get; protected set; }
Property Value
|
Improve this Doc
View Source
Gets or sets the array of frame log-energy values normalised 0,1.
This is derived from the array variable DecibelsPerFrame[].
Declaration
public double[] DecibelsNormalised { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets decibels per signal frame. i.e. log frame energy.
Declaration
public double[] DecibelsPerFrame { get; set; }
Property Value
|
Improve this Doc
View Source
Declaration
public TimeSpan Duration { get; protected set; }
Property Value
|
Improve this Doc
View Source
Declaration
public double FBinWidth { get; }
Property Value
|
Improve this Doc
View Source
Declaration
public int FrameCount { get; protected set; }
Property Value
|
Improve this Doc
View Source
Declaration
public double FrameDuration { get; }
Property Value
|
Improve this Doc
View Source
Declaration
public double FramesPerSecond { get; }
Property Value
|
Improve this Doc
View Source
Declaration
public double FrameStep { get; }
Property Value
|
Improve this Doc
View Source
Gets or sets the frequency scale information.
The FreqScale object should contain all the parameters required to convert the linear frquency scale of the amplitude spectrogram
into any reduced or non-linear frequency scale required.
Declaration
public FrequencyScale FreqScale { get; set; }
Property Value
|
Improve this Doc
View Source
Declaration
public double MaxAmplitude { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets the Noise profile in decibels.
Declaration
public double[] ModalNoiseProfile { get; set; }
Property Value
|
Improve this Doc
View Source
Declaration
public int NyquistFrequency { get; }
Property Value
|
Improve this Doc
View Source
Declaration
public int SampleRate { get; set; }
Property Value
|
Improve this Doc
View Source
Gets or sets integer coded signal state ie 0=non-vocalisation, 1=vocalisation, etc.
Declaration
public int[] SigState { get; protected set; }
Property Value
|
Improve this Doc
View Source
Gets or sets instance of class SNR that stores info about signal energy and dB per frame.
Declaration
public SNR SnrData { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
converts the dB data in sonogram.Data to grey scale image of spectrogram.
Declaration
public static Tuple<double[, ], double, double> Data2ImageData(double[, ] matrix)
Parameters
Type |
Name |
Description |
Double[,] |
matrix |
matrix of sonogram values.
|
Returns
|
Improve this Doc
View Source
Declaration
public static Image<Rgb24> DrawTitleBarOfGrayScaleSpectrogram(string title, int width, Color? tag = default(Color? ))
Parameters
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
This method draws only top and bottom time scales and adds the title bar.
It does NOT include the frequency grid lines.
Declaration
public static Image<Rgb24> FrameSonogram(Image<Rgb24> sonogramImage, Image<Rgb24> titleBar, TimeSpan minuteOffset, TimeSpan xAxisTicInterval, TimeSpan xAxisPixelDuration, TimeSpan labelInterval)
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
sonogramImage |
|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
titleBar |
|
TimeSpan |
minuteOffset |
|
TimeSpan |
xAxisTicInterval |
|
TimeSpan |
xAxisPixelDuration |
|
TimeSpan |
labelInterval |
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
This method assumes that the height of the passed sonogram image is half of the original frame size.
This assumption allows the frequency scale grid lines to be placed at the correct intervals.
Declaration
public static Image<Rgb24> FrameSonogram(Image<Rgb24> sonogramImage, Image<Rgb24> titleBar, TimeSpan minuteOffset, TimeSpan xAxisTicInterval, TimeSpan xAxisPixelDuration, TimeSpan labelInterval, int nyquist, int hertzInterval)
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
sonogramImage |
|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
titleBar |
|
TimeSpan |
minuteOffset |
|
TimeSpan |
xAxisTicInterval |
|
TimeSpan |
xAxisPixelDuration |
|
TimeSpan |
labelInterval |
|
Int32 |
nyquist |
|
Int32 |
hertzInterval |
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Declaration
public static double[] GetAvSpectrum_HighestPercentile(double[, ] matrix, int highPercentile)
Parameters
Type |
Name |
Description |
Double[,] |
matrix |
|
Int32 |
highPercentile |
|
Returns
|
Improve this Doc
View Source
Declaration
public static double[] GetAvSpectrum_LowestPercentile(double[, ] matrix, int lowPercentile)
Parameters
Type |
Name |
Description |
Double[,] |
matrix |
|
Int32 |
lowPercentile |
|
Returns
|
Improve this Doc
View Source
Declaration
public Image<Rgb24> GetImage()
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Declaration
public Image<Rgb24> GetImage(bool doHighlightSubband, bool add1KHzLines, bool doMelScale)
Parameters
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Draws Frame around image of spectrogram.
Declaration
public static Image<Rgb24> GetImageAnnotatedWithLinearHertzScale(Image<Rgb24> image, int sampleRate, int frameStep, string title, Color? tag = default(Color? ))
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
image |
Image of Spectrogram.
|
Int32 |
sampleRate |
sample rate of recording. Necessary for both time scale and Hertz scale.
|
Int32 |
frameStep |
frame step allows correct time scale to be drawn.
|
String |
title |
Descriptive title of the spectrogram.
|
Nullable<SixLabors.ImageSharp.Color> |
tag |
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
The framed spectrogram image.
|
|
Improve this Doc
View Source
Declaration
public Image<Rgb24> GetImageAnnotatedWithLinearHerzScale(Image<Rgb24> image, string title, Color? tag = default(Color? ))
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
image |
|
String |
title |
|
Nullable<SixLabors.ImageSharp.Color> |
tag |
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
This method fully annotates a short-time scale spectrogram.
The grid-lines are drawn according to indices in gridLineLocations.
Therefore the method will accept spectrograms with octave or any frequency scale.
The time scale is calculated from recording duration and width of image.
Declaration
public Image<Rgb24> GetImageFullyAnnotated(Image<Rgb24> image, string title, int[, ] gridLineLocations, Color? tag = default(Color? ))
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
image |
The raw spectrogram image.
|
String |
title |
To go on the title bar.
|
Int32[,] |
gridLineLocations |
A matrix of values.
|
Nullable<SixLabors.ImageSharp.Color> |
tag |
Used to identify images??.
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
The annotated spectrogram.
|
|
Improve this Doc
View Source
This method assumes that the spectrogram has linear Herz scale.
Declaration
public Image<Rgb24> GetImageFullyAnnotated(string title, Color? tag = default(Color? ))
Parameters
Type |
Name |
Description |
String |
title |
title to be added to spectrogram.
|
Nullable<SixLabors.ImageSharp.Color> |
tag |
|
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Returns an image of the data matrix.
Normalises the values from min->max according to passed rank values.
Therefore pixels in the normalised grey-scale image will range from 0 to 255.
Declaration
public static Image<Rgb24> GetSonogramImage(double[, ] data, int minPercentile, int maxPercentile)
Parameters
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Declaration
public static Image<Rgb24> GetSonogramImage(double[, ] data, int nyquistFreq, int maxFrequency, bool doMelScale, int binHeight, bool doHighlightSubband, int subBandMinHz, int subBandMaxHz)
Parameters
Returns
Type |
Description |
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
|
|
Improve this Doc
View Source
Declaration
public abstract void Make(double[, ] amplitudeM)
Parameters
Type |
Name |
Description |
Double[,] |
amplitudeM |
|
|
Improve this Doc
View Source
Declaration
public static double[, ] RescaleLinearFrequencyScale(double[, ] inputSpgram, FrequencyScale freqScale)
Parameters
Returns
|
Improve this Doc
View Source
This method is called by unit tests that want to draw simple spectorgram images.
It can be modified to do something non-standard with the output spectrogram.
Declaration
public static string SaveDebugSpectrogram(Image image, DirectoryInfo outputDirectory, string baseName)
Parameters
Type |
Name |
Description |
SixLabors.ImageSharp.Image |
image |
|
DirectoryInfo |
outputDirectory |
|
String |
baseName |
|
Returns
Extension Methods