music-utils

Utils to clasify music intervals, create scales and more.

Examples

Intervals

Simples:

MusicUtils.number(:do, :mi)                   #=> 3 (3th)
MusicUtils.semitones(:do, :mi)                #=> 4 (semi-tones)
MusicUtils.quality(:do, :mi)                  #=> M (major)

Compounds:

MusicUtils.number(:do, :mi, 1)                #=> 10 (10th)
MusicUtils.semitones(:do, :mi, 1)             #=> 16 (semi-tones)
MusicUtils.quality(:do, :mi, 1)               #=> M (major)

Short Notation:

MusicUtils.short(:do, :mi)                    #=> M3
MusicUtils.short(:do, :mi, 1)                 #=> M10

Highest note of interval:

MusicUtils.high_note(:do, :P5)                #=> :sol
MusicUtils.high_note(:fas, :m3)               #=> :la

Scales

Create scales:

MusicUtils.scale(:fa, MusicUtils::MAJ_SCALE)  #=> [:fa, :sol, :la, :sib, :do, :re, :mi]

Installation

gem install music-utils

Usage

The MusicUtils module has constants to refer to common items like notes and scales.

require 'music-utils'

MusicUtils.short(MusicUtils::SOL, MusicUtils::DOF)
MusicUtils.scale(MusicUtils::SOL, MusicUtils::MAJ_SCALE)

Testing

To run the tests:

$ bin/rake

or:

$ ruby bin/rake

To Do

  • Add validations (notes, alterations, etc)
  • Add other scales structures and its tests

Copyright (c) 2011 Jorge Luis PĂ©rez. See LICENSE for details.