Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get WAV file bit depth using PowerShell
# Create an empty Byte array, with a length of 1 byte
$Data = [System.Byte[]]::new(1)
# Open a FileStream to the specified file path
$Stream = [System.IO.File]::Open("$HOME/wav1.wav", [System.IO.FileMode]::Open)
# Seek to Byte 35
$null = $Stream.Seek(34, [System.IO.SeekOrigin]::Begin)
# Read a single byte, from the current position, into the specified Byte array
$null = $Stream.Read($Data, 0, 1)
# Close the FileStream
# Return the Byte array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment