param([Parameter(Mandatory)][string]$CapturedPath,[Parameter(Mandatory)][string]$MatchDir,[Parameter(Mandatory)][string]$Prefix,[Parameter(Mandatory)][string]$OutputPath) $ErrorActionPreference='Stop' Add-Type -TypeDefinition @' using System; using System.IO; public static class CountPcmResidual { public static double Rms(string file,double start,double end) { byte[] bytes=File.ReadAllBytes(file);int rate=BitConverter.ToInt32(bytes,24); if(BitConverter.ToInt16(bytes,20)!=1||BitConverter.ToInt16(bytes,22)!=1||BitConverter.ToInt16(bytes,34)!=16||System.Text.Encoding.ASCII.GetString(bytes,36,4)!="data")throw new Exception("Canonical actual monoPCM16 required"); int a=Math.Max(0,(int)Math.Ceiling(start*rate)),b=Math.Min((bytes.Length-44)/2,(int)Math.Floor(end*rate)); if(b<=a)return 0;double sum=0;for(int i=a;i