SimTX API v24/Packets/SampleBlock: Difference between revisions
m Clanker moved page SimTX API/Packets/SampleBlock to SimTX API v24/Packets/SampleBlock: Archive the v24 protocol reference |
Archive the v24 protocol reference: use the v24 templates, links and categories |
||
| Line 1: | Line 1: | ||
{{SimTX API navigation}} | {{SimTX API v24 navigation}} | ||
{{SimTX packet | {{SimTX packet v24 | ||
| name = SampleBlock | | name = SampleBlock | ||
| id = 3 | | id = 3 | ||
| hex = 0x03 | | hex = 0x03 | ||
| direction = c2s | | direction = c2s | ||
| session = [[SimTX API/Transmitter session|Transmitter]] | | session = [[SimTX API v24/Transmitter session|Transmitter]] | ||
| size = 4 + 4n bytes, or 8 + 2n bytes (compact) | | size = 4 + 4n bytes, or 8 + 2n bytes (compact) | ||
| permission = None | | permission = None | ||
| group = transmitter | | group = transmitter | ||
}} | }} | ||
'''SampleBlock''' carries samples for the server to transmit. After [[SimTX API/Packets/TxAccept|TxAccept]], a client with role 2 streams these continuously, in real time, at the <code>sampleRate</code> it declared. The block has two forms: plain 32-bit floats for any source, and a compact 16-bit form for IQ sources. | '''SampleBlock''' carries samples for the server to transmit. After [[SimTX API v24/Packets/TxAccept|TxAccept]], a client with role 2 streams these continuously, in real time, at the <code>sampleRate</code> it declared. The block has two forms: plain 32-bit floats for any source, and a compact 16-bit form for IQ sources. | ||
== Layout == | == Layout == | ||
| Line 48: | Line 48: | ||
== Pacing == | == Pacing == | ||
Send samples at the declared rate. Input faster than 1.05 × that rate, after a burst allowance of about 2 seconds, is discarded a whole block at a time. When the server's buffer is 90 % full, it stops reading the socket and TCP flow control holds the client back. Watch <code>bufferSeconds</code> in [[SimTX API/Packets/TxTelemetry|TxTelemetry]]. | Send samples at the declared rate. Input faster than 1.05 × that rate, after a burst allowance of about 2 seconds, is discarded a whole block at a time. When the server's buffer is 90 % full, it stops reading the socket and TCP flow control holds the client back. Watch <code>bufferSeconds</code> in [[SimTX API v24/Packets/TxTelemetry|TxTelemetry]]. | ||
== Example == | == Example == | ||
| Line 63: | Line 63: | ||
== See also == | == See also == | ||
* [[SimTX API/Transmitter session#Streaming|Streaming]] | * [[SimTX API v24/Transmitter session#Streaming|Streaming]] | ||
{{SimTX API navbox}} | {{SimTX API v24 navbox}} | ||
[[Category:SimTX API]] | [[Category:SimTX API v24]] | ||
Latest revision as of 16:17, 24 October 2026
| Packet ID | 3(0x03)
|
|---|---|
| Direction | Client → server |
| Session | Transmitter |
| Body size | 4 + 4n bytes, or 8 + 2n bytes (compact) |
| Permission | None |
SampleBlock carries samples for the server to transmit. After TxAccept, a client with role 2 streams these continuously, in real time, at the sampleRate it declared. The block has two forms: plain 32-bit floats for any source, and a compact 16-bit form for IQ sources.
Layout[edit | edit source]
The sign of the first field selects the form.
| Field | Type | Description |
|---|---|---|
packetId |
u8 |
Always 3.
|
n |
i32 |
Positive: plain form with n values. Negative: compact form with −n values. Zero is invalid. |
| plain form | ||
samples |
n × f32 |
Sample values. 1 ≤ n ≤ 65,536. |
| compact form | ||
scale |
f32 |
Finite and ≥ 0. |
samples |
(−n) × i16 |
Value = q × scale / 32767. −n must be even and at most 65,536.
|
Sample content[edit | edit source]
| Source type | Content | Processing |
|---|---|---|
AUDIO_STREAM, MICROPHONE, PIPEWIRE |
Mono audio, one value per sample, nominal range ±1. Plain form only. | Multiplied by audioGain and clipped to ±100, then modulated.
|
GNU_RADIO_IQ |
Complex baseband, I and Q interleaved (so n is even), centred on the carrier. Either form. | Multiplied by audioGain and clipped to ±2.0. Average power is normalised to at most 1.0, which corresponds to powerWatts.
|
A block may contain any number of samples up to the limit; blocks of 10–50 ms are a good compromise between overhead and latency.
Errors[edit | edit source]
The connection is closed without a message for n = 0, more than 65,536 values, a compact block on an audio source, an odd value count on an IQ source, or a negative or non-finite compact scale.
Pacing[edit | edit source]
Send samples at the declared rate. Input faster than 1.05 × that rate, after a burst allowance of about 2 seconds, is discarded a whole block at a time. When the server's buffer is 90 % full, it stops reading the socket and TCP flow control holds the client back. Watch bufferSeconds in TxTelemetry.
Example[edit | edit source]
Four audio samples:
03 packetId 3
00 00 00 04 n = 4
00 00 00 00 0.0
3F 00 00 00 0.5
3F 80 00 00 1.0
BF 00 00 00 -0.5