0

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)
Jonas
  • 121,568
  • 97
  • 310
  • 388
  • 1
    Does this answer your question? [Accessing audio/video metadata with .NET](https://stackoverflow.com/questions/9091/accessing-audio-video-metadata-with-net) – DCCoder Aug 30 '20 at 19:41
  • There are many types of audio files, e.g. WAV, MP3, AAC etc. You probably need to be more specific about the file you are trying to decode. Have you googled 'xxx file format' where 'xxx' is the file extension you have? – DaveEP Aug 30 '20 at 21:12
  • the type of files which I need to extract is WAV – Abdullah Al-Sharif Aug 30 '20 at 21:25

1 Answers1

0

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.

89f3a1c
  • 1,430
  • 1
  • 14
  • 24