Anki add-on: ABC notation to MP3 (music integration) for Anki 2.1.x

ABC Music Notation (music integration addon) for Anki 2.1.x ABC Notation is a system designed to notate music in plain text format. http://abcnotation.com With this addon, you can add music snippets to your deck, wrapped in [abc]c d e[/abc] tags, and they will be converted to an MP3 music file. For this addon to work, you have to install abc2midi , timidity and lame first and they need to be in your PATH . abc2midi download page: http://abcplus.sourceforge.net/#abcmidi (alternatively on Ubuntu sudo apt-get install abcmidi ) timidity download page: http://timidity.sourceforge.net/#download (alternatively on Ubuntu sudo apt-get install timidity ) lame download page: http://lame.sourceforge.net/download.php (alternatively on Ubuntu sudo apt-get install lame ) How to use This addon understands [abc] tags: [abc]c d e[/abc] Alternatively, you can create dedicated fields, e.g. front-abc or back-abc , and omit the [abc] tags for them: c d e With abc in the field name, it will act as if the entire field content was wrapped in [abc][/abc] tags. This addon allows the creation of custom templates (see below), and specifying which template to use: [abc=default]c d e[/abc] [abc=yourtemplate]c d e[/abc] The name of the default template is default , so [abc=default] is identical to [abc] . You can also use templates in abc fields by giving them names like front-abc-yourtemplate , back-abc-yourtemplate . Mobile/Web support Anki addons are desktop only, so by default, sounds won't appear on other platforms since those platforms won't know what to make of a [abc] tag or how to treat a abc field. However, if you are using abc fields, and for each field create another field called abcsnd , the desktop addon will automatically fill it with the [sound] tag. For example, if your field is front-abc , with content c d e , and you have another field front-abcsnd , and use only the front-abcsnd field in your card template, the sound will appear on all platforms (provided that the desktop addon generated the MP3 file once and the MP3 files were synced to the other platforms as well). Note: If you add text to a abcsnd field, it will be overwritten and discarded by the addon. ABC Templates The addons21/203713821/abc directory holds template files for ABC Notation. Templates can be created and edited from Anki, using the Tools->abc menu. An external editor is used. The default editor is xed , but you surely must adapt it for your specific setup: menu Tools->Addons, select this addon in the list, then click on Config. Modify the JSON config with the editor command (it may be necessary to include the path). Please restart Anki when you change templates. The default template is default.abc and used by: [abc]code[/abc] [abc=default]code[/abc] somefield-abc All other templates have to be specified by name: [abc=templatename]code[/abc] somefield-abc-templatename In the template, %ANKI% will be replaced with code. Multiple codes can be specified, by separating them with %%% : [abc] code1 %%% code2 [/abc] In the template, the first occurrence of %ANKI% will be replaced with code1 , the second occurrence of %ANKI% with code2 . The number of %ANKI% in the template has to match the number of codes used for this template always, otherwise the remaining occurrences of %ANKI% will not be replaced, or the surplus specified codes will not be inserted. The default template looks like this: X:1 M:4/4 L:1/4 K:C %ANKI% If you would like write your own header, you can choose the void template (file template is void.abc and contains only %ANKI% ): [abc=void] X:1 T:My own header's title M:6/8 L:1/8 Q:C8=30 K:F |: ddc B2 A | AGG F2 D | ddc B2 A | GGF G3 :| |: AAA c2 c | ccc d2 d | ddc B2 A | GGF G3 :| [/abc] or somefield-abc-void Please refer to the ABC Notation homepage and documentation for details on how to write ABC Notation code. You can also use %%MIDI commands (or [I:MIDI=] inline equivalents) which are particular to the abc2midi program, e.g. %%MIDI drum command (refer to the Guide to Advanced Futures of abc2midi : https://ifdo.ca/~seymour/runabc/abcguide/abc2midi_guide.html ).