AFINITSAMPLEFORMAT(3)
π afInitSampleFormat(3) π
welcome to the AFINITSAMPLEFORMAT(3) era bestie, where we set up how your audio data is gonna look before the file even exists. it's giving "getting ready" energy. π
β¨ NAME β¨
afInitSampleFormat, afInitByteOrder, afInitChannels, afInitRate β these four besties initialize the audio data format for a track inside an audio file setup. think of it as picking out the outfit before the main character (the file) walks in. π
π¦ SYNOPSIS π¦
#include <audiofile.h>
void afInitSampleFormat(AFfilesetup setup, int track, int sampleFormat,
int sampleWidth);
void afInitByteOrder(AFfilesetup setup, int track, int byteOrder);
void afInitChannels(AFfilesetup setup, int track, int channels);
void afInitRate(AFfilesetup setup, int track, double rate);
no cap, that's the whole vibe right there. β¨
πΈ PARAMETERS πΈ
okay so here's who's who in this friend group:
setupβ a valid file setup that you got back fromafNewFileSetup(3). if it's not valid, we're gonna have a problem. π«Άtrackβ picks which track inside the audio file setup you're talking about. and listen:trackis alwaysAF_DEFAULT_TRACKfor all currently supported file formats. every single one. so yeah. πsampleFormatβ a symbolic constant that says what the sample format of the audio data in the track is gonna be. it must be one ofAF_SAMPFMT_TWOSCOMP,AF_SAMPFMT_UNSIGNED,AF_SAMPFMT_FLOAT, orAF_SAMPFMT_DOUBLE. those are the only options, periodt. πsampleWidthβ a positive integer, bestie. it's the number of bits for each sample in the track. πbyteOrderβ a symbolic constant for the byte order of the track. must be one ofAF_BYTEORDER_BIGENDIANorAF_BYTEORDER_LITTLEENDIAN. pick a side. πchannelsβ a positive integer saying how many channels the track has. (positive!! not zero, not negative, we're not doing that today.) π₯rateβ a positive double-precision floating-point number for the sample rate of the track. yes it's adouble. yes it's positive. slay. β
π DESCRIPTION π
short and sweet, one for each function, iykyk:
afInitSampleFormatβ initializes the track to the sample format and sample width you specified. ποΈafInitByteOrderβ initializes the track to the byte order you specified. πafInitChannelsβ initializes the track to the number of channels you specified. π§afInitRateβ initializes the track to the sample rate you specified. β±οΈ
that's it. that's the whole job. they init, you vibe. π
π ERRORS π
not every day is a good day, so here's what can go wrong. afInitSampleFormat, afInitByteOrder, afInitChannels, and afInitRate can all produce these:
AF_BAD_FILESETUPβsetuprepresents an invalid file setup. πAF_BAD_TRACKβtrackrepresents an invalid track identifier. π
and then each one has its own lil extra way to fail, because why not:
afInitSampleFormat can also produce the following errors:
AF_BAD_SAMPFMTβsampleFormatdoes not represent a valid sample format. π«AF_BAD_WIDTHβsampleWidthis not a valid sample width. π
afInitByteOrder can also produce the following error:
AF_BAD_BYTEORDERβbyteOrderdoes not represent a valid byte order. π
afInitChannels can also produce the following error:
AF_BAD_CHANNELSβchannelsspecifies an invalid number of channels. π
afInitRate can also produce the following error:
AF_BAD_RATEβratespecifies an invalid sample rate. π
fr fr, check your arguments before you call these. the library will tell you, and it will not be subtle about it. π
π SEE ALSO π
go read these next, bestie, they're the rest of the lore:
π AUTHOR π
Michael Pruett <michael@68k.org> β the icon who wrote this. we love him. π
and that's the page!! this manual page came to you courtesy of Audio File Library 0.3.6, dated 03/06/2013. yes, it's been iconic for a minute. π«Άβ¨π
π¦ where this page comes from
- alpine 3.24: audiofile-doc 0.3.6-r3 Β· LGPL-2.1-or-later
- arch rolling: audiofile 0.3.6-12 Β· Apache-2.0 AND GPL-2.0-or-later AND LGPL-2.1-or-later
- debian bookworm: libaudiofile-dev 0.3.6-5+deb12u1 Β· LGPL-2.1-or-later
- debian trixie: libaudiofile-dev 0.3.6-7+b1 Β· LGPL-2.1-or-later
- epel 10: audiofile-devel 1:0.3.6-44.el10_2 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- epel 9: audiofile-devel 1:0.3.6-36.el9 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 43: audiofile-devel 1:0.3.6-42.fc43 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 43: audiofile-devel 1:0.3.6-42.fc43 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 44: audiofile-devel 1:0.3.6-44.fc44 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 44: audiofile-devel 1:0.3.6-44.fc44 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- nixpkgs unstable: audiofile 0.3.6
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: libaudiofile-dev 0.3.6-5+deb10u1build0.22.04.1 Β· LGPL-2.1-or-later
- ubuntu jammy: libaudiofile-dev 0.3.6-5build1 Β· LGPL-2.1-or-later
- ubuntu noble: libaudiofile-dev 0.3.6-6build2 Β· LGPL-2.1-or-later
- ubuntu questing: libaudiofile-dev 0.3.6-7build1
- ubuntu resolute: libaudiofile-dev 0.3.6-7build2 Β· LGPL-2.1-or-later
- ubuntu stonking: libaudiofile-dev 0.3.6-7build2 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms