feat(tci): name the transmit audio source when keying, per the protocol

The specification settles what a night of experiments could only guess at.
TRX takes an optional THIRD argument naming the signal source — tci, mic1,
mic2, micPC, ecoder2 — and TCI 2.0 says it plainly: 'The signal for
transmitting is always taken from the microphone selected in the
ExpertSDR3. If a third-party software connected via TCI wants to transmit
its audio signal, you must specify the third argument - TCI.'

Without it the radio sends no chrono at all, whatever the mode. That is
what the SSB attempts ran into, and what was misread here as 'digital
modes only' — the mode was never the rule, the missing argument was.

So OpsLog says it, following the 'To radio' device: 'tci' when the voice
keyer owns the transmission, nothing at all otherwise, which leaves the
operator's own microphone alone for every other PTT. Nobody has to find
that setting in ExpertSDR3 and set it again for every mode, which is how
it is remembered there.

Two more things from the same document. A chrono with no audio ready is
now answered with silence rather than left unanswered — the vendor calls
that preferable. And the receive stream declares float32 and two channels
instead of trusting the defaults: they are the documented defaults, but a
default is something another program sharing this radio can have changed,
and a stream in an unexpected format is heard as noise rather than as a
mistake.
This commit is contained in:
2026-08-26 00:21:32 +02:00
parent 5388f76733
commit fdc2378191
8 changed files with 148 additions and 309 deletions
+43
View File
@@ -67,6 +67,9 @@ type TCI struct {
// never sends TX_ENABLE at all, from being treated as refusing: without a
// word from the radio we key and let it decide.
txAllowed bool
// txSource is the TRX third argument: "tci" while OpsLog has audio to send,
// empty for the operator's microphone. See SetPTT.
txSource string
// drive is the radio's transmit drive, 0-100. Kept because a quiet
// transmission has two possible causes — our level or the radio's — and a
// log that names both settles it in one line instead of an evening.
@@ -344,9 +347,49 @@ func (t *TCI) SetPTT(on bool) error {
"check the frequency is inside a transmit band and that TX is enabled in ExpertSDR")
}
}
// THE THIRD ARGUMENT NAMES THE AUDIO SOURCE, and it is the whole answer to
// "why does the radio ignore what I send it".
//
// TCI 2.0 §TRX: "The signal for transmitting is always taken from the
// microphone selected in the ExpertSDR3. If a third-party software connected
// via TCI wants to transmit its audio signal, you must specify the third
// argument - TCI." Without it the radio never sends a single chrono frame,
// whatever the mode and whatever is configured in its window — which is
// exactly what a night of experiments showed and misread as "digital modes
// only".
//
// Sent only when a transmission is ours to feed. A plain trx keeps the
// operator's own microphone, which is what every other PTT in OpsLog means.
t.mu.Lock()
src := t.txSource
t.mu.Unlock()
if on && src != "" {
return t.send(fmt.Sprintf("trx:0,true,%s;", src))
}
return t.send(fmt.Sprintf("trx:0,%t;", on))
}
// SetTXAudioSource says where the radio should take its transmit audio from
// while OpsLog keys it: "tci" for the stream this program sends, "" for the
// microphone the operator chose in ExpertSDR3.
//
// Set from the audio settings — it follows the "To radio" device — so keying
// for a voice message and keying for anything else behave differently on
// purpose: only the first one takes the audio away from the microphone.
func (t *TCI) SetTXAudioSource(src string) {
t.mu.Lock()
changed := t.txSource != src
t.txSource = src
t.mu.Unlock()
if changed {
if src == "" {
debugLog.Printf("TCI: transmit audio will come from the radio's own microphone")
} else {
debugLog.Printf("TCI: transmit audio will be taken from %s when OpsLog keys the radio", src)
}
}
}
// send writes a command to the WebSocket (one writer at a time).
func (t *TCI) send(cmd string) error {
t.mu.Lock()
+7
View File
@@ -136,6 +136,13 @@ func (t *TCI) StartTCIAudio(rx, rate int) error {
if err := t.send(fmt.Sprintf("audio_samplerate:%d;", rate)); err != nil {
return err
}
// Said rather than assumed. float32 and two channels are the documented
// defaults and what this radio streams, but a default is a thing another
// program can have changed — they share the radio, not just the protocol —
// and a stream arriving in a format the decoder was not expecting is heard
// as noise, not as a mistake.
_ = t.send("audio_stream_sample_type:float32;")
_ = t.send("audio_stream_channels:2;")
return t.send(fmt.Sprintf("audio_start:%d;", rx))
}
+4 -1
View File
@@ -88,10 +88,13 @@ func (t *TCI) serveChrono(rate, samples int) {
}
payload := feed(samples)
if payload == nil {
// Answered with silence rather than left unanswered. TCI 2.0 §3.4: "the
// client may not send a response or may send a signal with zero counts,
// which corresponds to no signal - this option is preferable."
payload = make([]byte, samples*4)
t.audio.mu.Lock()
t.audio.txShort++
t.audio.mu.Unlock()
return
}
if rate <= 0 {
rate = 48000