1 ;; $RCSfile: lyqi-rumor.el,v $
3 ;; $Date: 2004/03/14 15:15:24 $
6 ;;; Part of lyqi, a major emacs mode derived from LilyPond-Mode,
7 ;;; for quick note insertion while editing GNU LilyPond music scores.
9 ;;; (c) copyright 2003 Nicolas Sceaux <nicolas.sceaux@free.fr>
10 ;;; See http://nicolas.sceaux.free.fr/lilypond/
17 (defcustom lyqi-rumor-command "rumor"
18 "Command used to start the rumor process."
23 (defcustom lyqi-rumor-default-grain 16
24 "Set minimum time resolution to the NUMth note. Only powers of two are valid, from 1 up to 128."
28 (defcustom lyqi-rumor-default-tempo 80
29 "Metronome speed in beats per minute."
33 (defcustom lyqi-rumor-default-legato nil
34 "If true, ignore any rests between notes."
38 (defcustom lyqi-rumor-default-no-dots nil
39 "If true, do not use dotted notes."
43 (defcustom lyqi-rumor-default-flat nil
44 "If true, output only pitches as you play, no lengths."
48 (defcustom lyqi-rumor-default-strip t
49 "If true, strip leading and trailing rests from output."
53 ;; the two following are obiously score-dependant, not really
54 ;; custom vars. However, with defcustom, they can be set thanks
56 (defcustom lyqi-rumor-default-meter "4/4"
57 "P/Q. Set time signature. Bar will have P beats of duration of the Qth note. Q must be a power of two."
61 (defcustom lyqi-rumor-default-key "c"
62 "Set base note of current scale.
63 Valid values for KEY are ces, c, cis, des, .... Double sharps/flats are not allowed.
64 Note that KEY has to be given using note language `nederlands'."
68 (defcustom lyqi-rumor-default-alsa-port 64
73 (defvar lyqi-rumor-process nil
76 (defclass rumor (midi-process)
77 ((grain :initarg :grain)
78 (tempo :initarg :tempo)
79 (legato :initarg :legato)
80 (no-dots :initarg :no-dots)
82 (strip :initarg :strip)
83 (meter :initarg :meter)
85 (port :initarg :alsa-port)))
87 (defmethod process-start :BEFORE ((rumor rumor))
88 "Start a rumor recording session"
89 (with-slots (grain tempo legato no-dots flat strip meter key port) rumor
90 (setf (slot-value rumor 'args)
92 (format "--meter=%s" meter)
93 (format "--tempo=%d" tempo)
94 (format "--grain=%d" grain)
95 (format "--key=%s" key)
96 (format "--alsa=%d:0,%d:0" port port)))
98 (push "--legato" (slot-value rumor 'args)))
100 (push "--no-dots" (slot-value rumor 'args)))
102 (push "--flat" (slot-value rumor 'args)))
104 (push "--strip" (slot-value rumor 'args)))
105 (push (format "--lang=%s" (case (slot-value lyqi-editing-state 'language)
114 (slot-value rumor 'args))
115 (when (slot-value lyqi-editing-state 'force-duration)
116 (push "--explicit-duration" (slot-value rumor 'args)))
117 (unless (slot-value lyqi-editing-state 'relative-octave)
118 (push "--absolute-pitches" (slot-value rumor 'args)))
119 (push "--no-chords" (slot-value rumor 'args))
120 (setf (slot-value rumor 'args) (nreverse (slot-value rumor 'args)))))
122 (defmethod process-start :AFTER ((rumor rumor))
123 (set-process-filter (slot-value rumor 'process) 'rumor-filter))
125 (defun rumor-filter (process output)
126 "Process Filter Function for rumor.
127 Just insert rumor output in current buffer."
129 (accept-process-output process 0.3 0))
131 (provide 'lyqi-rumor)