README.org (7506B)
1 #+title: LilyPond Auto Insert 2 #+author: Jamie Beardslee 3 #+email: jdb@jamzattack.xyz 4 5 This package provides a convenient interface to perform [[https://lilypond.org][LilyPond]] 6 auto-insertions in Emacs. 7 8 * Installation 9 10 ** package.el 11 12 Download lilypond-auto-insert.el, and use =M-x package-install-file RET 13 path/to/lilypond-auto-insert.el=. 14 15 ** straight.el 16 17 Evaluate the following: 18 19 #+begin_src emacs-lisp 20 (straight-use-package 21 '(lilypond-auto-insert :type git 22 :repo "git://jamzattack.xyz/lilypond-auto-insert.git")) 23 #+end_src 24 25 ** Manual installation 26 27 1. Download lilypond-auto-insert.el 28 2. Stick it in =load-path= 29 3. Update autoloads 30 4. (optionally) byte-compile it 31 32 * Motivation 33 34 LilyPond is a great way to write music, but its syntax for staves, 35 layout, etc. can be overwhelming at times. The main entry point of 36 this package, ~lilypond-auto-insert~, prompts from a list of 37 predefined instrumentations which is inserted into the buffer. This 38 approach of inserting something close to what's needed and editing it 39 accordingly is often far quicker than writing the whole thing 40 manually. 41 42 * Customization 43 44 ** Variables 45 46 This package provides some variables that adjust the content of the 47 auto-insertions: 48 49 - *Variable*: [[help:lilypond-auto-insert-use-midi-block][lilypond-auto-insert-use-midi-block]] (default =t=) 50 51 Whether or not to insert a midi block. 52 53 - *Variable*: [[help:lilypond-auto-insert-relative][lilypond-auto-insert-relative]] (default =t=) 54 55 Whether or not to use relative syntax. 56 - Type: =boolean= 57 58 - *Variable*: [[help:lilypond-auto-insert-prompt-for-global][lilypond-auto-insert-prompt-for-global]] (default =nil=) 59 60 Whether or not to prompt for the "\global" section. 61 62 If non-nil, you will be prompted for: 63 - key 64 - time signature 65 - tempo 66 67 - *Variable*: [[help:lilypond-auto-insert-language][lilypond-auto-insert-language]] (default =nil=) 68 69 Language used for [[help:lilypond-auto-insert][lilypond-auto-insert]]. 70 71 If nil, no "\language" statement will be added. 72 73 See "(lilypond-notation) Note names in other languages" for the 74 effects of this setting. 75 76 *** Header block 77 78 The header block is an important part of any lilypond document. As 79 such, I have made it very customizable. 80 81 By default, ~lilypond-auto-insert~ will: 82 - Prompt for the title. 83 - Prompt for the composer. 84 - Remove the tagline. 85 86 You can customize the value of ~lilypond-auto-insert-header-alist~ to 87 either: 88 1. Prompt the user 89 2. Use a default string 90 3. Evaluate lisp 91 92 For example, to add a copyright assignment automatically: 93 #+begin_src emacs-lisp 94 (add-to-list 'lilypond-auto-insert-header-alist 95 '("copyright" . (format "\"Copyright (C) %s by %s\"" 96 (format-time-string "%Y") 97 (or user-full-name 98 user-login-name)))) 99 #+end_src 100 101 ** Custom functions 102 103 It is possible to create your own instrumenations simply by defining a 104 function that returns a string, and adding it to 105 ~lilypond-auto-insert-alist~. For example: 106 107 #+begin_src emacs-lisp 108 (defun lilypond-auto-insert-piano-trio () 109 "Create a blank document for piano trio." 110 (mapconcat #'identity 111 (list (lilypond-auto-insert--boilerplate) 112 (lilypond-auto-insert--header) 113 (lilypond-auto-insert-global) 114 (lilypond-auto-insert-instruments "violin" "cello" "top" "bottom") 115 (lilypond-auto-insert-score 116 (lilypond-auto-insert-piano-and-group-staff "violin" "cello"))) 117 "\n")) 118 119 (add-to-list 'lilypond-auto-insert-alist 120 '(lilypond-auto-insert-piano-trio . "Piano Trio")) 121 #+end_src 122 123 ** Auto-inserting automatically 124 125 This package also provides a function to auto-insert if you are 126 visiting an empty buffer. To enable it: 127 128 #+begin_src emacs-lisp 129 (add-hook 'LilyPond-mode-hook 130 #'lilypond-auto-insert-on-empty-buffer) 131 #+end_src 132 133 * Default instrumentations 134 135 These are the current instrumentations: 136 137 (I might add some more in the future, but this is enough for now.) 138 139 ** Solo 140 141 #+begin_src lilypond 142 \version "2.20" 143 144 \header { 145 title = "Title" 146 composer = "Composer" 147 tagline = ##f 148 } 149 150 global = { 151 152 } 153 154 cello = \relative { 155 \global 156 } 157 158 \score { 159 \new Staff { 160 \cello 161 } 162 \midi { } 163 \layout { } 164 } 165 #+end_src 166 167 ** Piano 168 169 #+begin_src lilypond 170 \version "2.20" 171 172 \header { 173 title = "Title" 174 composer = "Composer" 175 tagline = ##f 176 } 177 178 global = { 179 180 } 181 182 top = \relative { 183 \global 184 } 185 186 bottom = \relative { 187 \global 188 } 189 190 \score { 191 \new PianoStaff << 192 \new Staff \top 193 \new Staff \bottom 194 >> 195 \midi { } 196 \layout { } 197 } 198 #+end_src 199 200 ** Piano and Solo Instrument 201 202 #+begin_src lilypond 203 \version "2.20" 204 205 \header { 206 title = "Title" 207 composer = "Composer" 208 tagline = ##f 209 } 210 211 global = { 212 213 } 214 215 flute = \relative { 216 \global 217 } 218 219 top = \relative { 220 \global 221 } 222 223 bottom = \relative { 224 \global 225 } 226 227 \score { 228 << 229 \new Staff { 230 \flute 231 } 232 233 \new PianoStaff << 234 \new Staff \top 235 \new Staff \bottom 236 >> 237 >> 238 \midi { } 239 \layout { } 240 } 241 #+end_src 242 243 ** Choir or Vocal Quartet 244 245 #+begin_src lilypond 246 \version "2.20" 247 248 \header { 249 title = "Title" 250 composer = "Composer" 251 tagline = ##f 252 } 253 254 global = { 255 256 } 257 258 soprano = \relative { 259 \global 260 } 261 262 alto = \relative { 263 \global 264 } 265 266 tenor = \relative { 267 \global 268 } 269 270 bass = \relative { 271 \global 272 } 273 274 \score { 275 \new ChoirStaff << 276 \soprano 277 \alto 278 \tenor 279 \bass 280 >> 281 \midi { } 282 \layout { } 283 } 284 #+end_src 285 286 ** String Quartet 287 288 #+begin_src lilypond 289 \version "2.20" 290 291 \header { 292 title = "Title" 293 composer = "Composer" 294 tagline = ##f 295 } 296 297 global = { 298 299 } 300 301 voilin_one = \relative { 302 \global 303 } 304 305 voilin_two = \relative { 306 \global 307 } 308 309 viola = \relative { 310 \global 311 } 312 313 cello = \relative { 314 \global 315 } 316 317 \score { 318 \new StaffGroup << 319 \voilin_one 320 \voilin_two 321 \viola 322 \cello 323 >> 324 \midi { } 325 \layout { } 326 } 327 #+end_src 328 329 ** Group without Piano 330 331 #+begin_src lilypond 332 \version "2.20" 333 334 \header { 335 title = "Title" 336 composer = "Composer" 337 tagline = ##f 338 } 339 340 global = { 341 342 } 343 344 oboe = \relative { 345 \global 346 } 347 348 violin = \relative { 349 \global 350 } 351 352 cello = \relative { 353 \global 354 } 355 356 \score { 357 << 358 \new Staff { 359 \oboe 360 } 361 362 \new Staff { 363 \violin 364 } 365 366 \new Staff { 367 \cello 368 } 369 >> \midi { } 370 \layout { } 371 } 372 #+end_src 373 374 ** Group with Piano 375 376 #+begin_src lilypond 377 \version "2.20" 378 379 \header { 380 title = "Title" 381 composer = "Composer" 382 tagline = ##f 383 } 384 385 global = { 386 387 } 388 389 violin = \relative { 390 \global 391 } 392 393 cello = \relative { 394 \global 395 } 396 397 top = \relative { 398 \global 399 } 400 401 bottom = \relative { 402 \global 403 } 404 405 \score { 406 << 407 \new Staff { 408 \violin 409 } 410 411 \new Staff { 412 \cello 413 } 414 415 \new PianoStaff << 416 \new Staff \top 417 \new Staff \bottom 418 >> 419 >> 420 \midi { } 421 \layout { } 422 } 423 #+end_src 424 425 ** Four-part Harmony 426 427 #+begin_src lilypond 428 \version "2.20" 429 430 \header { 431 title = "Title" 432 composer = "Composer" 433 tagline = ##f 434 } 435 436 global = { 437 438 } 439 440 soprano = \relative { 441 \global 442 } 443 444 alto = \relative { 445 \global 446 } 447 448 tenor = \relative { 449 \global 450 } 451 452 bass = \relative { 453 \global 454 } 455 456 \score { 457 \new PianoStaff << 458 \new Staff << 459 \soprano 460 \\ 461 \alto 462 >> 463 \new Staff \with { 464 \clef "bass" 465 } 466 << 467 \tenor 468 \\ 469 \bass 470 >> 471 >> 472 \midi { } 473 \layout { } 474 } 475 #+end_src 476 477 * License 478 479 GPL3+