Documentation sections
I2S Audio Interface Timing Calculator
POSThttps://rftools.io/ api/ py/ v1/ calculate
Slug i2s-timing. Calculate I2S bit clock (BCLK), word clock (LRCLK/WCLK), and data rate for audio interfaces at any sample rate, bit depth, and channel count.
Inputs
Send every one of these in inputs, in the units shown. Most are required: a call without one is refused (400) and costs nothing; one the calculator can do without takes the default shown. An input outside its range is still computed and flagged in the provenance.
| Name | Unit | Range | Default | Description |
|---|---|---|---|---|
| sampleRatenumber | kHz | 0.1 … 768 | 44.1 | Audio sample rate (e.g., 44.1, 48, 96, 192 kHz) |
| bitDepthnumber | bits | 8 … 64 | 24 | Bits per sample (common: 16, 24, 32 bits) |
| channelsnumber | none | 1 … 32 | 2 | Number of audio channels (1 for mono, 2 for stereo) |
| mclknumber | MHz | 0.1 … 200 | 16.9344 | The clock BCLK is divided from by a whole number: 16.9344 MHz is 384 × 44.1 kHz, 12.288 MHz is 256 × 48 kHz |
| rateBudgetnumber | % | 0.001 … 10 | 0.1 | The sample-rate error the link can take; ±0.1 % (1000 ppm) is IEC 60958-3's Level II clock accuracy for consumer digital audio |
Outputs
Returned in values, by key. A value that is unbounded or undefined is null.
| Field | Unit | Description |
|---|---|---|
| bclkheadline | MHz | Bit clock frequency: BCLK = Fs × bit_depth × channels |
| wclk | kHz | Word/frame clock frequency = sample rate |
| bclkPeriod | ns | Period of one BCLK cycle |
| dataRate | Mbps | Raw audio data rate on the I2S bus |
| mclkDivider | none | The whole number MCLK is divided by, the nearest to MCLK/BCLK |
| bclkActual | MHz | MCLK over the divider |
| sampleRateActual | kHz | The actual BCLK over the bits in a frame |
| sampleRateError_pct | % | Actual over requested, signed; zero only where MCLK is a whole multiple of BCLK |
Calling it
- Calculate: one call, the request and response in full, and its errors.
- Batch: this calculator with others, or a sweep, in one request.
- Solve for a target: the value of one input that brings an output to a target.