bytes_to_frames(9)
β¨ bytes_to_frames β the Kernel API Manual, but make it make sense π
okay so bestie, welcome to bytes_to_frames(9) β the little kernel helper that does exactly one thing and does it iconically: it converts a size from bytes into frames. that's it. that's the whole vibe. π
πΈ NAME πΈ
bytes_to_frames β unit conversion of the size from bytes to frames
like, literally the glow-up of a byte count into a frame count. no cap.
β SYNOPSIS β
snd_pcm_sframes_t bytes_to_frames (struct snd_pcm_runtime *runtime ,
ssize_t size );
two arguments, one return value, zero drama. the way that signature just sits there being all neat and correct π«Ά
π ARGUMENTS π
runtimeβ the PCM runtime instance. yes queen, you gotta hand over the whole runtime context, she's part of the equation.sizeβ the size in bytes. the raw material. the before picture. π₯
π RETURN π
it returns the size in frames. periodt. that's the answer to "so how many frames is that" and it is giving convenience π
π SEE ALSO π
the lore continues in the kernel file ./include/sound/pcm.h β and here's the whole friend group, no one left out bestie:
snd_pcm_stream_linked(9)snd_pcm_stream_lock_irqsave(9)snd_pcm_stream_lock_irqsave_nested(9)snd_pcm_group_for_each_entry(9)snd_pcm_running(9)__snd_pcm_set_state(9)bytes_to_samples(9)samples_to_bytes(9)frames_to_bytes(9)frame_aligned(9)snd_pcm_lib_buffer_bytes(9)snd_pcm_lib_period_bytes(9)snd_pcm_playback_avail(9)snd_pcm_capture_avail(9)snd_pcm_playback_hw_avail(9)snd_pcm_capture_hw_avail(9)snd_pcm_playback_ready(9)snd_pcm_capture_ready(9)snd_pcm_playback_data(9)snd_pcm_playback_empty(9)snd_pcm_capture_empty(9)snd_pcm_trigger_done(9)params_channels(9)params_rate(9)params_period_size(9)params_periods(9)params_buffer_size(9)params_buffer_bytes(9)snd_pcm_hw_constraint_single(9)snd_pcm_format_cpu_endian(9)snd_pcm_set_sync(9)snd_pcm_set_runtime_buffer(9)snd_pcm_gettime(9)snd_pcm_set_fixed_buffer(9)snd_pcm_set_fixed_buffer_all(9)snd_pcm_sgbuf_get_addr(9)snd_pcm_sgbuf_get_chunk_size(9)snd_pcm_limit_isa_dma_size(9)snd_pcm_direction_name(9)snd_pcm_stream_str(9)snd_pcm_chmap_substream(9)pcm_format_to_bits(9)pcm_for_each_format(9)
ngl if you neededbytes_to_framesyou probably also needbytes_to_samples,samples_to_bytesandframes_to_bytesβ the conversion quartet ate and left no crumbs π₯
that's the whole page bestie, short and slay. this one lives under ./include/sound, dated October 2026, and it's bytes_to_frames(9) from the Kernel API Manual β go forth and convert those bytes into frames π
β¨π·
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms