Skip to content

owickstrom/smug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMUG

The Sheet Music Generator.

Prerequisites

You will need Leiningen 2.0.0 or above installed.

Running

To start a web server for the application, run:

lein run
# or with explicit overrides:
PORT=5000 OUTPUT_DIR=/tmp/my-scores lein run

Lilypond Rendering

If you want to generate and render a score using Lilypond, run:

user> (require '[smug.music :refer :all])
user> (require '[smug.render.lilypond :refer :all])
user> (-> (generate-score 64)
          (render-svg-to "/tmp/foo"))
; returns the rendered files:
; (#object[java.io.File 0x13d6912f "/tmp/foo-page-1.svg"] #object[java.io.File 0x7def9c5b "/tmp/foo-page-2.svg"])

This requires the lilypond executable to be on your PATH, and the given path to be writable. Note that the path /tmp/foo results in /tmp/foo.svg, or possibly paged paths (/tmp/foo-page-1.svg, /tmp/foo-page-2.svg, ...) when the score doesn't fit in a single page.

You can also get the intermediate Lilypond markup by using render-as-lilypond:

user> (-> (generate-score 64)
          render-as-lilypond)
; returns the markup as a string:
"\n\\header {\n  title = \"Sight Reading Exercise\"\n  tagline = \"Generated by SMUG\"\n}\n{\n  c'2 d'2 \\\n  c'2 d'2 \\bar \"|\" c'2 e'2 \\bar \"|\" d'2 c'2 \\bar \"|\" c'2 d'2 \\bar \"|\" c'2 d'2 ..."

Abc4j Rendering

If you want to generate and render a score using abc4j and Swing, run:

user> (require '[smug.music :refer :all])
user> (require '[smug.render.abc4j :refer :all])
user> (-> (generate-score 64)
          create-score-component
          render-in-window)
; a Java Swing window should appear

License

Mozilla Public License, v. 2.0. See the full LICENSE file.

Copyright © 2016 Oskar Wickström.

About

The Sheet Music Generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published