-
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.
- Loading branch information
1 parent
21e30cc
commit 4c07da9
Showing
2 changed files
with
42 additions
and
1 deletion.
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
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,17 @@ | ||
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() | ||
sfid = fs.sfload(local_file_path("example.sf2")) | ||
fs.midi2audio(local_file_path("1080-c01.mid"), local_file_path("1080-c01.wav")) | ||
# A Synth object can synthesize multiple files. For example: | ||
# fs.midi2audio(local_file_path("1080-c02.mid"), local_file_path("1080-c02.wav")) | ||
# fs.midi2audio(local_file_path("1080-c03.mid"), local_file_path("1080-c03.wav")) |