-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues related to undefined names for set_chorus_speed and set_ch…
…orus_depth. Turn docstring for load_libfluidsynth into raw string to avoid warnings about illegal backslash escapes. Fix broken fallback branch of sfpreset_name method. Clamp pitch bend values and fix max value in docstring. Fix tuning_dump function to have a python api. Update example SoundFont instrument to turn on reverb in single preset. Add new test showing off reverb. Bump api_version constant because api is affected by this commit. Rename "set" to "flag", poorly chosen local variable name.
- Loading branch information
1 parent
9a7332a
commit 989e739
Showing
3 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import time | ||
import fluidsynth | ||
|
||
def local_file_path(file_name: str) -> str: | ||
""" | ||
Return a file path to a file that is in the same directory as this file. | ||
""" | ||
from os.path import dirname, join | ||
|
||
return join(dirname(__file__), file_name) | ||
|
||
fs = fluidsynth.Synth() | ||
fs.start() | ||
## Your installation of FluidSynth may require a different driver. | ||
## Use something like: | ||
# fs.start(driver="pulseaudio") | ||
|
||
sfid = fs.sfload(local_file_path("example.sf2")) | ||
fs.program_select(0, sfid, 0, 0) | ||
|
||
# Note that reverb send amount from presets is also determined by SF2 file. | ||
# If needed you can edit SF2 files with Polytope. To add reverb: | ||
# * Open SF2 file in Polytope. | ||
# * Choose the desired preset in Polytope in left panel. | ||
# * Scroll down to "Reverb (%)". | ||
# * In "Global" column of "Reverb (%)" row set to 100.0 or appropriate percentage. | ||
# * Save SF2 file. | ||
fs.set_reverb(roomsize=0.8, damping=0.2, width=50.0, level=0.5) | ||
fs.noteon(0, 60, 30) | ||
fs.noteon(0, 67, 30) | ||
fs.noteon(0, 76, 30) | ||
|
||
time.sleep(2.0) | ||
fs.pitch_bend(0, -8192) | ||
time.sleep(2.0) | ||
|
||
fs.noteoff(0, 60) | ||
fs.noteoff(0, 67) | ||
fs.noteoff(0, 76) | ||
|
||
time.sleep(2.0) | ||
|
||
fs.delete() |