This repository was archived by the owner on Oct 31, 2026. It is now read-only.
Repository navigation
soundfont: a settable pitch-bend range and channel tuning - #246
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
soundfontandsoundfont_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.