Skip to content

fix(firmware): tuner reads a bass's low strings - #28

Closed
VinSpee wants to merge 1 commit into
isod89:mainfrom
VinSpee:fm/openpocket-tuner-upstream-pr-2
Closed

VinSpee wants to merge 1 commit into
isod89:mainfrom
VinSpee:fm/openpocket-tuner-upstream-pr-2

Conversation

@VinSpee

@VinSpee VinSpee commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

The tuner could not read the lowest bass strings. Its lowest readable pitch was about 61 Hz, so a bass's low E (41 Hz) and A (55 Hz) were missed or misread, as reported in #20. This lowers the floor to about 27.6 Hz, which also covers a five-string bass's low B (31 Hz). The upper limit of 1100 Hz is unchanged, and memory use does not grow because the pitch search now judges each lag as soon as the next one is known. The tuner code moves into its own header so it can run on a PC, and a new host test checks bass and guitar notes. On the host, all 229 test cases pass, up from 157 before the fix, and the low E was read correctly 18 of 18 times, up from 0. It has not been tried on a real pedal with a bass. Fixes #20.

The tuner's longest lag was 180 samples at 11025 Hz, so its lowest note was
61 Hz: a bass's E (41 Hz) and A (55 Hz) strings showed nothing or a wrong note
(issue #20). The lag now reaches 400 samples (27.6 Hz), enough for a
five-string bass's low B (31 Hz) tuned up from flat.

The lag search now judges each lag as it is computed and stops at the bottom
of the first dip, so the array of normalised differences is gone. The tuner's
buffers grow by 80 bytes in all (the window copy grows by 880, the array of
1604 would have pushed the Bluetooth test image's NAM layer split out of the
cache RAM). The difference window now starts 20 ms earlier in the buffer;
guitar readings move by at most 0.1 cent.

The tuner moves to firmware/px_tuner.h so that tests/test_tuner.c runs it on
a PC: bass and guitar notes, sine and plucked, in tune and off it, read every
100 ms. Before: 157 of 229 cases right (every bass note under 61 Hz wrong).
After: 229 of 229, within 2 cents up to the high E string.
@VinSpee VinSpee closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tuner not able to pick up bass

1 participant