Hello,
I'm a new lilypond user. I want to create multiple scores in a single
file. These scores have some values on common. So I want to use
`define-music-function` in order to avoid repetition.

Here is my code now:
\score {
  \new Staff \with {
    instrumentName = "۱"
  } \one
  \layout { }
}


\book {
  \bookOutputSuffix "1"
  \score {
    \new Staff \with {
      midiInstrument = "piccolo"
    } \one
    \layout { }
    \midi {
      \tempo 4=80
    }
  }
}

\score {
  \new Staff \with {
    instrumentName = "۲"
  } \two
  \layout { }
}

\book {
  \bookOutputSuffix "2"
  \score {
    \new Staff \with {
      midiInstrument = "piccolo"
    } \two
    \midi {
      \tempo 4=80
    }
  }
}

\score {
  \new Staff \with {
    instrumentName = "۳"
  } \three
  \layout { }
}

\book {
  \bookOutputSuffix "3"
  \score {
    \new Staff \with {
      midiInstrument = "piccolo"
    } \three
    \midi {
      \tempo 4=80
    }
  }
}

I tried to make a generator function something like this:
#(define-music-function (make-score instrumentName bookSuffix musicContent) 
(string? string? ly:music?)
   #{
     \score {
      \new Staff \with {
        instrumentName = $instrumentName
      } $musicContent
      \layout { }
    }

    \book {
      \bookOutputSuffix $bookSuffix
      \score {
        \new Staff \with {
          midiInstrument = "piccolo"
        } $musicContent
        \midi {
          \tempo 4=80
        }
      }
    }
   #})

% Usage
make-score "۱" "1" \one
make-score "۲" "2" \two
make-score "3" "3" \three



However I stumbled upon the following error which I can't make a sense
of:
error: syntax error, unexpected STRING, expecting '.' or '='
make-score "۱
             " "1" \one

-- 
Ebrahim Nejati

https://nejati.net
Key: rsa4096/0xDB2CBC2428686000

Reply via email to