From: Jean Lazarou Date: 2010-03-09T04:55:55+09:00 Subject: Re: Music Theory (#229) Here is a partial solution, it does not support all type of chord symbols (see comments in the main script). The main script is chord_translator.rb, it contains the 'chord' API and also translates chords when run from the command line. Usage: ruby chord_translator.rb {chord-symbols} Example: >ruby chord_translator.rb C Cdim7 Am F#+7 C => C E G Cdim7 => C Eb Gb A Am => A C E F#+7 => F# A# D E The chord_translator_test.rb file contain tests validating the currently supported chord symbols and also presents the APIs implemented by chord_translator.rb. The other scripts are files for the GUI version of the tool, they use the current trunk version of Swiby (a layer on top of Java/Swing) and need jRuby. (the first two scripts can run with any Ruby interpreter) The startup command is: jruby -I/core/lib chord_translator_ui.rb (chord_translator_ui.rb contains the GUI definition and the GUI logic - pretty basic -, score_painter.rb paints the musical notation - staff - and styles.rb defines the CSS-like styles of the GUI). It uses a font to draw the musical symbols, downloaded from http://simplythebest.net/fonts/fonts/musical_symbols.html The attached ZIP-file contains all the scripts and an image file presenting a run of the GUI version. Regards to all... Attachments: http://www.ruby-forum.com/attachment/4551/chord.zip -- Posted via http://www.ruby-forum.com/.