-(define-public (major-key pitch-list)
- "Characterise the key as major if the alteration of the
-third scale note is the same as that of the main note.
-Note: MIDI cannot handle other tonalities than major/minor.
-"
- ;; This charactersition is only true for a scale that starts at `c'.
- (if (not (equal? (car pitch-list) '(0 . 0)))
- (begin
- (ly:warn "Attempt to determine tonality of transposed scale")
- #t)
- (eq? (cdr (list-ref pitch-list 4)) (cdr (list-ref pitch-list 6))))
- )
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+
+(define-public (write-performances-midis performances basename . rest)
+ (let ((midi-ext (ly:get-option 'midi-extension)))
+ (let
+ loop
+ ((perfs performances)
+ (count (if (null? rest) 0 (car rest))))
+ (if (pair? perfs)
+ (begin
+ (ly:performance-write
+ (car perfs)
+ (if (> count 0)
+ (format #f "~a-~a.~a" basename count midi-ext)
+ (format #f "~a.~a" basename midi-ext)))
+ (loop (cdr perfs) (1+ count)))))))