SoundCreate(3)

✨ SoundCreate β€” create a description of an audio file ✨

okay bestie, we're in section 3 of the Library Functions Manual today, and the star of the show is SoundCreate. it's giving audio-library-core πŸ’– let's get into it.


🌸 Name

SoundCreate β€” create a description of an audio file.

like, it doesn't make the file, it doesn't play the file, it just describes it. it's the vibe board for your audio, fr fr.


πŸŽ€ Synopsis

#include <audio/audiolib.h>

Sound SoundCreate(file_format, data_format, num_tracks, sample_rate,
num_samples, comment)
    int file_format;
    int data_format;
    int num_tracks;
    int sample_rate;
    int num_samples;
    char *comment;

look at all those parameters. she's high maintenance but she's worth it πŸ’…


πŸ¦‹ Arguments

  • file_format β€” the format of the audio file. rn the supported glow-ups are: SoundFileFormatSnd, SoundFileFormatVoc, SoundFileFormatWave, SoundFileFormatAiff, and SoundFileFormatSvx. that's the whole list, no secret extra options hiding in the back 🫢
  • data_format β€” the format of the actual audio data (different from the file format, bestie, don't mix them up 😭). the ones currently defined are: AuFormatULAW8, AuFormatLinearUnsigned8, AuFormatLinearSigned8, AuFormatLinearSigned16MSB, AuFormatLinearUnsigned16MSB, AuFormatSignedLinear16LSB, and AuFormatLinearUnsigned16LSB. yes that's seven. yes you have to pick one. slay.
  • num_tracks β€” how many tracks are in the audio data. ✨
  • sample_rate β€” the sample rate of the audio data. the hertz of it all 🌈
  • num_samples β€” how many samples are in the audio data. the actual count. the receipts.
  • comment β€” (...the original page genuinely says nothing here. iconic of it, honestly. not me adding details that aren't there πŸ’€)

🌟 Description

SoundCreate creates a SoundRec structure, initializes it with all the values you just handed over, and returns a Sound β€” which is literally a pointer to that SoundRec structure 🫢

and if something went wrong? it returns NULL. no SoundRec, no vibes, just NULL. so check your return value, bestie, that's the whole plot 😭


πŸ‘‘ See Also

  • SoundCloseFile
  • SoundOpenFileForReading
  • SoundOpenFileWriting

and also:

  • audiolib β€” Network Audio System C Language Interface

heads up: keep every one of those related calls on your radar, because a Sound you created is gonna need closing and opening eventually. main character energy requires follow-through πŸ’…

k that's the whole page!! this was version 1.9.4, and yeah, that's the version + date energy I'm signing off with β€” go make some audio descriptions, you absolute icon, periodt πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from