Iextract information from audio file C#

602 views Asked by At

If I have an audio *WAV file or record and I want to extract this information from this audio by C# How I can do it? I want an easy way please Information I wanted to extract it

  • Number of Samples
  • Duration in seconds
  • Sampling rate in Hertz
  • Channels (Mono/Stereo)
  • PCM
  • Bit (8/16/24/32/64)
1

There are 1 answers

2
89f3a1c On

Here is the specification of the wav format header:

  • Sampling rate in Hertz: bytes 25-28 of header
  • Channels (Mono/Stereo): bytes 23/24 of header
  • PCM: bytes 21-22 of header
  • Bit depth (8/16/24/32/64): bytes 35-36 of header
  • Number of Samples and Duration in seconds: you can deduce it from other data in header.

To inspect this data, you could read the file as a binary stream and then interpret the stream accordingly. This question should guide you.