OLD | NEW |
1 % | 1 % |
2 % Copyright (C) 2008, 2009, 2010, 2011 NICTA | 2 % Copyright (C) 2008, 2009, 2010, 2011 NICTA |
3 % Author: Peter Chubb <peter.chubb AT nicta.com.au> | 3 % Author: Peter Chubb <peter.chubb AT nicta.com.au> |
4 % $Id: articulate.ly,v 1.7 2011-03-24 00:40:00 peterc Exp $ | 4 % $Id: articulate.ly,v 1.7 2011-03-24 00:40:00 peterc Exp $ |
5 % | 5 % |
6 % | 6 % |
7 % This program is free software; you can redistribute it and/or modify | 7 % This program is free software; you can redistribute it and/or modify |
8 % it under the terms of the GNU General Public License, version 3, | 8 % it under the terms of the GNU General Public License, version 3, |
9 % as published by the Free Software Foundation. | 9 % as published by the Free Software Foundation. |
10 % | 10 % |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 (cond | 387 (cond |
388 ((string= articname "staccato") | 388 ((string= articname "staccato") |
389 (loop ac:staccatoFactor newelements tail actions)) | 389 (loop ac:staccatoFactor newelements tail actions)) |
390 ((string= articname "staccatissimo") | 390 ((string= articname "staccatissimo") |
391 (loop ac:staccatissimoFactor newelements tail actions)) | 391 (loop ac:staccatissimoFactor newelements tail actions)) |
392 ((string= articname "tenuto") | 392 ((string= articname "tenuto") |
393 (loop ac:tenutoFactor newelements tail actions)) | 393 (loop ac:tenutoFactor newelements tail actions)) |
394 ((string= articname "mordent") | 394 ((string= articname "mordent") |
395 (loop (cons 1 1) newelements tail (cons 'mordent actions))) | 395 (loop (cons 1 1) newelements tail (cons 'mordent actions))) |
396 ((string= articname "prall") | 396 ((string= articname "prall") |
397 » (loop (cons 1 1) newelements tail (cons 'trill actions))) | 397 » (loop (cons 1 1) newelements tail (cons 'prall actions))) |
398 ((string= articname "trill") | 398 ((string= articname "trill") |
399 (loop (cons 1 1) newelements tail (cons 'trill actions))) | 399 (loop (cons 1 1) newelements tail (cons 'trill actions))) |
400 ((string= articname "turn") | 400 ((string= articname "turn") |
401 (loop (cons 1 1) newelements tail (cons 'turn actions))) | 401 (loop (cons 1 1) newelements tail (cons 'turn actions))) |
402 (else (loop factor (cons e newelements) tail actions))))) | 402 (else (loop factor (cons e newelements) tail actions))))) |
403 | 403 |
404 ((TextScriptEvent) | 404 ((TextScriptEvent) |
405 (let ((t (ly:music-property e 'text))) | 405 (let ((t (ly:music-property e 'text))) |
406 (if (not (string? t)) | 406 (if (not (string? t)) |
407 (loop factor (cons e newelements) tail actions) | 407 (loop factor (cons e newelements) tail actions) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 'symbol | 509 'symbol |
510 'tempoWholesPerMinute))) | 510 'tempoWholesPerMinute))) |
511 (if (null? (cdr actions)) | 511 (if (null? (cdr actions)) |
512 (make-sequential-music (list pset music)) | 512 (make-sequential-music (list pset music)) |
513 (make-sequential-music | 513 (make-sequential-music |
514 (list pset (loop (cdr actions))))))) | 514 (list pset (loop (cdr actions))))))) |
515 | 515 |
516 ((trill) | 516 ((trill) |
517 (ac:trill music)) | 517 (ac:trill music)) |
518 | 518 |
| 519 ((prall) |
| 520 ; A pralltriller symbol can either mean an inverted mordent |
| 521 ; or a half-shake -- a short, two twiddle trill. |
| 522 ; We implement as a half-shake. |
| 523 (let* |
| 524 ((totallength (ly:music-length music)) |
| 525 (newlen (ly:moment-sub totallength (ly:make-moment 3 32))) |
| 526 (newdur (ly:make-duration· |
| 527 0 0 |
| 528 (ly:moment-main-numerator newlen)· |
| 529 (ly:moment-main-denominator newlen))) |
| 530 (gracedur (ly:make-duration 5 0 1 1)) |
| 531 (gracenote (ly:music-deep-copy music)) |
| 532 (abovenote (ly:music-deep-copy music)) |
| 533 (mainnote (ly:music-deep-copy music)) |
| 534 (prall (make-sequential-music (list gracenote abovenote))) |
| 535 ) |
| 536 (music-map (lambda (n) |
| 537 (if (eq? 'NoteEvent (ly:music-property n 'name)) |
| 538 (set! (ly:music-property n 'duration) gracedur))· |
| 539 n) |
| 540 abovenote) |
| 541 (music-map (lambda (n) |
| 542 (if (eq? 'NoteEvent (ly:music-property n 'name)) |
| 543 (set! (ly:music-property n 'duration) gracedur))· |
| 544 n) |
| 545 gracenote) |
| 546 (music-map (lambda (n) |
| 547 (if (eq? 'NoteEvent (ly:music-property n 'name)) |
| 548 (set! (ly:music-property n 'duration) newdur))· |
| 549 n) |
| 550 mainnote) |
| 551 |
| 552 (map (lambda (y) (ac:up y)) |
| 553 (filter |
| 554 (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) |
| 555 (ly:music-property abovenote 'elements))) |
| 556 (make-sequential-music (list abovenote gracenote abovenote mainnote)))
) |
| 557 |
519 ((mordent) | 558 ((mordent) |
520 (let* | 559 (let* |
521 » ((dur (ly:music-property | 560 » ((totaldur (ly:music-property |
522 (car (ly:music-property music 'elements)) 'duration)) | 561 (car (ly:music-property music 'elements)) 'duration)) |
523 » (factor (ly:duration-factor dur)) | 562 » (dur (ly:duration-length totaldur)) |
| 563 » (newlen (ly:moment-sub dur (ly:make-moment 2 32))) |
| 564 » (newdur (ly:make-duration· |
| 565 » » (ly:moment-main-numerator newlen)· |
| 566 » » (ly:moment-main-denominator newlen) |
| 567 » » 1 |
| 568 » » 1)) |
524 (gracenote (ly:music-deep-copy music)) | 569 (gracenote (ly:music-deep-copy music)) |
| 570 (belownote (ly:music-deep-copy music)) |
525 (mainnote (ly:music-deep-copy music)) | 571 (mainnote (ly:music-deep-copy music)) |
526 (belownote (ly:music-deep-copy music)) | |
527 (mordent (make-sequential-music (list gracenote belownote))) | 572 (mordent (make-sequential-music (list gracenote belownote))) |
528 ) | 573 » ) |
529 (begin | 574 (begin |
530 (music-map (lambda (n) | 575 (music-map (lambda (n) |
531 (if (eq? 'NoteEvent (ly:music-property n 'name)) | 576 (if (eq? 'NoteEvent (ly:music-property n 'name)) |
532 » (set! (ly:music-property n 'duration)(ly:make-duration 3 0 1 1))) | 577 » (set! (ly:music-property n 'duration) |
| 578 » (ly:make-duration 5 0 1 1))) |
533 n) | 579 n) |
534 mordent) | 580 mordent) |
| 581 (music-map (lambda (n) |
| 582 (if (eq? 'NoteEvent (ly:music-property n 'name)) |
| 583 (set! (ly:music-property n 'duration) newdur))· |
| 584 n) |
| 585 mainnote) |
535 (map (lambda (y) (ac:down y)) | 586 (map (lambda (y) (ac:down y)) |
536 (filter | 587 (filter |
537 (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) | 588 (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) |
538 (ly:music-property belownote 'elements))) | 589 (ly:music-property belownote 'elements))) |
539 » (make-sequential-music (list (make-grace-music mordent) mainnote))))) | 590 » (make-sequential-music (list mordent mainnote))))) |
540 ((turn) | 591 ((turn) |
541 (let* | 592 (let* |
542 ((dur (ly:music-property | 593 ((dur (ly:music-property |
543 (car (ly:music-property music 'elements)) 'duration)) | 594 (car (ly:music-property music 'elements)) 'duration)) |
544 (factor (ly:duration-factor dur)) | 595 (factor (ly:duration-factor dur)) |
545 (newdur (ly:make-duration (+ (ly:duration-log dur) 2) | 596 (newdur (ly:make-duration (+ (ly:duration-log dur) 2) |
546 (ly:duration-dot-count dur) (car factor)(cdr factor)))) | 597 (ly:duration-dot-count dur) (car factor)(cdr factor)))) |
547 (begin | 598 (begin |
548 (map (lambda (y) (ac:setduration y newdur)) | 599 (map (lambda (y) (ac:setduration y newdur)) |
549 (ly:music-property music 'elements)) | 600 (ly:music-property music 'elements)) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 (ly:music-compress main (ly:moment-sub (ly:make-moment 1 1) factor)) | 685 (ly:music-compress main (ly:moment-sub (ly:make-moment 1 1) factor)) |
635 | 686 |
636 (set! (ly:music-property grace 'elements) | 687 (set! (ly:music-property grace 'elements) |
637 (append (ly:music-property grace 'elements) | 688 (append (ly:music-property grace 'elements) |
638 (list (make-music 'SlurEvent 'span-direction -1)))) | 689 (list (make-music 'SlurEvent 'span-direction -1)))) |
639 (set! (ly:music-property main 'elements) | 690 (set! (ly:music-property main 'elements) |
640 (append (ly:music-property main 'elements) | 691 (append (ly:music-property main 'elements) |
641 (list (make-music 'SlurEvent 'span-direction 1)))) | 692 (list (make-music 'SlurEvent 'span-direction 1)))) |
642 (make-sequential-music (list grace main)))) | 693 (make-sequential-music (list grace main)))) |
643 | 694 |
OLD | NEW |