Click or drag to resize
AudioCompressionManagerCheckSilent Method
Checks the level of audio signal. If it is above silentLevel returns false otherwise it returns true.

Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax
public static bool CheckSilent(
	IntPtr format,
	byte[] data,
	short silentLevel
)

Parameters

format
Type: SystemIntPtr
audio format
data
Type: SystemByte
audio data
silentLevel
Type: SystemInt16
Can be in the range 0 .. short.MaxValue

Return Value

Type: Boolean

[Missing <returns> documentation for "M:Alvas.Audio.AudioCompressionManager.CheckSilent(System.IntPtr,System.Byte[],System.Int16)"]

Examples
This example shows simple using of CheckSilent method.
private static void SkipSilent(string fileName, short silentLevel)
{
    WaveReader wr = new WaveReader(File.OpenRead(fileName));
    IntPtr format = wr.ReadFormat();
    WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"), AudioCompressionManager.FormatBytes(format));
    int i = 0;
    while (true)
    {
        byte[] data = wr.ReadData(i, 1);
        if (data.Length == 0)
        {
            break;
        }
        if (!AudioCompressionManager.CheckSilent(format, data, silentLevel))
        {
            ww.WriteData(data);
        }
    }
    ww.Close();
    wr.Close();
}
See Also