14 replies [Last post]
tomotello
Offline
Joined: 03/19/2011
Looking for simple example open an SF2 go through patches and modify patch name integrating bank and prog into name

Hi,

First of all I would make a great compliment to John. This project is really great work. Well modularized and I see there a big poential to become a widely used development framework which could be used for many purposes. Unfortunately there is currently apart of the reference manuals not much example code around for using libinstpatch. I hope with this new forum this will change soon. I would be glad to contribute examples to the community as soon as I'm more familiar with the library. However, now my first use case:

Bounderies:

There are sampler like E-Mu Emulator X.., Gigasampler which strongly supports  MIDI Bank / Program Change storage and controls and are therefore easy to configure as GM Midiplayer. Other like Native Instruments Kontakt are more difficult to get act as at least at very basic GM player. One simple approach for Kontakt Sampler is to configure all the 128 GM presets on all 16 Midi Channels (CH 10 of course for Drumkit). This work would now be much easier if the GM instrument names would be start with bank:patchnumer in the name itself. For example instead of 'Grand Piano' '000:000 Grand Piano' . If a SF2 GM Soundfont is prepared this way, it would be much easier in Ni Kontakt then the do the correct alignments to the presets.If strated doing this manually with Vienna (Synthfont), Awave Studio, but have seen, that even this manual operation is much faster with Swami todo (working with the property tab in Swami is much performanter then the patch name editing in Vienna or AWave Studio).  But as there is the opportunity with Swami/libinstpatch I want go a step further and create a c-prog as well as a python script for the same.

First I would start with a python script. I searched therefore through the codes of the patchesdb for example code snipplets and found the extracted the following lines to start my code:

import ipatch

patchFileName = "gm.sf2"

file = ipatch.ipatch_file_identify_open (patchFileName, 'r')

But already on this first beginning I get the error:

tomotello@wst4410a ~/sources/libinstpatch/examples$ python t.pyTraceback (most recent call last):  File "t.py", line 29, in <module>    file = ipatch.ipatch_file_identify_open (patchFileName, 'r')AttributeError: 'module' object has no attribute 'ipatch_file_identify_open'

My first assumption was, I've done something wrong with the installation, missing library path etc and tried it on another fresh Ubuntu Lucid 10.04.2  installation with the PPA packages as well as on a from source code compiled version on Cygwin on Windows 7. But same error there.

Any help would be highly appreciated.

Best regards, tomotello (Thomas)