Skip to content

src/oscillators: Any PCM with at least 512 samples can be a wavetable. - #997

Merged
dpwe merged 1 commit into
mainfrom
wavetabler
Jul 27, 2026
Merged

src/oscillators: Any PCM with at least 512 samples can be a wavetable.#997
dpwe merged 1 commit into
mainfrom
wavetabler

Conversation

@dpwe

@dpwe dpwe commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Loosens the conditions on what can be treated as a wavetable, following request of @ernesto on Discord.

The code assumes each cycle in the wavetable file is exactly 256 samples. However, the PCM file can contain any number of them, as long as it has at least 2 (so there are at least two wave shapes to interpolate).

On playback, the phase value interpolates within the table, dividing the range between 0.0 and 1.0 into as many interpolation intervals as there are distinct waveforms in the wavetable (minus 1).

To play an arbitrary sound as a wavetable:

>>> amy.load_sample('../Downloads/trim_bit.wav', preset=32)
Loaded sample over wire protocol. Preset #32. 11844 bytes, 5922 frames, midinote 60
>>> amy.send(synth=1, num_voices=4, oscs_per_voice=1)
>>> # eg0 controls amplitude envelope, eg1 controls phase i.e. waveform from the wavetable.
>>> amy.send(synth=1, osc=0, wave=amy.WAVETABLE, preset=32, duty='0.0,0,0,0,1.0', 
             eg0='20,1,9960,1,20,0,20,0', eg1='0,0,10000,1,100,1')

@dpwe
dpwe merged commit 01f1b98 into main Jul 27, 2026
12 checks passed
@bwhitman

Copy link
Copy Markdown
Collaborator

⛓️ tulipcc integration PR opened

This merge was pinned into tulipcc for full-system CI: shorepine/tulipcc#1254

Test it there and merge that PR to move tulipcc onto this AMY.

@github-actions

Copy link
Copy Markdown
Contributor

🎛️ AMY HW CI (AMYboard bench)

Flashed this PR's AMY (LoadTestChord: 6-voice Juno patch=1, one held note every 2 s) onto the physical AMYboard and measured the smoothed render load as the chord grows — back-to-back with the same sketch built at the PR's merge base, so Δ is this PR's own cost.

PASS — the bench ran the test to completion.

notes held main @ 1170461 this PR Δ
1 1018 1015 -3
2 1179 1180 +1
3 1744 1746 +2
4 1926 1927 +1
5 2564 2560 -4
6 2743 2744 +1

Full chord settled render μs: 2740 (was 2741, Δ -0.0%) (peak 2748, 39 samples)

⬇️ Artifacts: serial log · load trace · report

Self-hosted bench (amyboardci). FAIL means only that the test could not run — the load values are informational, with no threshold and no audio compare. See tools/arduino_loadsweep/.

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.

2 participants