lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Geting the list of MIDI instrument names


From: Ralf Mattes
Subject: Re: Geting the list of MIDI instrument names
Date: Tue, 19 Feb 2008 17:37:10 +0000 (UTC)
User-agent: pan 0.120 (Plate of Shrimp)

On Tue, 19 Feb 2008 17:31:41 +0100, Reinhold Kainhofer wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Am Dienstag, 19. Februar 2008 schrieb Wilbert Berendsen:
>> I'm looking for a stable way to get the list of supported MIDI instrument
>> names from LilyPond, by running lilypond -e with a scheme expression to do
>> just that (and not print a regular ps/pdf file).
> 
> Unfortunately, in midi.scm the instrument-names-alist is not 
> define-public'ed, 
> so by default you don't have access to that list... If you change the define 
> to define-public, you can simply do (the mapping of the lambda function is 
> simply to get line breaks and quotes around the strings, otherwise you'll get 
> a space-delimited list without quotes, where unfortunately the elements also 
> contain spaces...):
> 
> lilypond -e '(map (lambda (x) (display (format "~s~%" (car x)))) 
> instrument-names-alist)'
>

My version :-)

\version "2.10.33"

#(ly:load "midi.scm")
#(map (lambda (entry)
         (format #t "~A\t'~A'\n" (cdr entry) (car entry))) 
  instrument-names-alist)


BTW, I think there is a bug in your invocation of 'format - the stream
parameter is missing. And you don't need 'display, #t as a stream
designator resolves to (current-output-port). Substitute #t with 
(current-error-port) to send the list to standard error.

 HTH Ralf Mattes

> Cheers,
> Reinhold
> 
> - --
> - ------------------------------------------------------------------
> Reinhold Kainhofer, Vienna University of Technology, Austria email:
> address@hidden, http://reinhold.kainhofer.com/
>  * Financial and Actuarial Mathematics, TU Wien,
>  http://www.fam.tuwien.ac.at/ * K Desktop Environment,
>  http://www.kde.org, KOrganizer maintainer * Chorvereinigung
>  "Jung-Wien", http://www.jung-wien.at/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> 
> iD8DBQFHuwRxTqjEwhXvPN0RAjP3AJ9VYdqM3UIxMvHsUxGB47GhfWnmzwCgmc6f
> w11DX2VWNXyeCbr90bXF7hg=
> =qc7i
> -----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]