Getting Patch names out of a .SF2 file

  • Follow


Greetings.  Newbie question...  So if I have this file, let's say
Ultimate.SF2 for example in /usr/local/share/timidity/, is there a
simple commmand I can run to find out which Patch Names it has in it,
under which Numbers ?  I know they're in there somewhere, because of

$ strings Ultimate.SF2 | less

and there is a list of patch-names at the end...  I did try reading
the SoundFont specification, but fell asleep at about 1% :-(

Any help gratefully received,  Regards, Peter

-- 

Peter Billam,   DPIWE/CIT/Servers,   hbt/lnd/l8,   6233 3061
0
Reply Peter 5/20/2005 5:31:31 AM

Peter
-------------------------------------------------------
You can download "Vienna" for free...

http://soundblaster.com/soundfont/vienna23.zip

With this, you can not only read sf2 files, but make
them, destroy them, change them and generally mess
about with them....
-------------------------------------------------------
DJB



"Peter Billam" <peter@pjb.dpiwe.tas.gov.au> wrote in message 
news:slrnd8r123.18t.peter@pjb.dpiwe.tas.gov.au...
> Greetings.  Newbie question...  So if I have this file, let's say
> Ultimate.SF2 for example in /usr/local/share/timidity/, is there a
> simple commmand I can run to find out which Patch Names it has in it,
> under which Numbers ?  I know they're in there somewhere, because of
>
> $ strings Ultimate.SF2 | less
>
> and there is a list of patch-names at the end...  I did try reading
> the SoundFont specification, but fell asleep at about 1% :-(
>
> Any help gratefully received,  Regards, Peter
>
> -- 
>
> Peter Billam,   DPIWE/CIT/Servers,   hbt/lnd/l8,   6233 3061 


0
Reply DJB 5/20/2005 7:07:11 AM


> "Peter Billam" <peter@pjb.dpiwe.tas.gov.au> wrote in message 
> news:slrnd8r123.18t.peter@pjb.dpiwe.tas.gov.au...
> Greetings.  Newbie question...  So if I have this file, let's say
> Ultimate.SF2 for example in /usr/local/share/timidity/, is there a
> simple commmand I can run to find out which Patch Names it has in it,
> under which Numbers ?  I know they're in there somewhere, because of
> $ strings Ultimate.SF2 | less
> and there is a list of patch-names at the end...  I did try reading
> the SoundFont specification, but fell asleep at about 1% :-(

In article <428d8cbc$0$3858$dbd41001@news.wanadoo.nl>, DJB wrote:
> You can download "Vienna" for free...
> http://soundblaster.com/soundfont/vienna23.zip
> With this, you can not only read sf2 files, but make them,
> destroy them, change them and generally mess about with them....

Unfortunately, vienna isn't portable, it unpacks to a "setup.exe" ...
I'm sorry, I should have made it clearer, this is on linux :-)

Ideally, I'd be looking for something a lot smaller than vienna,
that I can run at the command line ...

-- 

Regards, Peter

Peter Billam,   DPIWE/CIT/Servers,   hbt/lnd/l8,   6233 3061
0
Reply Peter 5/22/2005 9:36:41 PM

Peter Billam wrote in news:slrnd8r123.18t.peter@pjb.dpiwe.tas.gov.au:
> Greetings.  Newbie question...  So if I have this file, let's say
> Ultimate.SF2 for example in /usr/local/share/timidity/, is there a
> simple commmand I can run to find out which Patch Names it has in it,
> under which Numbers ?  I know they're in there somewhere, because of
> $ strings Ultimate.SF2 | less
> and there is a list of patch-names at the end...  I did try reading
> the SoundFont specification, but fell asleep at about 1% :-(

In SoundFont, they're called Presets, not Patches.
I found a better SoundFont spec at http://myfileformats.com/search.php
 
In article <428d8cbc$0$3858$dbd41001@news.wanadoo.nl>, DJB wrote:
> You can download "Vienna" for free...
> http://soundblaster.com/soundfont/vienna23.zip
> With this, you can not only read sf2 files, but make them,
> destroy them, change them and generally mess about with them....
 
In article <slrnd922bp.2h2.peter@pjb.dpiwe.tas.gov.au>, Peter Billam wrote:
> Unfortunately, vienna isn't portable, it unpacks to a "setup.exe" ...
> I'm sorry, I should have made it clearer, this is on linux :-)
> Ideally, I'd be looking for something a lot smaller than vienna,
> that I can run at the command line ...
 
Treating the SoundFont as a RIFF file and using the Perl module
File::Format::RIFF (see http://search.cpan.org) to read it,
I got a little perl script together to get at the PHDR subchunk ...

  #! /usr/bin/perl
  use File::Format::RIFF;
  open(IN, $ARGV[$[]) or die "Could not open $ARGV[$[]: $!\n";
  my $riff1 = File::Format::RIFF->read(\*IN);
  close(IN);  # $riff1->dump;
  my $pdta = $riff1->at($[+2);  # $pdta->dump;
  my $phdr = $pdta->at(0);
  my $data = $phdr->data;
  print "Preset Bank  PresetName\n";
  while ($data) {
     my $chunk = substr $data,$[,38,'';
     my $name = substr $chunk,$[,20,'';
     my ($preset,$bank) = unpack 'SS', $chunk;
     $name =~ tr/ 0-9a-zA-Z_//cd;
     printf "%5d %5d %s\n", $preset, $bank, $name;
  }

This doesn't yet sort output by bank and preset-number ...
OTOH, it is portable :-)

Hope this is useful to other folks as well as me,  Regards, Peter

-- 

Peter Billam,   DPIWE/CIT/Servers,   hbt/lnd/l8,   6233 3061
0
Reply Peter 5/23/2005 10:24:04 PM

3 Replies
196 Views

(page loaded in 0.084 seconds)

5/21/2013 3:39:15 PM


Reply: