Re: MIDI remapping

2011-01-26 Thread c.m.bryan
Dear Benkő and list,

Your example of comma tuning was indeed the ticket I needed!!  I knew
about the makam example in the lilypond manual for ages, but it didn't
click in my brain that it was actually specifying the pitch bends in
the midi output, and that I could tie any glyphs to any pitch shifts I
wanted.  WOW :)

I've adapted your file to 31 equal temperament. (The files are
attached for anyone who is interested.)  The only bug I have is that
is seems to be adding naturals to notes as if they were alterations
(i.e. with no key signature, a 'c' is typeset with a natural sign next
to it.)  I suppose I need to go to lilypond-user if I need help with
that, but if anyone wants to let me know if I've missed something
obvious, please do.

Now... I assume that the midi is still being handled with pitch bends.
 Any chance that it will work with the MIDI tuning standard anytime
soon?  Pretty please?  ;)


On 22 January 2011 16:45, Benkő Pál benko@gmail.com wrote:
 I am wondering if there is a way to hack the source to change the midi
 pitch values which are output when it renders.  I want to do this so
 that I can remap those values to arbitrary frequencies for microtonal
 playback in a retunable software synth like puredata.

 I hope the attachment can give a start.
 I use it for generating pythagorean or meantone tuning,
 by defining komma to
 #(define komma -349/1700)
 for meantone or
  #(define komma 139/1185)
 for pythagorean.

 p

\version 2.12.3

\include thirtyonetones.ly

\score {
  \relative c' {
\time 4/4
%{adf4 bdf cdf ddf edf fdf gdf
asqf, bsqf csqf dsqf esqf fsqf gsqf
af, bf cf df ef ff gf
asf, bsf csf dsf esf fsf gsf
a, b c d e f g
ass, bss css dss ess fss gss
as, bs cs ds es fs gs
asqs, bsqs csqs dsqs esqs fsqs gsqs
ax, bx cx dx ex fx gx
%}

a8 ass as asqs ax
b bss bs
c css cs csqs cx
d dss ds dsqs dx
e ess es
f fss fs fsqs fx
g gss gs gsqs gx
a

r1

%Why the unnecessary accidentals?
c4 d e f
c d e f


  }
  \midi {}
  \layout {}
}\version 2.12.3

%our maximum is 100 cents, or half of a 12et tone
#(define-public MAX_SHIFT (/ -1 2))

%define accidental shifts (for midi) as a fraction of a 12et tone
#(define-public SEMISHARP (/ (/ 1200 31) 200))
#(define-public SEMIFLAT (* -1 SEMISHARP))
#(define-public SHARP (* 2 SEMISHARP))
#(define-public FLAT (* 2 SEMIFLAT))
#(define-public SESQUISHARP (* 3 SEMISHARP))
#(define-public SESQUIFLAT (* 3 SEMIFLAT))
#(define-public DOUBLESHARP (* 4 SEMISHARP))
#(define-public DOUBLEFLAT (* 4 SEMIFLAT))

thirtyonePitchNames = #`(
  (c . ,(ly:make-pitch -1 0 (* -3/31 MAX_SHIFT)))
  (d . ,(ly:make-pitch -1 1 (* -1/31 MAX_SHIFT)))
  (e . ,(ly:make-pitch -1 2 (* 1/31 MAX_SHIFT)))
  (f . ,(ly:make-pitch -1 3 (* -4/31 MAX_SHIFT)))
  (g . ,(ly:make-pitch -1 4 (* -2/31 MAX_SHIFT)))
  (a . ,(ly:make-pitch -1 5 0))
  (b . ,(ly:make-pitch -1 6 (* 2/31 MAX_SHIFT)))

  (css . ,(ly:make-pitch -1 0 (+ SEMISHARP (* -3/31 MAX_SHIFT
  (dss . ,(ly:make-pitch -1 1 (+ SEMISHARP (* -1/31 MAX_SHIFT
  (ess . ,(ly:make-pitch -1 2 (+ SEMISHARP (* 1/31 MAX_SHIFT
  (fss . ,(ly:make-pitch -1 3 (+ SEMISHARP (* -4/31 MAX_SHIFT
  (gss . ,(ly:make-pitch -1 4 (+ SEMISHARP (* -2/31 MAX_SHIFT
  (ass . ,(ly:make-pitch -1 5 (+ SEMISHARP 0)))
  (bss . ,(ly:make-pitch -1 6 (+ SEMISHARP (* 2/31 MAX_SHIFT

  (csf . ,(ly:make-pitch -1 0 (+ SEMIFLAT (* -3/31 MAX_SHIFT
  (dsf . ,(ly:make-pitch -1 1 (+ SEMIFLAT (* -1/31 MAX_SHIFT
  (esf . ,(ly:make-pitch -1 2 (+ SEMIFLAT (* 1/31 MAX_SHIFT
  (fsf . ,(ly:make-pitch -1 3 (+ SEMIFLAT (* -4/31 MAX_SHIFT
  (gsf . ,(ly:make-pitch -1 4 (+ SEMIFLAT (* -2/31 MAX_SHIFT
  (asf . ,(ly:make-pitch -1 5 (+ SEMIFLAT 0)))
  (bsf . ,(ly:make-pitch -1 6 (+ SEMIFLAT (* 2/31 MAX_SHIFT

  (cs . ,(ly:make-pitch -1 0 (+ SHARP (* -3/31 MAX_SHIFT
  (ds . ,(ly:make-pitch -1 1 (+ SHARP (* -1/31 MAX_SHIFT
  (es . ,(ly:make-pitch -1 2 (+ SHARP (* 1/31 MAX_SHIFT
  (fs . ,(ly:make-pitch -1 3 (+ SHARP (* -4/31 MAX_SHIFT
  (gs . ,(ly:make-pitch -1 4 (+ SHARP (* -2/31 MAX_SHIFT
  (as . ,(ly:make-pitch -1 5 (+ SHARP 0)))
  (bs . ,(ly:make-pitch -1 6 (+ SHARP (* 2/31 MAX_SHIFT

  (cf . ,(ly:make-pitch -1 0 (+ FLAT (* -3/31 MAX_SHIFT
  (df . ,(ly:make-pitch -1 1 (+ FLAT (* -1/31 MAX_SHIFT
  (ef . ,(ly:make-pitch -1 2 (+ FLAT (* 1/31 MAX_SHIFT
  (ff . ,(ly:make-pitch -1 3 (+ FLAT (* -4/31 MAX_SHIFT
  (gf . ,(ly:make-pitch -1 4 (+ FLAT (* -2/31 MAX_SHIFT
  (af . ,(ly:make-pitch -1 5 (+ FLAT 0)))
  (bf . ,(ly:make-pitch -1 6 (+ FLAT (* 2/31 MAX_SHIFT

  (csqs . ,(ly:make-pitch -1 0 (+ SESQUISHARP (* -3/31 MAX_SHIFT
  (dsqs . ,(ly:make-pitch -1 1 (+ SESQUISHARP (* -1/31 MAX_SHIFT
  (esqs . ,(ly:make-pitch -1 2 (+ SESQUISHARP (* 1/31 MAX_SHIFT
  (fsqs . ,(ly:make-pitch -1 3 (+ SESQUISHARP (* -4/31 MAX_SHIFT
  (gsqs . ,(ly:make-pitch -1 4 (+ SESQUISHARP (* -2/31 MAX_SHIFT
  (asqs . 

Re: MIDI remapping

2011-01-25 Thread c.m.bryan
 I guess you are aware that Denemo (the GUI front end to LilyPond) has
 commands to control the pitch frequencies in its MIDI output? The last
 release has an example of playing back in quarter comma meantone with a
 shift from A-sharp to B-flat during the course of the piece.

Yes... unfortunately I don't happen to like the GUI very much though!
I may explore it more if I don't find a more elegant solution though,
thanks.

-Chris

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


MIDI remapping

2011-01-24 Thread c.m.bryan
Apologies for repeating my original message.  I just subscribed and
thought that the first one didn't go through!

-Chris

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


MIDI remapping

2011-01-23 Thread c.m.bryan
Hi everyone, I know the lilypond's main purpose isn't midi playback.  HOWEVER :)

I am wondering if I can hack the source so that I can change what midi
pitch values are output when it renders.  This is so that I can retune
the output with a software synth like csound or pd.

For instance, I would like the following sequence of notes:

c cih cis des deh d

to send to the midi file the following pitch values:

60 61 62 63 64 65

or something like that.  The specific values don't really matter:  I
just need *discrete* values without enharmonic equivalents, since the
synth can map those to any pitches I like!  I'm not too familiar with
lilypond's internals, but I do have a rusty programming background.
Could someone tell me if this is a monumental undertaking, and if not
where I should begin looking through the source?

Many thanks

Chris

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


MIDI remapping

2011-01-22 Thread c.m.bryan
Hi, I have an interesting question.  I know lilypond is not really
meant for playback.  HOWEVER :)

I am wondering if there is a way to hack the source to change the midi
pitch values which are output when it renders.  I want to do this so
that I can remap those values to arbitrary frequencies for microtonal
playback in a retunable software synth like puredata.

For example, say I wanted to remap the following note names:
c cis des d
so that when it is compiled, the following midi pitch values will be written:
60 61 62 63
or perhaps:
60 60.67 61.33 62

or whatever.  It really doesn't matter, since pd can map those to any
frequency I like!  All I really need is to set discrete values for
*each* accidental (no enharmonic equivalents) and 'white notes'.
Octave doubling is fine.

I don't know anything about pd's internals, but I have some rusty
programming knowledge.  I would just like to know if such a thing
would be possible, and if so, where I should start looking.  Thanks so
much!

-Chris Bryan

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


midi output bug?

2006-02-06 Thread c.m.bryan
Hello everyone,

I've been trying to use lilypond to render midi files which I can then
retune with a program called scala
(http://www.xs4all.nl/~huygensf/scala/).

The midi file which lilypond gives me seems ok, and is playable by
timidity, but scala chokes on it and gives me an error.  I talking
with a scala developer, he seemed to have pinpointed a problem with
the midi file output from scala.  He said:

It turns out Scala is right, your midi file is wrong.
There's an unexpected running status inside. So you may
have to report a bug for Lilypond.

Do you know what that unexpected running status could be? You can
check out the midi file here:

cmbryan.com/score_midi.midi

The strangest part is that I've had success with this procedure
before, so something has changed, maybe in a lilypond upgrade?  Any
help would be appreciated!

Thanks in advance,

-chris


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: midi output bug?

2006-02-06 Thread c.m.bryan
 4d 54 72 6b // = MTrk
 00 00 00 40 // = chunk length (64)
 00 0f f5 80 43 e8 02 12 08  // = probably fscked up time signature

 A midi time signature would look like

 00 ff 58 04 04 02 18 08

 Well, if you suspect that it might be an old version, how about telling us
 which one you use? And if it is not too much hassle, could you provide a
 sample .ly file which produces such a midi?

My apologies for not giving that information!

I'm using version 2.4.5 on fedora core 3 linux, because it's the
latest binary provided by Planet CCRMA, and I haven't had the time to
wrestle with the source.

And the .ly is below.  The \include statements are note lists with no
extra commands.  I did a crazy-long time sig because I couldn't
remember the cadenza command, and it was just a quick sketch.  Maybe
that's the problem...

Thanks for the help.

-

\version 2.4.2

#(set-global-staff-size 16)

flat = \markup { \raise #0.4 \smaller \musicglyph #accidentals--2 }
sharp = \markup { \raise #0.6 \smaller \musicglyph #accidentals-2 }
textcodaysym = \markup { \hspace #1 \raise #1.1 \musicglyph #scripts-coda}

StaffA = \relative c' {
\time 1000/4
\include StaffA_retuned.ly
}
StaffB = \relative c' {
\time 1000/4
\include StaffB_retuned.ly
}

\score {
\simultaneous {
\set Score.skipBars = ##t
\set Score.melismaBusyProperties = #'()
\context Staff=StaffA \StaffA
\context Staff=StaffB \StaffB
}
\layout {
linewidth = 170.000 \mm
textheight = 250.000 \mm
}
\midi { \tempo 4=55 }
}


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: midi output bug?

2006-02-06 Thread c.m.bryan
 P.S.: I fixed the two instances of the time signature in your midi file,
 and since it is so small attached it.

That did it!!

No more 1000/4 for me ;)  Sorry for not suspecting that before, but I
don't know a lot about midi files, and I wasn't aware that they
contained meter information.

Thanks a bunch!

-chris


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel