ob-doc-abc.org 3.7 KB

Org Babel support for ABC Notation

Introduction

An Emacs Org Babel language - provided to allow ABC Notation Music Score generation.

Usage

Generating output in various formats (PostScript, Encapsulated PostScript, PDF, SVG) is done by naming the :file parameter correctly and passing the command-line options to abcm2ps using the :cmdline parameter.

Examples

PDF generation

  #+begin_src abc :file congress.pdf
  T: The Congress
  R: reel
  M: 4/4
  L: 1/8
  K: Ador
  eAAG A2 (3Bcd | eaaf gedg | eA ~A2 eAcA | BdGB dG (3Bcd |
  eAAG A2 (3Bcd | eaaf gedB | ~c3 d (3efg ed | cdBc A2(3Bcd |
  eA ~A2 EAcd | eAaf gafg | ea ~a2 AecA | BG ~G2 B,DGB |
  AE ~E2 cA (3Bcd | eaaf gedB | ~c3 d eged | cdBc A2Bd |
  eaa^g ~a3 =g | eaaf gedg | (3efg dg (3efg dg | eaaf gabg |
  eaa^g aba=g | eaaf gedB | ~c3 d (3efg ed | cdBc A2(3Bcd |
  eaa^g  ~a3 =g | eaaf gedg | (3efg dg cgBg | eaaf gabg |
  eaa^g ab=ga | eaaf gedB | ~c3 d eged | cd (3efg agfg |
  #+end_src

SVG generation for inclusion in web pages

  #+begin_src abc :file john_maccol_kilbowie.svg :cmdline -g
  T: John MacColl's March To Kilbowie Cottage
  R: March
  M: 4/4
  L: 1/8
  K: Amix
  A>B|: c4 c>B A>c | e4 f>e cB cc A>B | cc B2 A>B |
  c4 c>B A>c | e4 f>e ce f>c e>A BB :|2 A2 A2 A2 f>=g ||
  a2-a>f e>c Bc e>=g f>c e>c | a>f eB | cc B2 f>=g |
  a2-a>f e>c Bc e>=g f>c e>c | fA B=g |
  a2-a>f e>c Bc e>=g f>c e>c | a>f eB | cc B2 A>B |
  c4 c>B A>c | e4 f>e ce f>c e>A BB |
 | : A>c Bf ee ff cc Bf ef e>c B2 c>B |
  A>c Bf ee ff ce f>c e>A BB :|2 A2 A2 A2 e>d ||
  cc A>c e>A | ce f>e c>d | e>c BB | cc B2 e>d|
  cc A>c e>A | ce f>e c>d | e>f cA Bd |
  cc A>c e>A | ce f>e c>d | e>c BB | cc B2 A>B |
  c4 c>B A>c | e4 f>e ce f>c e>A B

Compiling ABC Blocks

In basic-mode the key sequence C-c C-c within an ABC block will compile the block. Exporting of all blocks and Org file contents is initialted with the sequence C-c C-e (standard Org-mode export keys).

Setup

Simply add abc to your list of babel languages (in your init file):

(org-babel-do-load-languages
  'org-babel-load-languages
  '(
    (emacs-lisp . t)
    (sh t)
    (org t)
    (abc t)))  <==== This is the line to add

Requirements

Issues

Issues should be reported to the Org-mode Mailing-list.