-
Balwyn
Here is way to get a bit more out of the soundfont generators using NRPN to address them. I've had this info for a very long time and can't seem to find where it came from.
You will need to change the path to your soundfont in [else/sfont~] and use the sf2-presets-reader.pd to create soundfont.txt if you want to use choose-sf2.pd.
Probably not that useful, just a bit of funEdit: I found the source of this info in the soundfont 2.04 spec
-
Balwyn
I've just updated choose-sf2-example.pd in the zip in the original post because it was incorrectly wired and triggered, causing the previous index and current bank to be sent immediately before the current index and current bank often causing an error. I noticed it when I connected a print object to else/sfont~ right outlet
choose-sf2-example.pd -
Balwyn
@oid
I really should have explained about the $0 for those who may be following:The abstraction choose-sf2.pd is a dynamic patching patch that generates a bang connected to a message containing an index number of the lines of soundfont,txt and then connected to a send $0-result, this is the line number to read in soundfont.txt when the item bang is clicked, this is passed to $0-chosen
The format of the items in soundfont.txt was for simplicity in sorting the preset index and bank together with the name following. (the presets in a soundfont2 file are often very unsorted)
choose-sf2-example.pd shows how to retrieve the index, bank & nameThe abstraction choose-sf2.pd is instantiated on the choose-sf2-example.pd with one argument $0, this offers a link back from choose-sf2 to choose-sf2-example. The send $0-chosen in choose-sf2 can then be received by the $0-chosen in choose-sf2-example.
This already seems too wordy and now I'm confused
-
Balwyn
15 or so years ago I came across a vb script to extract a presets list from a soundfont2 file, which I adapted to use in various VB.net Fluidsynth projects.
Now that Pure Data has the file handle object to read binary files I decided to give it a go in Pd on Windows 10.
I have also tried it using linux and it seems to work with the latest portable version.
Edit: Thursday 22nd August 2024, I've just updated choose-sf2-example.pd in the zip because it was incorrectly wired an triggered
sf2-presets-reader.zip
contains:
sf2-presets-reader.pd to create soundfont.txt
choose-sf2-example.pd to launch choose-sf2.pd and show index, bank and name extraction from [r $0-chosen]
choose-sf2.pd
soundfont,txt contains the presets from a soundfont I use SGM-V2.01.sf2 (236MB), this will be overwritten with your choice.My preferred soundfont player to use with Pure Data is RGC-Audio SFZ.dll or SFZ+.dll loaded in @spacechild1 very excellent vstplugin~
Other options are Qsynth via midiout
Fluidsynth,exe via midiout launched with motex/systemWarning Purr-Data will not open sf2-presets-reader.pd because it does not have the file object.
Method;
open the soundfont2 file;
then look for phdr by searching backwards;
one byte at a time from the end of the file and look for p;
then see if the remainder from route is hdr;
then forwards 38 bytes for each instrument preset;
to retrieve bank, index and name until EOP tag;
send to text: (bank as integer, index / 1000 added to bank) and name as symbol;
;
then sort in order:- text define [sort(;
;
next write the text to soundfont, txt;Cheers
Balwyn -
Balwyn
Here is the way I did it using key and keyup
However filtering key numbers may vary with different keyboard layouts
computer-keys-to-notes.zip -
Balwyn
@weuoimi apparently the [adsr] has been altered for the tutorial, there are direct connections instead of send and receives
see below
I recreated pm-osc from the tutorial and used this adsr and your dx7 works