mirror of
https://github.com/D-Modem/courier-emu.git
synced 2026-11-28 12:38:04 -08:00
The transmit array holds audio the bridge never reads
_final_line_tx_scan reads the core's whole m_line_tx at the end of a run and agrees with the core's own counters exactly: A has 5,176 nonzero samples, peak 22,748, starting at index 27,412 (3.81 s). The bridge consumed indices 0..216,002 of that same array - which includes 27,412 - and saw a peak of zero. The same disagreement is on the audible end: B's array peaks at 28,040 while the bridge only ever saw 17,188, which is also b-tx.wav's peak. The bridge's view matches the wire in both cases; the array carries values it never read. Ruled out by measurement: no core rebuild (core_rebuilt_at 0, bootstraps 1), no trimming (one clear(), no erase/resize/pop_front), not the resampler (the peak is zero before the conversion), not an out-of-range read, and neither of the two causes settled earlier. A vector does not change an index it has already written, so one of the two measurements is not measuring what it appears to. Not a datasheet question. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f59a824865
commit
329bbfa8a9
3 files changed
+42397
-1
No files matched your search
File diff suppressed because it is too large.
Load diff
+38
-1
@@ -522,6 +522,10 @@ class CourierDspBridge:
|
||||
"drained_frames": 0,
|
||||
"buffer_left": 0,
|
||||
"budget_frames": 0,
|
||||
"tx_peak_codec": 0,
|
||||
"tx_consumed": 0,
|
||||
"tx_index": 0,
|
||||
"tx_peak_line": 0,
|
||||
}
|
||||
# `out 0x1e, 4` at 0x8e631 starts an overlay transfer.
|
||||
self.transfer_start_command = 4
|
||||
@@ -703,6 +707,21 @@ class CourierDspBridge:
|
||||
"""
|
||||
return float(getattr(self.core, "codec_sample_rate", 0.0) or 0.0)
|
||||
|
||||
def _final_line_tx_scan(self) -> dict[str, int]:
|
||||
"""Nonzero count and peak over the core's entire line transmit array."""
|
||||
try:
|
||||
samples = self.core.line_tx_samples(0)
|
||||
except Exception:
|
||||
return {"final_tx_total": 0, "final_tx_nonzero": 0,
|
||||
"final_tx_peak": 0, "final_tx_first_nonzero": -1}
|
||||
nonzero = [index for index, value in enumerate(samples) if value]
|
||||
return {
|
||||
"final_tx_total": len(samples),
|
||||
"final_tx_nonzero": len(nonzero),
|
||||
"final_tx_peak": max((abs(value) for value in samples), default=0),
|
||||
"final_tx_first_nonzero": nonzero[0] if nonzero else -1,
|
||||
}
|
||||
|
||||
def _take_line_audio(self) -> None:
|
||||
"""Move the codec's new output onto the line, at the line's rate.
|
||||
|
||||
@@ -715,10 +734,25 @@ class CourierDspBridge:
|
||||
return
|
||||
self._exchange_tx_index += len(produced)
|
||||
rate = self.codec_sample_rate()
|
||||
self._exchange_line_buffer.extend(
|
||||
converted = (
|
||||
self._codec_to_line.convert(produced, rate, LINE_RATE)
|
||||
if rate else produced
|
||||
)
|
||||
# Peak either side of the conversion. A stream that is nonzero going in
|
||||
# and zero coming out is a resampler fault; one that is near zero going
|
||||
# in is a datapump that is not transmitting, which is a different
|
||||
# question entirely.
|
||||
self._line_service["tx_consumed"] += len(produced)
|
||||
self._line_service["tx_index"] = self._exchange_tx_index
|
||||
self._line_service["tx_peak_codec"] = max(
|
||||
self._line_service["tx_peak_codec"],
|
||||
max((abs(sample) for sample in produced), default=0),
|
||||
)
|
||||
self._line_service["tx_peak_line"] = max(
|
||||
self._line_service["tx_peak_line"],
|
||||
max((abs(sample) for sample in converted), default=0),
|
||||
)
|
||||
self._exchange_line_buffer.extend(converted)
|
||||
|
||||
def _queue_line_audio(self, samples: list[int]) -> None:
|
||||
"""Hand line audio to the codec at the codec's rate, not the line's."""
|
||||
@@ -2912,6 +2946,9 @@ class CourierDspBridge:
|
||||
self._line_service,
|
||||
buffer_left=len(self._exchange_line_buffer),
|
||||
budget_frames=self.line_frame_budget or 0,
|
||||
# Read the core's whole transmit array once, at the end, so the
|
||||
# count cannot depend on when the bridge happened to sample it.
|
||||
**self._final_line_tx_scan(),
|
||||
),
|
||||
overlay_words_verified=self.overlay_words_verified,
|
||||
overlay_words_unreadable=self.overlay_words_unreadable,
|
||||
|
||||
@@ -315,6 +315,56 @@ the datapump's DAC slot. B's audio crosses the same conversion intact, which
|
||||
argues against the resampler and for the write path, but that is an argument,
|
||||
not a measurement.
|
||||
|
||||
## The transmit array and the bridge's reading of it disagree
|
||||
|
||||
The datasheets are not what is missing here. Following A's silence down to the
|
||||
sample gives a contradiction inside the harness.
|
||||
|
||||
`Bridge._final_line_tx_scan` reads the core's entire `m_line_tx` once, at the
|
||||
end of the run, so the answer cannot depend on when it was sampled. Beside it,
|
||||
`_take_line_audio` now records how much it consumed and the peak it saw:
|
||||
|
||||
| | A (silent) | B (audible) |
|
||||
|---|---:|---:|
|
||||
| core counter `line_tx_writes` | 216,007 | 216,007 |
|
||||
| core counter `line_tx_nonzero` | 5,176 | 29,375 |
|
||||
| final scan total | 216,007 | 216,007 |
|
||||
| final scan nonzero | 5,176 | 29,375 |
|
||||
| final scan peak | **22,748** | **28,040** |
|
||||
| final scan first nonzero | 27,412 (3.81 s) | 20,406 (2.83 s) |
|
||||
| bridge consumed | 216,003 | 216,003 |
|
||||
| bridge index reached | 216,003 | 216,003 |
|
||||
| **peak the bridge saw** | **0** | **17,188** |
|
||||
|
||||
The final scan agrees with the core's own counters exactly, on both ends. And
|
||||
the bridge consumed indices 0 to 216,002 - which **includes** index 27,412,
|
||||
where A's first nonzero sample sits - and came away with a peak of zero.
|
||||
|
||||
The same disagreement is on the audible end, in smaller print: B's array peaks
|
||||
at 28,040 and the bridge only ever saw 17,188, which is also the peak in
|
||||
`b-tx.wav`. So the bridge's view is self-consistent with what reached the wire
|
||||
in both cases; it is the *array* that has values the bridge never read.
|
||||
|
||||
Ruled out, each by measurement rather than by reading:
|
||||
|
||||
* **Not a core rebuild.** `core_rebuilt_at` is 0 on both ends, and `bootstraps`
|
||||
is 1.
|
||||
* **Not trimming.** `m_line_tx` has exactly one `clear()`, in `reset()`, and no
|
||||
`erase`, `resize` or `pop_front` anywhere.
|
||||
* **Not the resampler.** The peak is zero *before* the codec-to-line
|
||||
conversion, not after it.
|
||||
* **Not an out-of-range read.** The accessor returns 0 past the end, but every
|
||||
index in question is well inside an array the same call reports as 216,007
|
||||
long.
|
||||
* **Not the truncation**, and **not the originate early return** - both settled
|
||||
above.
|
||||
|
||||
A `std::vector` does not change a value at an index that has already been
|
||||
written, so one of these two measurements is not measuring what it appears to.
|
||||
That is the next thing to find, and it is a bookkeeping fault in the harness
|
||||
rather than anything about the AC01, the ASIC or V.8. **No conclusion about the
|
||||
firmware should be drawn from a transmit path in this state.**
|
||||
|
||||
### The next question, singular
|
||||
|
||||
Does `@48` ever get written on this image - by any site, in any configuration?
|
||||
|
||||
Reference in new issue
Block a user