Coder Social home page Coder Social logo

music-3's Introduction

music

The music gem provides a means on calculating notes and chords.

Build Status

PullReview stats

Examples:

All examples below assume that include Music has been called, though you can also use Music::Note, Music::Chord, etc...

Creating notes:

note = Note.new(698.46) # Creates a note object with the frequency 698.46
note = Note.new('F#6') # Creates an F sharp note in the 6th octave

Comparing notes:

Note.new(698.46) < Note.new(1975.53)    # => true
Note.new(698.46) == Note.new('F5')      # => true

Converting from frequency to note string and vice versa:

Note.new(698.46).note_string    # => 'F5'
Note.new('Bb3').frequency       # => 233.08

Find how many semitones two notes are apart:

Note.note_distance('A4', 'A#4')     # => 1
Note.note_distance('B1', 'F1')      # => -6
Note.note_distance('G#1', 'Ab1')    # => 0

Adjust frequencies by semitones:

Note.frequency_adjustment(440.0, 15)    # => 1046.50

Create chords:

chord = Chord.new(['C4', 'E4', 'G4'])   # Create a C major chord

Describe chords:

Chord.new(['C4', 'Eb4', 'Gb4'])     # => ['C', :diminished]

For further usage:

TODOs:

Contributing to music

Contributions are welcome. Check out the issues list and feel free to fork and make a pull request if you have any fixes/additions.

Copyright

Copyright (c) 2012 Brian Underwood. See LICENSE.txt for further details.

music-3's People

Contributors

cheerfulstoic avatar janko avatar freerobby avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.