wav.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * wav.h
  3. *
  4. * Copyright (C) 2023 bzt
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * @brief Wav format
  21. *
  22. */
  23. /* riff wave header */
  24. typedef struct {
  25. char str_riff[4]; /* "RIFF" */
  26. int wav_size; /* (file size) - 8 */
  27. char str_wave[4]; /* "WAVE" */
  28. /* Format Header */
  29. char str_fmt[4]; /* "fmt " */
  30. int fmt_chunk_size; /* Should be 16 for PCM */
  31. short audio_format; /* Should be 1 for PCM. 3 for IEEE Float */
  32. short channels; /* number of channels */
  33. int sample_rate; /* eg: 8000, 44100, 48000 */
  34. int byte_rate; /* Number of bytes per second. sample_rate * channels * Bytes Per Sample */
  35. short frame_size; /* channels * Bytes Per Sample */
  36. short bit_depth; /* bits per sample, eg: 8, 16, 24 */
  37. /* Data chunk */
  38. char str_data[4]; /* "data" */
  39. int data_bytes; /* (file size) - 44 */
  40. } wav_header_t;