Soundfont2 (SF2) Preset Reader
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 fun
Edit: I found the source of this info in the soundfont 2.04 spec
Soundfont2 (SF2) Preset Reader
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/system
Warning 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
playing video in pd and internal midi sound
@KMETE said:
Any example for a simple midi player in Pd?
I'm not completely sure what you mean by "simple MIDI player," but I'll assume you want some Linux software that will play General MIDI sounds.
AFAICS from a quick web search, you would probably have to install a GM soundfont, e.g. sudo apt-get install fluid-soundfont-gm
, and play it using software such as FluidSynth.
On my system, it took a little hunting, but I found /usr/share/sounds/sf2/FluidR3_GM.sf2
-- fluid, check, GM, check.
You'd probably have to connect Pd MIDI out to FluidSynth MIDI in. That should do it.
Is there any transport and tempo object in PD same as in max?
"Same as Max" -- well, no. Does Pd have its own way of handling tempo? Yes.
[metro] and [delay] objects respond to "tempo" messages -- see their help files. (Though unfortunately, some other timing-related objects such as [pipe] and [makenote] do not respond to tempo messages.)
Pd doesn't have a global transport. You could make your own bars/beats counter and [send] those values around in the patch. (I'm not sure if you need a master scheduler -- if so, there's one in https://github.com/jamshark70/hjh-abs .)
This appears to handle the different subdivisions.
hjh
Notein-noteout
Hi, I'm trying to make a patch: MIDI keyboard => puredata => FluidSynth.
(FluidSynth is a real-time software synthesizer, I use it as output with the "Qsynth" GUI interface.)
I use puredata on Linux.
These are the connections in Jack:
This is the patch:
Playing my MIDI keyboard, I hear the sounds correctly.
But there are two things I need to understand:
-
Why does it also sound at the instant I lift the key?
-
In [makenote] I set a duration of 1000: how can I make the sound last for as long as I hold down the keyboard key?
Thank you,
a.
Where does latency come from in Pure Data?
@whale-av Thanks, David.
I'm on Linux. Here's a little on apps I mentioned.
JACK is a "low-latency" multiplexing sound server (i.e., audio patch bay for pro apps)
It's sister server, PulseAudio, is the system's generic "multiplexer" - these are needed because the modular driver system ("ALSA") doesn't do multiplexing, but only speaks to hardware.
Both JACK and PulseAudio are on trial overhaul with a new thing called PipeWire, which acts as an in-place substitution multiplexer server.
QSynth (fluidsynth) is a soundfont synthesizer - and yes, it has its own settings for buffers, but as long as audio apps are set to use the JACK multiplexer, they are bound by its hardware buffer size setting overall.
The Delay
The Pd delay I am getting is about 80ms, with the Pd "Delay" set to 40ms, and buffer size set to 1024 samples (at 48 kHz).
The QSynth is quite smaller, in fact, it is about 21ms, which equals 1024 samples.
Pd freezes if the "Delay" amount goes below 21 - but as I've mentioned, the overall Pd delay is 80ms.
(Reaper is a cross-platform DAW used by many)
The soundcard
The soundcard is M-AUDIO M-TRACK DUO.
M-AUDIO doesn't offer support for Linux, but ever since the Delta, I think, the driver is more or less similar and has been incorporated into Linux...
I can normally get recording-playback in the Reaper DAW going with 256 samples at 48 kHz steadily, and down to 128 samples with some underruns (for precision MIDI finger drumming, etc.)
The double buffer
One important thing to note is that along with hardware buffer size, the JACK system offers a config parameter of the number of buffers to use. Normally this is set at 2.
Perhaps that is the problem
Externals in Purr-Data
@didipiman Sounds good.
One thing you can do is use otool to inspect the paths for a pre-existing external library that has a dependency. Try fluid~
:
- Make sure
fluid~
will instantiate properly on a canvas. - Find the
fluid~
lib in your Purr Data app bundle. Useotool -L
to inspect its dependencies. It should have a dependency on a fluidsynth library which I ship with Purr Data. - Go to the directory in the app bundle where that fluidsynth lib lives.
- Use otool to figure out its install name
Once you get that info, put your libusb dylib library in the exact same directory inside the app bundle as the fluidsynth library. Then use install_name_tool/otool to set the same path relationship helios and libusb binaries that you saw with fluid~ and fluidsynth
I'll try to do the same the next time I get access to a mac machine.
Purr Data 2.5.0
@alfonso.santimone said:
@jancsika Yeah! that's true. So installed and working correctly at least with simple MIDI and audio test. Portaudio ASIO working. Now i'll check some external helpfile.
So i guess the only things to work on various Makefiles are
- some path adjusting
- some file name adjusting
- correct target architecture
- invoke correct .dll libraries
- Solve Gem issues not compiling for Win64
- Solve fluidsynth~ issues not compiling for Win64
Now that it is compiling and installing, would you mind wrapping up all the changes you made here to get it to build and submitting either
- a merge request on git.purrdata.net, or
- opening an issue here:
https://git.purrdata.net/jwilkes/purr-data/issues
Again, I just need to know the changes you made to get it into a working state.
Once these changes are merged we should be able to at least do a "light" build. Then we can focus on getting the rest of the libraries working, the midi issue, etc.
Purr Data 2.5.0
Some report after testing Purr Data compiled for Win64.
-
I have a strange bug related to MIDI device. I'll have to check if it exists in PD vanilla 32 bit. I have the same bug in PD vanilla for 64bit compiled by Lucas. I don't think it is a multiclient midi driver issue. But i'll check it better. BTW if i choose a MIDI device and apply so it goes saved for the next start of Purr Data..well Purr Data doesn't start anymore and i have to clean the prefs via regedit because it seems that a command line pd.exe -nomidi does not work for Purr Data as it does with Vanilla
-
zexy library does not work even if the .dll externals files are compiled. I have to check the build log because i remember there were some red warnings about specific zexy externals. So every zexy help file i tried shows red outlined externals because the zexy stuff can't be instantiated.
-
there are minor naming errors in some help files that i guess are in the official Purr Data 32bit release (i.e. linearpan~ in pan lib should be linear_pan~
-
timestretch~ just crash Purr Data and the program quits.
-
moocow folder is empty
-
pixelTango does not work but i guess it has something to do with Gem externals dependencies
-
SMLib help file is not present
-
pmpd loads but does not seem to work
-
Gem and fluidsynth~ don't compile for win64 target (so as you know i removed those from the building process)
Purr Data 2.5.0
@jancsika Yeah! that's true. So installed and working correctly at least with simple MIDI and audio test. Portaudio ASIO working. Now i'll check some external helpfile.
So i guess the only things to work on various Makefiles are
- some path adjusting
- some file name adjusting
- correct target architecture
- invoke correct .dll libraries
- Solve Gem issues not compiling for Win64
- Solve fluidsynth~ issues not compiling for Win64
some good additions could be
- new cyclone library
- pd-else library
- oFelia library
- aubio library
Installing PureData 32 bits on 64 bits host for the life of a project
Hi everyone,
I am comming to you today because i want to make a project live !.
This project work with pureData and some external pd object :
fluid~ , freeverb~..
My objectiv is to install a 32 bits version of pureData to make external pd work.
I tried these solutions :
Multi arch ubuntu 64 bits host
- On a 64 bits ubuntu
- add i386 arch
- update , dist-upgrade..
Then when installing : $> apt-get install puredata:i386
This package is no more available :
These packet a replacing it :
puredata-utils puredata-utils:i386 puredata-extra:i386 puredata-core:i386
puredata-core puredata-dev puredata-doc puredata-extra puredata-gui
So i installed
$> apt-get install puredata-utils:i386 puredata-extra:i386 puredata-core:i386 puredata-gui
pureData is now installed. But when i run it i have this message :
ALSA lib conf.c:3357:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL hw:0
ALSA card scan error
Still i can use the debugger and hear sound..
When running my stido project using some object like :
udpReceive or udpSend...
i got this on the initialisation (you can see also all the pd objects used) :
import mrpeach/routeOSC
... couldn't create
import mrpeach/udpreceive
... couldn't create
import mrpeach/udpsend
... couldn't create
import mrpeach/packOSC
... couldn't create
import mrpeach/unpackOSC
... couldn't create
import flatspace/prepend
... couldn't create
import flatspace/prepend
... couldn't create
import moocow/sprinkler
... couldn't create
import cyclone/speedlim
... couldn't create
./libs/fluid~.pd_linux: libreadline.so.5: cannot open shared object file: No such file or directory
fluid~
... couldn't create
freeverb~
... couldn't create
beware! this is xeq 0.1, 3rd beta build... it may bite!
./
So its not working ^^
Solution 2 - Docker
I was thinking : maybe i can just make a puredata container with all the 32 bits libs, So i tried to find some puredata 32 bits image. But nothing.. And Docker is a little tricky with 32 bits container as he didn't provide any support yet.
Still its possible to run 32 bits linux on it .. i found some 32 bits images on the net, but no way how to create one..
If someone has a solution please..
I am working as a volunteer on this project because i believe on it. I have no time yet to update the pd engine for 64 bits..
This project is helping disabled people and your respons will help me so much to provide them a long term support for this software
If you wanna take a look at the project http://orguesensoriel.com
Thank you a lot,
Damien