[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Microtonal midi output
From: |
Jean Abou Samra |
Subject: |
Re: Microtonal midi output |
Date: |
Sat, 8 May 2021 23:19:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Le 08/05/2021 à 20:33, brahim.pro a écrit :
Hello,
I would like to define a scale, let's say A minor, and slightly change
the frequency of the notes in the output MIDI file. I have trouble
finding this feature in the documentation. So does this feature exist
and how to do that?
Thanks,
Brahim
Hello,
You can always implement it in Scheme... Something like this,
tampering with the pitches:
\version "2.22.0"
tuneMIDI =
#(define-music-function (scale music) (list? ly:music?)
(for-some-music
(lambda (m)
(let ((pitch (ly:music-property m 'pitch)))
(if (ly:pitch? pitch)
(let* ((tones (ly:pitch-tones pitch))
(r (ly:moment-main
(ly:moment-mod
(ly:make-moment tones 0)
(ly:make-moment 6 0))))
(offset (assv-ref scale r)))
(ly:message "~s" r)
(if offset
(let* ((transpose-pitch (ly:make-pitch 0 0 offset))
(new-pitch (ly:pitch-transpose pitch
transpose-pitch)))
(ly:music-set-property! m 'pitch new-pitch)
#t)
#f))
#f)))
music)
music)
myNotes = \relative { a b c d e f gis a b c d e f gis a }
{ \myNotes }
\score {
\tuneMIDI
#'(
; Lower F (5/2 tones above C) by 1/10 tone.
(5/2 . -1/10)
; Raise G# by 1/10 tone.
(4 . 1/10)
)
\myNotes
\midi { }
}
Note how this requires separating out MIDI generation in
a dedicated \score block.
I was told that my email client inserts non-breaking
spaces in my code examples. If this happens and you
can't compile the file, please use the attachment.
Best,
Jean
midi-frequency.ly
Description: Text Data
- Microtonal midi output, brahim.pro, 2021/05/08
- Re: Microtonal midi output,
Jean Abou Samra <=
- Re: Microtonal midi output, Kieren MacMillan, 2021/05/08
- Re: Microtonal midi output, Lukas-Fabian Moser, 2021/05/08
- Re: Microtonal midi output, Kieren MacMillan, 2021/05/09
- Re: Microtonal midi output, Lukas-Fabian Moser, 2021/05/09
- Re: Microtonal midi output, Kieren MacMillan, 2021/05/09
- Re: Microtonal midi output, Lukas-Fabian Moser, 2021/05/09