Re: Control over midi output

2018-12-04 Thread Tyler Mitchell
On Tue, Dec 04, 2018 at 09:33:44AM -0500, Mr Tim wrote:
> Hi all,  I'm trying to use Lilypond to create midi files to be played by an
> organ and I'm having difficulty getting it formatted the way it needs to be.

I've had a fair bit of success recently with midicsv and csvmidi:

https://www.fourmilab.ch/webtools/midicsv/

It can produce MIDI format 0 files, though you'll have to do some
transmogrification of the CSV to merge it all onto one track.

You can reassign which channel is used for note events, and should
be able to introduce program change events and system exclusive
events also.

Cheers,
Tyler

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Control over midi output

2018-12-04 Thread David Kastrup
Mr Tim  writes:

> Hi all,  I'm trying to use Lilypond to create midi files to be played by an
> organ and I'm having difficulty getting it formatted the way it needs to be.
>
> 1) The midi file needs to be type 0 (everything in one track--the first
> one). This is very common for driving instruments since it's simpler and
> cost less to develop.
>
> 2) I'm looking to control which channels are used instead of having
> Lilypond assign them.  The note events will be in the first 4 channels, but
> I will not always create sequential channels.  I may just want all the note
> events in channel 2, or maybe just 1 and 4.
>
> These first 2 items will get me pretty far but I will still need to do one
> a couple more things:
>
> 3) I need to send program (instrument/patch) change events on channel 11
> which controls the organ stops.  No notes will be on 11, just the program
> changes.
>
> 4) I need to be able to embed a Sysex command at the beginning and end of
> the file which tells the organ to clear all stops.

LilyPond is not suitable for that kind of fine control over Midi
generation.  Try post-processing the Midi with a program intended for
that kind of manipulation.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Control over midi output

2018-12-04 Thread Mr Tim
Hi all,  I'm trying to use Lilypond to create midi files to be played by an
organ and I'm having difficulty getting it formatted the way it needs to be.

1) The midi file needs to be type 0 (everything in one track--the first
one). This is very common for driving instruments since it's simpler and
cost less to develop.

2) I'm looking to control which channels are used instead of having
Lilypond assign them.  The note events will be in the first 4 channels, but
I will not always create sequential channels.  I may just want all the note
events in channel 2, or maybe just 1 and 4.

These first 2 items will get me pretty far but I will still need to do one
a couple more things:

3) I need to send program (instrument/patch) change events on channel 11
which controls the organ stops.  No notes will be on 11, just the program
changes.

4) I need to be able to embed a Sysex command at the beginning and end of
the file which tells the organ to clear all stops.

I've tried using the midi channel mapping. It ended up still type 1 file,
setting all the note events to channel 0, and using the channel prefix
(incorrectly) at the beginning of the track to set the channel which would
not help even if it worked correctly.  By incorrectly, I mean it's sending
the meta event 0xFF 0x21 0x01 followed by the channel number.  It should be
0xFF 0x20 0x01... according to the MIDI spec.  anyway, it would not work as
I said since I need type 0 which sinks that ship at the dock. Not to
mention the organ may not even accept that meta event since it doesn't
record that way.

Any ideas?
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Use String to reference Variable

2018-12-04 Thread David Kastrup
Jan-Peter Voigt  writes:

> Hello Pedro,
>
> Am 04.12.18 um 04:28 schrieb Pedro Pessoa:
>> Hello!
>> I want a function that takes a string as arg an from that produces a valid
>> variable reference, as follows:
>> 
>> %%% pseudo 
>> Nabc={a1 d e f}
>> Nxyz={b1 e a d}
>> 
>> fun=
>> #(define-music-function (x)(string?)
>>#{
>>  <<
>>#(concat x "abc")
>>\\
>>#(concat x "xyz")
>>  >>
>>#})
>> 
>> \fun "N" %produces parallel music with Nabc and Nxyz
>> %%%
>> 
>> ---
>> 
>> I've ran this test:
>> 
>> %%%
>> \Nabc={some music}
>> (display (string->symbol (string-append "N" "abc")))
>> %%%
>> 
>> It outputs "Nabc", not the music content of Nabc, as I expected.
>> Why is that? How do I make it point to the actual music?
> The string is converted to a symbol and a symbol is a primitive datatype
> in guile-scheme. To receive the value of the variable you have to ask
> the parser. To place the result in the music you should use an instant
> scheme expression (introduced by '$' not '#').
>
> HTH:
>
> fun=
> #(define-music-function (x)(string?)
>#{
>  <<
>$(ly:parser-lookup (string->symbol (string-append x "abc")))
>\\
>$(ly:parser-lookup (string->symbol (string-append x "xyz")))
>  >>
>#})

In this particular case, # would have worked though $ tends to work in
more cases.  However, $ also creates a _copy_ of the music while #
doesn't.  If the music ends up in a \relative or \transpose or other
construct modifying its content in place, having a copy is important so
that the original variable does not get changed.

\xabc creates a copy like $xabc does, while #xabc doesn't.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Use String to reference Variable

2018-12-04 Thread Jan-Peter Voigt
Hello Pedro,

Am 04.12.18 um 04:28 schrieb Pedro Pessoa:
> Hello!
> I want a function that takes a string as arg an from that produces a valid
> variable reference, as follows:
> 
> %%% pseudo 
> Nabc={a1 d e f}
> Nxyz={b1 e a d}
> 
> fun=
> #(define-music-function (x)(string?)
>#{
>  <<
>#(concat x "abc")
>\\
>#(concat x "xyz")
>  >>
>#})
> 
> \fun "N" %produces parallel music with Nabc and Nxyz
> %%%
> 
> ---
> 
> I've ran this test:
> 
> %%%
> \Nabc={some music}
> (display (string->symbol (string-append "N" "abc")))
> %%%
> 
> It outputs "Nabc", not the music content of Nabc, as I expected.
> Why is that? How do I make it point to the actual music?
The string is converted to a symbol and a symbol is a primitive datatype
in guile-scheme. To receive the value of the variable you have to ask
the parser. To place the result in the music you should use an instant
scheme expression (introduced by '$' not '#').

HTH:

fun=
#(define-music-function (x)(string?)
   #{
 <<
   $(ly:parser-lookup (string->symbol (string-append x "abc")))
   \\
   $(ly:parser-lookup (string->symbol (string-append x "xyz")))
 >>
   #})


Jan-Peter

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user