SDL_SETAUDIOSTREAMFREQUENCYRATIO(3)
π SDL_SetAudioStreamFrequencyRatio π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_SetAudioStreamFrequencyRatio β the lil function that changes the frequency ratio of an audio stream. yes it's a mouthful, no you don't have to say it out loud. π
β¨ NAME β¨
SDL_SetAudioStreamFrequencyRatio β change the frequency ratio of an audio stream.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_audio.h>
bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
π¦ DESCRIPTION π¦
so here's the vibe: the frequency ratio is what adjusts the rate at which input data is consumed. change it and you're literally changing the speed and the pitch of the audio. it's giving DJ, it's giving chipmunk, it's giving slow-mo dramatic montage. π
- a value greater than
1.0fplays the audio faster, and at a higher pitch πΏοΈ - a value less than
1.0fplays the audio slower, and at a lower pitch π’ 1.0fmeans play at normal speed, aka the default reality, aka no notes β¨
this gets applied during SDL_GetAudioStreamData, and you can continuously change it to create various effects. obsessed. keep messing with it mid-stream, the audio does not mind. π₯
π FUNCTION PARAMETERS π
streamβ the stream on which the frequency ratio is being changed. yes, the one you're doing this to. that stream. π«Άratioβ the frequency ratio.1.0is normal speed. Must be between0.01and100. like, genuinely must. no cap.
π RETURN VALUE π
returns true on success or false on failure. and if it fails, bestie, go call SDL_GetError() for more information β it will tell you what went wrong, fr fr. π
π THREAD SAFETY π
it is safe to call this function from any thread, because it holds a stream-specific mutex while running. multitask away, she's protected. π
π AVAILABILITY π
this function has been available since SDL 3.2.0. if you're on something older... not the vibe, upgrade. β
π SEE ALSO π
and that's the whole page, bestie, you ate it. π this iconic lil doc is brought to you by Simple Directmedia Layer β SDL 3.4.18 β mwah, slay, periodt. πβ¨π§
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms