contents
top
overview
features
news
install
requirements
download
emacs mode
midi
user doc
note entry
rumor session
ornaments
transformations
play back
custom
reference
contact

lyqi -- LilyPond quick insert mode

overview

lyqi-mode (LilyPond quick insert mode) is an Emacs major mode, derived from LilyPond-mode, and inspired by its LilyPond-quick-note-insert functionality, which aims at saving key strokes during note entry: a note is inserted with a single key stroke, its length, octave, alteration, being deduced thanks to previous notes; length, octave and alteration can be modified wherever and whenever by single key strokes.

Example:

key strokesoutput
jsol4
8sol8
ksol8 la8
lsol8 la8 si8
esol8 la8 sib8
.sol8 la8 sib8.
dsol8 la8 sib8. do'8.
5sol8 la8 sib8. do'32
lsol8 la8 sib8. do'32 sib32
4sol8 la8 sib8. do'32 sib4

If you don't know GNU LilyPond, please visit its homepage. Many thanks to its authors, Han-Wen Nienhuys and Jan Nieuwenhuizen, and its contributors.

features

note insertion / modification
Use your computer keyboard as a piano keyboard to insert notes. Length, octave, alteration are automatically chosed thanks to previous notes. You can then modify these caracteristics with dedicated keys. You can also modify a previously inserted note: just move the cursor after the note, and press modification keys.
tuplets, ornaments, marks
In lyqi-mode, the whole keyboard is redefined in order to ease note entry, ie you cannot type random text as in a regular emacs mode. However, ornaments, marks, etc, are taken into account and can be easily inserted.
midi playing
Notes are played when inserted or modified. Play back on a whole region can also be performed. Requires ALSA and timidity.
language
Several note languages are supported: nederlands english deutsch norsk svenska italiano catalan espanol. The user can customize the default language to use, and eventually switch between languages, or change the language used in a region.
output octave mode
Both octave modes supported by LilyPond -- relative and absolute -- are proposed in lyqi-mode. The default is absolute, but the user customize that property. A change of octave mode (relative <--> absolute) can also be executed on a region.
transposition
Note transpositions can be done on whole regions.
MIDI keyboard
Thanks to rumor, a "monophonic MIDI keyboard to Lilypond converter", the user can use its midi keyboard for note input, and see the notes automatically inserted in the buffer. Rumor is also convenient for bad keyboard players (like me), thanks to its flat option: one hand on the MIDI keyboard, to insert notes, and the other on the computer keyboard, to eventually adjust note durations.

news

2004-03-14
Versio 0.2.5: various suggestions and patches by Reuben Thomas, including an alternate transposition command (lyqi-transpose-interval-region). Rumor related custom variables are now named lyqi-rumor-default-.... Now uses rumor 1.0.3.
2004-01-04
Version 0.2.4: lyqi can now use an already running timidity demon (custom variables are lyqi-midi-use-external-timidity-server and lyqi-midi-external-timidity-port, which can be set with the lyqi-midi-set-timidity-alsa-port command). Compatibility with elder eieio versions, thanks to Ferenc Wagner. Bug fix: Lyqi remembers the previously chosen language when back to lyqi-mode.
2003-09-27
Version 0.2.3: supports rumor 1.0.2a. New commands to change rumor parameters (the prefix key for rumor commands is C-c r). C-c r s to start, SPC to stop, see reference for custom.
2003-09-13
Version 0.2.2: supports rumor (start: C-c r, stop: SPC). `n' sets the last note alteration to natural, `=' resets the note octave.
2003-08-01
Version 0.2.1: now, works also in XEmacs.
2003-07-28
Version 0.2 released.

install

requirements

lyqi-mode depends on eieio, "an Emacs lisp program which implements a controlled object-oriented programming methodology following the CLOS standard", and which may be already part of your Emacs distribution.

Midi playing, which is optionnal, requires ALSA >=0.9 and TiMidity++.

Rumor sessions depends on... rumor (>= 1.0.3).

download

The package homepage is http://nicolas.sceaux.free.fr/lilypond/lyqi.html.

lyqi-0.2.5.tar.gz (last updated 2003-08-01) contains emacs-lisp source files, this documentation, and the source file for the virtual midi keyboard used for play-back.

emacs mode

  1. Download and extract the archive in a temporary directory. Move emacs lisp files (.el) to a relevant directory, for instance ~/.elisp/lyqi/.
    $ cd /tmp
    $ tar zxf lyqi.tar.gz
    $ cd lyqi
    $ mkdir -p ~/.elisp/lyqi
    $ mv *.el ~/.elisp/lyqi
  2. Then, edit your .emacs file:
    ;;--------- .emacs -----------
    ;; adds ~/.elisp/lyqi in the load path
    (setq load-path (cons (expand-file-name "~/.elisp/lyqi") load-path))
    
    ;; when loading LilyPond-mode, lyqi-mode library will also be loaded.
    ;; type `C-c q' in LilyPond-mode to switch to lyqi-mode.
    (eval-after-load "lilypond-mode" 
      '(progn
         (load-library "lyqi-mode")
         (define-key LilyPond-mode-map "\C-cq" 'lyqi-mode)))
  3. Finally, byte-compile elisp files:
    $ emacs -batch -u <username> -f batch-byte-compile ~/.elisp/lyqi/*.el

midi

Midi note playing, which is optional, requires ALSA >=0.9 and TiMidity++. If you use Debian GNU/Linux, you may wish to look at this article to install and configure ALSA.

Here is how midi notes are played with lyqi-mode (not very beautyfull):

In order to enable this feature, we will compile and install the little virtual midi keyboard:

$ cd /tmp/lyqi   # or wherever the archive is extracted
$ make
gcc -Wall -O   -c -o mymidikbd.o mymidikbd.c
gcc -lasound  mymidikbd.o   -o mymidikbd
$ mkdir -p ~/bin
$ mv mymidikbd ~/bin

Then, you may test if it works:

  1. in a shell, start timidity as a demon with ALSA interface enabled:
    $ timidity -iA -B2,8 -Os -EFreverb=0
    Requested buffer size 2048, fragment size 1024
    ALSA pcm 'default' set buffer size 2048, period size 1024 bytes
    TiMidity starting in ALSA server mode
    can't set sched_setscheduler - using normal priority
    Opening sequencer port: 133:0 133:1
    Here we see that it has been started using sequencer port 133;
  2. in an other shell, run mymidikbd, with the port number given as the first argument:
    $ ~/bin/mymidikbd 133
  3. mymidikbd waits for pitches and length (in seconds) written in standard input. So type two numbers and press RETURN :
    $ ~/bin/mymidikbd 133
    50 0.25 RET
    52 0.25 RET
    If you can hear notes, then it works. ^d (EOF) stops the program.

user doc

In order to start lyqi-mode, visit a .ly file in Emacs. LilyPond-mode should be then started. Type C-c q or M-x lyqi-mode to switch to lyqi-mode. Note that C-c q let you switch back to regular LilyPond-mode.

In the following, I use italiano as a language for notes, (a) because la-si-do notes are my mother tongue in music, and (b) in order to emphasize key stroke save, and (c) to avoid confusion between keys and notes.

All key bindings described here are default bindings, but they can be redefined by the user (this is Emacs!).

note entry

Notes are inserted by specifying their pitch. Use your computer keyboard as a mini piano keyboard:

 |  | | | |  |  | | | | | |  |
 |  | | | |  |  | | | | | |  |
 |  |_| |_|  |  |_| |_| |_|  |
 |   |   |   |   |   |   |   |
 | d | f | g | h | j | k | l |
 |___|___|___|___|___|___|___|

The first inserted note is a quater note. You change the duration with the number keys, and add/remove dots with the dot key. When you change a note duration, the next inserted note will have the same duration.

key1248 7509
duration1248 163264128

When inserting notes, octave is chosed so that the inserted note is the closer in pitch from the preceding (up to a fourth). You change a note octave with comma and quote keys.

,octave down
'octave up
=reset octave

To alterate a note, type the e and i keys to flatten or sharpen the note. ! and ? force reminder and cautionary accidentals.

eflatten note
isharpen note
nnatural
!force/unforce reminder accidental
?force/unforce cautionary accidental

Finally, rests are inserted with the r key, and skips with the s key.

For instance, the following key sequence:

r8ji'l
l4.
r8g,.l'7
l4.
k7jhi8.k7
j.h5g8r
produces the following output:
r8 sold'8 si'8 
si'4. 
r8 mi'8. si'16 
si'4. 
la'16 sold'16 fad'8. la'16 
sold'16. fad'32 mi'8 r8 

rumor session

A rumor session is started by typing C-c r s. Press SPC to stop the recording session.

Rumor options can be set thanks to custom variables (which are only read when loading the lyqi-mode), or interactively thanks to commands:

custom variablekeydescription
lyqi-rumor-default-grain C-c r g Set minimum time resolution to the NUMth note. Only powers of two are valid, from 1 up to 128.
lyqi-rumor-default-tempo C-c r t Metronome speed in beats per minute.
lyqi-rumor-default-legato C-c r l If true, ignore any rests between notes.
lyqi-rumor-default-no-dots C-c r d If true, do not use dotted notes.
lyqi-rumor-default-flat C-c r f If true, output only pitches as you play, no lengths.
lyqi-rumor-default-meter C-c r m "P/Q". Set time signature. Bar will have P beats of duration of the Qth note. Q must be a power of two.
lyqi-rumor-default-key C-c r k Set base note of current scale. Valid values for KEY are "ces", "c", "cis", "des", .... Double sharps/flats are not allowed. Note that KEY has to be given using note language `nederlands'.

Note: When setting a rumor parameter with one of these commands, rumor's behaviour will be changed the next time you launch it, ie setting a rumor argument during a rumor session will have no effect on the running session.

ornaments, marks

Some keys are self inserting : ~ ( ) < > { } [ ] | SPACE, ie when the user hits the tilde key, a ~ character is inserted. These characters are used for beams, slurs, ties, chords, bars, ie are frequently used.

Some LilyPond commands, in particular articulations, are a combinaison of two characters: a prefix - or _ or ^, and the command itself, for instance do^. for a staccato do. To achieve that in lyqi-mode, press the prefix key - or _ or ^, then the second (whetever) character. The backslash has also this behaviour, in order to write \\ or \p, for instance.

These prefix characters can also be followed by longer strings, for example do^\trill. This is done, in lyqi-mode, by typing the sequence C-<prefix-key>, then the command string, then RETURN. The sharp and double quote keys also have this behaviour.

Example:

d8-_[f^.]do'8 -_[ re'8^. ]
d1 C-c ^ \fermata RETdo'1^\fermata
d \pdo'1 \p

transformations

Transformations can be accomplished on a whole region: transposition, octave mode change, language change.

To transpose a region of notes, select it and type C-c C-t, or M-x lyqi-transpose-region. You will be asked the destination note, do being the reference: enter the note (in LilyPond language) and press RET. The notes contained in the region are then replaced by the transposed notes, non-notes being hopefully left untouched.

For instance, in order to have a do transposed to the la below, the note to tell (with italiano language) will be la,. Suppose your LilyPond source file contains the following line:

do'8 mi'8 sol'8 sol8 do'2 

Select the line, type C-c C-t and then la, RET. This will produce the output:

la8 dod'8 mi'8 mi8 la2 

The lyqi-transpose-interval-region command expects an interval, for instance 2- in order to transpose a note 2 notes below.

The lyqi-change-language-region command aims at changing the language used for notes in the selected region. The user is asked the source (default: current language) and destination languages.

Finally, the lyqi-relative-to-absolute-region and lyqi-absolute-to-relative-region change octave mode used in region and rewrite notes accordingly.

play back

Notes can be played when inserted. To enable this feature, type C-c m or M-x lyqi-midi-start-stop.

A whole region of notes can also be played: select a region and type C-c p or M-x lyqi-play-back-region. Note that this feature is quite rudimentary. Encoutered notes are played sequentially, even if they are part of a chord. It is mostly provided for ear-checking of small parts.

If your system already runs a timidity demon, you may turn the custom variable lyqi-midi-use-external-timidity-server to t. The default ALSA sequencer port used by such a server should be 128. To change it, set the lyqi-midi-external-timidity-port custom variable in your .emacs file or use the M-x lyqi-midi-set-timidity-alsa-port command.

custom

Some properties may be customized:
lyqi-self-inserting-keys
Self inserting characters (a string). When the user hits one of these keys, the corresponding character is inserted. Default: "()<>~{}|[] "
lyqi-self-inserting-+-char-keys
A string. When the user hits one of these keys, the corresponding character is inserted, plus an extra character, asked to the user. Default: "-_^\\"
lyqi-self-inserting-+-string-keys
A (character key &optional end) list. When the user hits key, character is inserted, plus a string, asked to the user. If end is provided, it is finally inserted. Default: '((?- "\C-c-") (?_ "\C-c_") (?^ "\C-c^") (?\\ "\C-c\\") (?# "#") (?\" "\"" "\""))
lyqi-force-duration
Force durations to be written when inserting a note, rest or skip, even if previous word has the same duration. Default: t
lyqi-relative-octave-default
If non-nil, enables relative octave mode at startup. Default: nil
lyqi-default-language
Default language used to write note names. Default: 'nederlands
lyqi-midi-demon-command
Command used to start the midi daemon. Default: "timidity -iA -B2,8 -Os -EFreverb=0"
lyqi-midi-keyboard-command
Command used to start the midi keyboard process. Default: "mymidikbd"
lyqi-midi-enabled-default
If non-nil, enables midi playing by default. Default: nil.
lyqi-midi-use-external-timidity-server
If true, don't start a timidity server, but use an already running one. Default: nil.
lyqi-midi-external-timidity-port
The ALSA sequencer port used by the already running timidity demon. Default: 128.
Example:
-------- .emacs ---------
;; ...

(custom-set-variables
 ;; other custom variables...

 '(lyqi-default-language 'italiano)
 '(lyqi-midi-keyboard-command "~/bin/mymidikbd")
 '(lyqi-midi-use-external-timidity-server t) ; timidity demon always running
 '(lyqi-midi-enabled-default t))
-------------------------

reference

Rests, skips

keycommanddescription
slyqi-insert-skipInsert a skip at point.
rlyqi-insert-restInsert a rest at point.

Note pitches

keycommanddescription
dlyqi-insert-note-doInsert a new do / c note at point.
flyqi-insert-note-reInsert a new re / d note at point.
glyqi-insert-note-miInsert a new mi / e note at point.
hlyqi-insert-note-faInsert a new fa / f note at point.
jlyqi-insert-note-solInsert a new sol / g note at point.
klyqi-insert-note-laInsert a new la / a note at point.
llyqi-insert-note-siInsert a new si / b note at point.
ilyqi-change-alteration-upIncrease, if possible, the last note alteration.
elyqi-change-alteration-downDecrease, if possible, the last note alteration.
nlyqi-change-alteration-naturalSet, if possible, the last note alteration to natural.
'lyqi-change-octave-upIncrease the last note octave.
,lyqi-change-octave-downDecrease the last note octave.
=lyqi-change-octave-zeroSet the last note octave to zero.

Lengths

keycommanddescription
1lyqi-change-duration-1Change the previous word duration to 1.
2lyqi-change-duration-2Change the previous word duration to 2.
4lyqi-change-duration-4Change the previous word duration to 4.
8lyqi-change-duration-8Change the previous word duration to 8.
7lyqi-change-duration-16Change the previous word duration to 16.
5lyqi-change-duration-32Change the previous word duration to 32.
0lyqi-change-duration-64Change the previous word duration to 64.
9lyqi-change-duration-128Change the previous word duration to 128.
.lyqi-change-dotsIncrease modulo 5 the previous word dot number.

Accidentals

keycommanddescription
!lyqi-change-reminder-altChange the last note's reminder alteration state.
?lyqi-change-cautionary-altChange the last note's cautionary alteration state.

Rumor recording session

keycommanddescription
C-c r slyqi-rumor-session-startStart a rumor session. Press SPC to stop the session
SPClyqi-rumor-session-stopStop a running rumor session.
C-c r glyqi-rumor-set-grainSet rumor's grain.
C-c r tlyqi-rumor-set-tempoSet rumor's tempo.
C-c r llyqi-rumor-set-legatoChange rumor's legato parameter.
C-c r dlyqi-rumor-set-no-dotsChange rumor's no-dots parameter.
C-c r flyqi-rumor-set-flatChange rumor's flat parameter.
C-c r mlyqi-rumor-set-meterSet rumor's meter.
C-c r klyqi-rumor-set-keySet rumor's key.
C-c r plyqi-rumor-set-alsa-portSet rumor's alsa-port.

Ornaments, marks, etc.

keycommanddescription
~self-insert-command
{self-insert-command
}self-insert-command
|self-insert-command
[self-insert-command
]self-insert-command
<self-insert-command
>self-insert-command
(self-insert-command
)self-insert-command
SPCself-insert-command
_lyqi-_-self-insert-+-char
-lyqi---self-insert-+-char
^lyqi-^-self-insert-+-char
\lyqi-\-self-insert-+-char
C-c _lyqi-_-self-insert-+-string
C-c -lyqi---self-insert-+-string
C-c ^lyqi-^-self-insert-+-string
C-c \lyqi-\-self-insert-+-string
#lyqi-#-self-insert-+-string
"lyqi-"-self-insert-+-string

Transformations

keycommanddescription
C-c C-tlyqi-transpose-region Interactively transpose the current region. The user is asked the transposition interval, starting from c/do.
 lyqi-transpose-interval-region Interactively transpose the current region. The user is asked the transposition interval in tones.
 lyqi-change-language-region Change note language in region. The user is asked for source and destination languages.
 lyqi-absolute-to-relative-region Rewrite region with relative octave mode instead of absolute octave mode.
 lyqi-relative-to-absolute-region Rewrite region with absolute octave mode instead of relative octave mode. An octave transposition may be required afterward.

Play back

keycommanddescription
C-c mlyqi-midi-start-stop Start or stop midi playing.
C-c plyqi-play-back-region If midi is on, play back notes in region.
lyqi-midi-set-timidity-alsa-port When using an external timidity demon, set its ALSA sequencer port.

Editing properties

keycommanddescription
C-c C-llyqi-switch-languageSelect the next output language.
C-c olyqi-switch-octave-modeSwitch between relative and absolute octave modes.

Misc

keycommanddescription
C-c hlyqi-helpDisplay a help message in a dedicated buffer.
C-c qlyqi-quitQuit lyqi-mode, back to LilyPond-mode
M-flyqi-word-forward Move to the following note end, if any, otherwise to the end of the following text word.
M-blyqi-word-backward Move to the previous note beginning, if any, otherwise to the beginning of the previous text word.

Last modified: Sat May 22 10:47:58 CEST 2004