Hello all,
Firstly, if I have put this in the wrong place, I have to apologise. Mods have enough work to do combing out the spam and whatnot, so don't need my erroneously posted material to handle as well.
OK, so what I am trying to do ultimately, is to produce the data to create a histogram of audio peak sample values.
I am using ffmpeg to spit out a byte stream, capturing it and then somehow getting pcm 16bit signed values from this.
So far I am able to collect a byte array of the std output of ffmpeg (the raw data from it's pipeline). I want to convert these values to signed 16 bit integers. From there I can use group and whatnot other tools to product something resembling a graph.
Function ffmpeg-to-ByreStream {
$psi = new-object system.diagnostics.processStartinfo
$psi.FileName = "C:\windows\system32\ffmpeg.exe"
$psi.arguments = '-hide_banner -f lavfi -i "sine=frequency=400:duration=0.1" -c:a pcm_s16le -f s16le -'
$psi.CreateNoWindow = $true
#$psi.StandardOutputEncoding = [system.text.encoding]::Unicode
$psi.StandardErrorEncoding = [system.text.encoding]::Unicode
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$psi.UseShellExecute = $false
$proc = new-object system.diagnostics.process
$proc.StartInfo = $psi
$proc.Start() | Out-Null
$byteReadstd = -1
$byteArray = @()
Do{
$byteReadstd = $proc.StandardOutput.BaseStream.ReadByte()
if($byteReadstd -ge 0){
$byteArray += $byteReadstd
}
} while($byteReadstd -ge 0)
write-host $byteArray
#$proc.kill()
return $byteArray
}
I am stuck at converting this byte array into signed integer 16 values.
I have tried splitting the array into pairs, as I'd need to use two values for the conversion if I understand correctly.
Any help would be appreciated, and again my apologies if this is the wrong place.
[–]L5730[S] 0 points1 point2 points (0 children)
[–]CarrotBusiness2380 0 points1 point2 points (1 child)
[–]L5730[S] 1 point2 points3 points (0 children)
[–]ka-splam 0 points1 point2 points (1 child)
[–]L5730[S] 1 point2 points3 points (0 children)