Sound(3)

πŸ“¦ version 1.9.5, in fedora 43, fedora 44

✨ Sound(3) ✨

okay bestie, so this is Sound(3) from the Library Functions Manual β€” aka the glow-up guide to describing an audio file πŸ’– it's giving "struct that knows everything about your sound file" and honestly? iconic.


🌸 Name 🌸

Sound β€” audio file description. that's it, that's the vibe πŸŽ€


πŸ¦‹ Structures πŸ¦‹

first things first, you gotta pull in the headers, no cap:

#include <audio/audiolib.h>
#include <audio/sound.h>

and then boom, the struct itself:

typedef struct
{
    . . .
}SoundRec, *Sound;

so SoundRec is the actual struct, and Sound is a pointer to one. yes it's a typedef, yes it's cute, moving on πŸ’…


πŸ‘‘ Members πŸ‘‘

⚠️ Do not dereference the members of the SoundRec structure directly. Instead use the access macros.

like, literally do not. the macros are RIGHT THERE. they're the main characters. use them 🫢

throughout all of these, sound is a Sound, aka a pointer to a SoundRec structure. got it? good.

  • SoundFileFormat(sound) β€” gets you the int value that tells you the format of the sound file.
  • SoundFileFormatString(sound) β€” gets you the string description of that same file format. words instead of numbers, slay.
  • SoundDataFormat(sound) β€” gets you the int value for the data format of the sound file.
  • SoundDataFormatString(sound) β€” gets you the string description of the data format. yes, again, the string version. consistency queen.
  • SoundNumTracks(sound) β€” gets you the int value for how many tracks are chillin' in the audio data of the sound file.
  • SoundSampleRate(sound) β€” gets you the int value for the sample rate of the audio data in the sound file.
  • SoundNumSamples(sound) β€” gets you the int value for the total number of samples. all of them. every last one.
  • SoundComment(sound) β€” gets you the string comment. the lil note. the annotation. πŸ’œ
  • SoundBytesPerSample(sound) β€” returns the bytes per sample of audio data.
  • SoundNumBytes(sound) β€” returns the total number of bytes of audio data in the sound file. the whole thing.
  • SoundValidateDataFormat(sound) β€” returns true if the sound file format is a valid format. it's the vibe check, basically βœ…

🌈 Description 🌈

The SoundRec structure describes an audio file. periodt. that's the whole job description and it does it beautifully ✨


πŸ’– See Also πŸ’–

go read these next, bestie, they're the whole friend group:

  • SoundCloseFile
  • SoundCreate
  • SoundFlushFile
  • SoundOpenFileForReading
  • SoundOpenFileWriting
  • SoundReadFile
  • SoundRewindFile
  • SoundSeekFile
  • SoundTellFile
  • SoundWriteFile

and also:

  • audiolib β€” Network Audio System C Language Interface πŸŽ€

and that's the whole page, babe πŸ’… this was sound, version 1.9.5, from the Sound(3) manual. go forth and describe your audio files. i'm obsessed with you. mwah 🫢✨

πŸ“¦ where this page comes from