lilypond-user
[Top][All Lists]
Advanced

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

Transform notes in a variable?


From: Craig Comstock
Subject: Transform notes in a variable?
Date: Sun, 1 Aug 2021 19:27:11 -0500

Related to my other question of note names I am wondering if it is possible to maybe write a mapping function of some sort for pitches?

I know there is transpose like shown here: https://lilypond.org/doc/v2.22/Documentation/web/text-input

\transpose f c' \hornNotes

What I need, I think, is a way to write a “riff” let’s say and then transform it differently for different parts/instruments each of which would have a static mapping from the notes in the riff to the notes in the different parts.

\version "2.20.0"
riff = { c' r d' r }
<<
  \new Staff \riff
% \new Staff \transformOne \riff
  \new Staff { e' r g'' r }
% \new Staff \transformTwo \riff
  \new Staff { g'' r a'' r }
>>

Where transformOne would map c’ to say e’ and d’ to g’’. TransormTwo would map c’ to g’’ and d’ to a’’.

I put what I would like to write in comments and what it would look like after.

Writing the mapping function in scheme is fine I suppose. Or maybe some data structure like a map given to a single scheme function?


reply via email to

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