Re: MIDI remapping
Your example of comma tuning was indeed the ticket I needed!! great to hear! I've adapted your file to 31 equal temperament. (The files are attached for anyone who is interested.) I don't know whether it's common knowledge, but I notate the 31-step octave with conventional accidentals: c deses cis des cisis d ... in meantone it's quite close to 31-equal, much closer than c cis d ... is to 12-equal. 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. it's logical, but ugly: Lilypond doesn't print an accidental if the pitch is not changed, but our examples change all pitches except a (and it's just a weird thing that this change is marked by a natural). p ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
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
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
Re: MIDI remapping
On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan wrote: 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 Personally I would like lily to have much more sophisicated midi capabilities. For instance It would be nice if markup could be tied to program change events so, for instance, markup like pizz could not only be printed in the score but also change the midi instrument. It would also be nice if things like staccatto were renereabl in midi, and, perhaps tunable. 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! I don't think this can be done from lily at the moment. I too have some rusty programming knowledge. In the mid 80's I wrote some Z80 assembler code to control a midi interface. So I would be quite interested in a re-write of the lily midi code. But I am not sure how many people would be interested. /Bernard ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan 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. No. The MIDI standard does not support fractional values. You could export the pitches+durations as text output using the event listener code. (search the mailing list archives for this; the last I saw of it was Reinhold or Han-Wen, from a month or two ago. Unfortunately nobody's added this to LSR yet. :( For example, say I wanted to remap the following note names: c cis des d Amusingly, my lab (Center for Music Technology at the University of Glasgow) recently did a few projects with 19-ET. That was before I arrived, though, so I've only heard bits and pieces of it. If you google for Graham Hair or rosegarden codicil or the lab name, you can find more info. I'm actually vaguely involved in porting their old rosegarden branch into the new version. The main focus of that branch is a pitch tracker for 19-tone ET, but they added a bit to the basic infrastructure of rosegarden. We're getting ready to merge this with the main trunk, but if you're impatient you could check out the rosegarden glasgow 2009 pitch tracker branch. 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. If you're playing this in pd, then maybe a text file created from the event listener would be the best bet. Cheers, - Graham ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
On Sat, 2011-01-22 at 12:00 -0500, lilypond-devel-requ...@gnu.org 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 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. Richard Shann ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
On Sat, 22 Jan 2011 12:09:26 + Bernard Hurley bern...@marcade.biz wrote: On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan wrote: Hi, I have an interesting question. I know lilypond is not really meant for playback. HOWEVER :) Personally I would like lily to have much more sophisicated midi capabilities. Me too. For instance It would be nice if markup could be tied to program change events so, for instance, markup like pizz could not only be printed in the score but also change the midi instrument. It would also be nice if things like staccatto were renereabl in midi, and, perhaps tunable. This isn't as hard as it seems from a programming standpoint. Although I am still learning the internals of lilypond (and haven't had much time of late), I did write a skeleton Expression_performer (MIDI CC 11) that handles expression spanner events for kicks (not committed or committable but was a great learning experience). It takes a bit of digging but the programmers' reference and previous threads[1][2] and of course, hours of source-code study were invaluable to me. For program changes (as with expression), I'm pretty sure you would need to get into c++ down to the Audio_Event level (doxygen documentation was also a major help in understanding class hierarchy) and then work your way back up to the scheme and lily init levels. There is also articulate[2] which is a good starting point for scheme development, but again, I think the program changes would need to be implemented at the c++ core level (I could be wrong and more knowledgeable folks should correct me). [1] http://www.mail-archive.com/lilypond-devel@gnu.org/msg32077.html [2] http://www.mail-archive.com/lilypond-devel@gnu.org/msg32380.html [3] http://www.nicta.com.au/people/chubbp/articulate David PS Although intercepting 'pizz' and 'marcato' etc are interesting, I, personally would much rather see a special MIDI syntax coupled with a special voice context (controller lane in DAW parlance). Like this: \new MidiStaff \new Voice { c1\ f1\! } \new MidiControlVoice { \set MidiControlVoice.midiProgChange 'violin' \set MidiControlVoice.midiVolume #101 \set MidiControlVoice.midiExpression #64 % sequence of CC 11 events spanning a measure m1\midiExpressionSpanner { start end curveType } } 'm' is just a placeholder to attach stream positional information. But with most continuous controllers, expression, modulation, pitch-bend etc, you will want to span and each spanner would need start, end and curveType parameters, at the least -- maybe even density. Sorry for rambling / brainstorming ... ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
Hello, On Sat, 2011-01-22 at 15:08 -0500, David Santamauro wrote: On Sat, 22 Jan 2011 12:09:26 + Bernard Hurley bern...@marcade.biz wrote: On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan wrote: Hi, I have an interesting question. I know lilypond is not really meant for playback. HOWEVER :) Personally I would like lily to have much more sophisicated midi capabilities. Me too. This isn't as hard as it seems from a programming standpoint. Although I am still learning the internals of lilypond (and haven't had much time of late), I did write a skeleton Expression_performer (MIDI CC 11) that handles expression spanner events for kicks (not committed or committable but was a great learning experience). It takes a bit of digging but the programmers' reference and previous threads[1][2] and of course, hours of source-code study were invaluable to me. Thanks for the threads For program changes (as with expression), I'm pretty sure you would need to get into c++ down to the Audio_Event level (doxygen documentation was also a major help in understanding class hierarchy) and then work your way back up to the scheme and lily init levels. Looks like that's what I'll have to do, but I'll have to get used to the code first. There is also articulate[2] which is a good starting point for scheme development, but again, I think the program changes would need to be implemented at the c++ core level (I could be wrong and more knowledgeable folks should correct me). Articulate looks very interesting! PS Although intercepting 'pizz' and 'marcato' etc are interesting, I, personally would much rather see a special MIDI syntax coupled with a special voice context (controller lane in DAW parlance). Like this: \new MidiStaff \new Voice { c1\ f1\! } \new MidiControlVoice { \set MidiControlVoice.midiProgChange 'violin' \set MidiControlVoice.midiVolume #101 \set MidiControlVoice.midiExpression #64 % sequence of CC 11 events spanning a measure m1\midiExpressionSpanner { start end curveType } } 'm' is just a placeholder to attach stream positional information. But with most continuous controllers, expression, modulation, pitch-bend etc, you will want to span and each spanner would need start, end and curveType parameters, at the least -- maybe even density. Sorry for rambling / brainstorming ... It gives me something to think about! Cheers /Bernard ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
On 1/22/11 5:09 AM, Bernard Hurley bern...@marcade.biz wrote: On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan wrote: 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 It seems like this should be possible, but I haven't worked with the code at all. Personally I would like lily to have much more sophisicated midi capabilities. For instance It would be nice if markup could be tied to program change events so, for instance, markup like pizz could not only be printed in the score but also change the midi instrument. It would also be nice if things like staccatto were renereabl in midi, and, perhaps tunable. Yes, that would be wonderful. 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. If all you need to do is is set cis to be a different pitch from des, that's quite easy. I think that all you need to do is set different alterations in the file lily/pitch.cc. Of course, you will need to be able to compile lilypond to do this. 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! I don't think this can be done from lily at the moment. I too have some rusty programming knowledge. In the mid 80's I wrote some Z80 assembler code to control a midi interface. So I would be quite interested in a re-write of the lily midi code. But I am not sure how many people would be interested. I think that improved MIDI output is one of the most-requested enhancements for LilyPond. There would be *lots* of people interested in better MIDI. If you were interested and willing to take it over, that would be great. The problem is that right now, nobody is a champion for MIDI output. Thanks, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: MIDI remapping
On Sat, 2011-01-22 at 18:37 -0700, Carl Sorensen wrote: On 1/22/11 5:09 AM, Bernard Hurley bern...@marcade.biz wrote: On Sat, Jan 22, 2011 at 10:34:29AM +, c.m.bryan wrote: Hi, I have an interesting question. I know lilypond is not really meant for playback. HOWEVER :) snip snip In the mid 80's I wrote some Z80 assembler code to control a midi interface. So I would be quite interested in a re-write of the lily midi code. But I am not sure how many people would be interested. I think that improved MIDI output is one of the most-requested enhancements for LilyPond. There would be *lots* of people interested in better MIDI. If you were interested and willing to take it over, that would be great. The problem is that right now, nobody is a champion for MIDI output. Yes I would be interested in this. C++, scheme and Python aren't a problem for me but I've not used git or Rietveld before, but it doesn't look like there's anything very difficult there and I guess there are plenty of people who will help if I get stuck. The main thing for the moment will be getting to know the lily code. Cheers /Bernard ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel