Skip to content

Instantly share code, notes, and snippets.

@pcgeek86
Created February 6, 2020 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcgeek86/0e729d51502f8975745279d19fd8f092 to your computer and use it in GitHub Desktop.
Save pcgeek86/0e729d51502f8975745279d19fd8f092 to your computer and use it in GitHub Desktop.
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
$Stream.Close()
# Return the Byte array
$Data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment