Sha256: 640f72ab12b8019bd530bb6ce3d3bcc0a13786e5ef47e047ea6d73850228c8a6

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

# rb-music

**rb-music** is a Ruby gem for working with musical notes, scales and intervals. It is basically a direct port of the wonderful [music.js](https://github.com/gregjopa/music.js) library by Greg Jopa.

## Installation

In your Gemfile:

```
gem 'rb-music', git: 'https://github.com/mwise/rb-music', branch: 'master'
```

In your Ruby code:

```
require 'rb-music'
```

## Overview

### Note

`Note.from_latin(name)`: Note by latin name and octave

```ruby
n = Note.from_latin('A4');  # single note
n.frequency  # 440
n.latin  # "A"
n.octave # 4
n.midi_note_number # 69

n = Note.from_latin('C4')  # base note for scale
n.scale('major') #  NoteSet built from the given note and scale
```

### Interval

`Interval.from_name(name)`: Interval by name

`Interval.from_semitones(num)`: Interval by semitones

```ruby
Interval.from_name('fifth') # define by name
whole_step = Interval.from_semitones(2) # define by # of semitones

c = Note.from_latin('C3')

# use intervals to transpose notes
d = c.add(whole_step)

# use intervals to define chords
cmaj = c.add(['unison','major third','fifth'])
```

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
rb-music-0.0.6 README.md
motion-music-0.0.6 README.md
rb-music-0.0.5 README.md
motion-music-0.0.5 README.md
rb-music-0.0.4 README.md
motion-music-0.0.4 README.md
rb-music-0.0.3 README.md
motion-music-0.0.3 README.md
motion-music-0.0.2 README.md
rb-music-0.0.1 README.md