AFGETFRAMECOUNT(3)

πŸ’– AFGETFRAMECOUNT β€” bestie, let's get those numbers ✨

okay so this is the AFGETFRAMECOUNT(3) manual page, and she's here to give you three little functions that all do the same vibe: tell you the numbers about a track in your audio file. No cap. Let's go 🫢


✨ NAME ✨

afGetFrameCount, afGetTrackBytes, afGetDataOffset β€” get the total sample frame count, length of audio track in bytes, offset of the audio track for a track in an audio file πŸ’…


🌸 SYNOPSIS 🌸

#include <audiofile.h>

AFframecount afGetFrameCount (AFfilehandle file, int track);

AFfileoffset afGetTrackBytes (AFfilehandle file, int track);

AFfileoffset afGetDataOffset (AFfilehandle file, int track);

like. three functions. same args. different gifts 🎁


πŸŽ€ PARAMETERS πŸŽ€

  • file β€” it's an audio file handle, and it has to come from a previous call to afOpenFile(3). don't just manifest one out of thin air, bestie, it doesn't work like that 😭
  • track β€” an int that says which audio track inside file you're talking about. and here's the tea: all supported file formats contain exactly one audio track per file, so like… you should always just use the constant AF_DEFAULT_TRACK. that's it. that's the one. periodt πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

afGetFrameCount returns the total number of sample frames contained within the specified track of the specified file. iconic behaviour honestly.

and okay, what even is a sample frame, you ask? so each sample frame of audio consists of a fixed number of samples β€” and that number is equal to the number of audio channels in the track. for monaural data, a sample frame is just one audio sample. for stereophonic data, a sample frame is a whole stereo pair. it's giving duo. it's giving main character energy 🎧✨

afGetTrackBytes returns the total number of bytes of raw audio data in the track β€” and yes, raw means prior to decompression or conversion. so that's the un-glow-up'd version, the before picture πŸ’€

afGetDataOffset returns the offset in bytes of the start of the audio data contained within the specified track of the specified file. it's literally just "where does the audio start" energy πŸ“


🌈 RETURN VALUE 🌈

  • afGetFrameCount returns the total number of sample frames in track. πŸ”’
  • afGetTrackBytes returns the total number of bytes of audio data in track. πŸ“¦
  • afGetDataOffset returns the offset in bytes to the beginning of the audio data in track. 🧭
⚠️ and listen β€” each of these routines returns -1 in case of error. so if you see a -1, that's not a vibe. that's a red flag. check your handle, check your track, do a vibe check fr fr πŸ˜­πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Michael Pruett <michael@68k.org> β€” king behaviour, thank you for your service πŸ«‘πŸ’–


and that's the whole page bestie!! this was Audio File Library 0.3.6, dated 03/06/2013 πŸŽ€βœ¨ go forth and count your frames, you absolute icon πŸŒΈπŸ¦‹πŸ’…

πŸ“¦ where this page comes from