#I'll be making this library bigger, given enough time.
Sorry for the double post, but by 'library' I meant 'chord dictionary'..
···
--
Posted via http://www.ruby-forum.com/\.
#I'll be making this library bigger, given enough time.
Sorry for the double post, but by 'library' I meant 'chord dictionary'..
--
Posted via http://www.ruby-forum.com/\.
OK
Here is my solution.
I'm rather new to Ruby.
So this may look more C-like than Ruby-ish.
I am not a musician.
It should be easy to add additional chords.
I could not come up with a good way to decide wich of two equivalent
notes to display.
I'm not sure about the etiquette of attaching a non-compressed file.
Right now I am working under Windows XP.
Not sure how to deliver a .tar.gz file under Windows.
I probably could just do a .z file though.
I was fun AND consumed way too much of my free time.
Attachments:
http://www.ruby-forum.com/attachment/4531/Chords_DNS.rb
--
Posted via http://www.ruby-forum.com/.
Here's an updated version. I now explicitly give out the scales as well
as chords, and have attempted to optimise the "spelling" of 8-note
scales (which don't sit naturally on the 7 letters A-G). I made some
simplifications too.
Sample interaction:
C7
Scale: C D E F G A Bb
Chord: C E G Bb
C7alt
Scale: C Db Eb Fb Gb Ab Bb
Chord: C Eb Gb Bb
C7b9
Scale: C Db Eb E F# G A Bb
Chord: C E G Bb Db Eb F# A
Cdim7
Scale: C D Eb F Gb Ab A B
Chord: C Eb Gb A
C#dim7
Scale: C# D# E F# G A A# B#
Chord: C# E G A#
Attachments:
http://www.ruby-forum.com/attachment/4550/chords-bc.rb
--
Posted via http://www.ruby-forum.com/.
Frankly, I'd rather see inline code rather than an attachment. Especially
if attaching doesn't save any space.
Hal
On Tue, Mar 2, 2010 at 4:38 PM, David Springer <dnspringer@gmail.com> wrote:
I'm not sure about the etiquette of attaching a non-compressed file.
Right now I am working under Windows XP.
David Springer wrote:
OK
Here is my solution.
$ ruby Chords_DNS.rb
C7
Chord "C7", C, E, G, A#
That should be a Bb, not an A#.
C7b5
Chord "C7b5", C, E, F#, A#
That's my favourite chord, the Lydian Dominant, but I would have called
it C7#4 as the scale also contains a perfect 5th. It's odd as it
includes both sharps and flats (F# and Bb).
The Simpsons theme tune is an example of a melody using this scale.
Regards,
Brian.
--
Posted via http://www.ruby-forum.com/\.
And just to clarify what I mean by 'spelling', I mean the sequence of
letters and accidentals which make a scale. On a 7-note scale each scale
corresponds to the next letter.
Example: G# major
Correct spelling: G# A# B# C# D# E# Fx
(Fx = F double-sharp)
It would be wrong to write something like: G# A# C C# D# F G
because of the gaps and duplications of letters.
This is the reason why a C7 chord is C E G Bb not C E G A#. It's because
the associated scale is
C D E F G A Bb
This scale is called the 'Mixolydian mode' (named by the ancient Greeks,
I believe). It also happens to be the notes of F major with a different
starting point, so fortunately you can re-use your major scale finger
patterns
Regards,
Brian.
--
Posted via http://www.ruby-forum.com/.
C
Scale: C D E F G A B
Chord: C E G B
Why does the Chord contain a B?
On 03/08/2010 15:08, Brian Candler wrote:
Here's an updated version. I now explicitly give out the scales as well
as chords, and have attempted to optimise the "spelling" of 8-note
scales (which don't sit naturally on the 7 letters A-G). I made some
simplifications too.
Alexander Jesner wrote:
C
Scale: C D E F G A B
Chord: C E G BWhy does the Chord contain a B?
Explained earlier in the thread. If you've just joined:
But if you want traditional triads, it's easy enough to reconfigure the
program so that it returns, say,
C => C E G
CMaj7 => C E G B
--
Posted via http://www.ruby-forum.com/\.
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<swiby-trunk>/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/\.