Skip to content
This repository was archived by the owner on Oct 31, 2026. It is now read-only.

soundfont: a settable pitch-bend range and channel tuning - #246

Merged
bdbarnett merged 1 commit into
mainfrom
soundfont/bend-range
Oct 30, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
soundfont/bend-range

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

The SoundFont instruments bent by a fixed two semitones, so a General MIDI song that sets Pitch Bend Sensitivity (RPN 0) to 12 for a guitar slide played a sixth of the slide, and one that tunes a channel (RPN 1 and 2) played it at A440.

This adds two properties to soundfont and soundfont_drums:

  • bend_range: semitones at full deflection, either way. BEND_RANGE (2) until set.
  • tuning: the whole instrument's shift in semitones, fractions included. 0 until set.

Both apply to the notes already sounding and to the next ones. reset() puts them back and centres the wheel; before this, a reset left the last bend on the following notes.

RPN parsing stays with the host: a host that has the MIDI stream (a sound module, a sequencer) keeps the RPN state per channel and sets these.

Tested: tests/test_cpython_soundfont.py (48 tests) against audiodsp at the pin; the new test fails with the wheel held to the fixed range.

bend_range (semitones, 2 until set) and tuning (semitones, 0 until set) on
both SoundFont instruments, so a host that reads RPN 0, 1 and 2 can give a
song the bend range and tuning it asks for. Both move the notes already
sounding, and reset() puts them back with the wheel centred: before, a reset
left the last bend on the next notes.
@bdbarnett
bdbarnett merged commit 955ddb3 into main Oct 30, 2026
7 checks passed
@bdbarnett
bdbarnett deleted the soundfont/bend-range branch October 30, 2026 02:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant