Code Monkey home page Code Monkey logo

coltrane's Introduction

Build Status Gem Version Maintainability Test Coverage

Coltrane

A music calculation library/CLI written in Ruby.

Coltrane

CLI (Command Line Interface)

Screenshot Screenshot

Features

  • Generate chord progressions for Jazz, Blues, Pop, or custom and see how to play them
  • Seek chords, see their notes and how to play them
  • Seek scales, see their notes and see how to play them
  • Find chords that are common between 2 scales
  • Find scales containing a chord or a set of notes
  • Find possible progressions of a chord sequence
  • All of the above can be seen on guitar, bass, piano or ukelele representations, no sheet music needed

How to discover a chord name using the notes

coltrane find chord by notes notes:C-E-G

CM:  C E G

To see it on guitar:

coltrane show chord chord:CM7 chord_representation:Guitar

CM:

   โฌค    โฌค  โฌค   โฌค    โฌค  โฌค   โฌค    โฌค             โฌค  โฌค
   โ”โ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”‘    โ”โ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”‘    โ”โ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”‘    โ”โ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”‘
3  โ”‚ โฌคโ”‚ โ”‚ โ”‚ โ”‚ 8  โ”‚ โ”‚ โ”‚ โ”‚ โฌคโ”‚ 3  โ”‚ โฌคโ”‚ โ”‚ โ”‚ โฌค1  โ”‚ โ”‚ โ”‚ โ”‚ โฌคโ”‚
   โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ
4  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 9  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 4  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 2  โ”‚ โ”‚ โฌคโ”‚ โ”‚ โ”‚
   โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ
5  โ”‚ โ”‚ โฌคโ”‚ โฌคโ”‚ 10 โ”‚ โฌคโฌคโ”‚ โ”‚ โ”‚ 5  โ”‚ โ”‚ โฌคโ”‚ โฌคโ”‚ 3  โฌคโฌคโ”‚ โ”‚ โ”‚ โ”‚
   โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ    โ”โ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฟโ”โ”ฅ
6  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 11 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 6  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ 4  โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
   โ”•โ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”โ”™    โ”•โ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”โ”™    โ”•โ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”โ”™    โ”•โ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”โ”™

PS: It looks way better on the terminal ๐Ÿ˜’, specially on iTerm

How to discover a Scale by providing chords

You shall provide chords separated by dashes (--chords CM7-Dm7-EM) or notes (--notes C-Ab-F-G).

For example:

coltrane find scale by chords chords:E6/9-BM

Pentatonic Major C(1) C#(3) D(3) D#(1) E(5) F(0) F#(4) G(2) G#(2) A(4) A#(0) B(5)
Blues Major      C(2) C#(4) D(3) D#(2) E(5) F(1) F#(4) G(2) G#(3) A(4) A#(1) B(5)
Harmonic Minor   C(3) C#(5) D(2) D#(4) E(4) F(3) F#(4) G(2) G#(5) A(3) A#(3) B(4)
Hungarian Minor  C(2) C#(6) D(2) D#(4) E(3) F(3) F#(5) G(1) G#(5) A(3) A#(4) B(4)
Pentatonic Minor C(1) C#(5) D(0) D#(4) E(2) F(2) F#(4) G(0) G#(5) A(1) A#(3) B(3)
Blues Minor      C(2) C#(5) D(1) D#(4) E(2) F(3) F#(4) G(1) G#(5) A(2) A#(4) B(3)
Whole Tone       C(3) C#(3) D(3) D#(3) E(3) F(3) F#(3) G(3) G#(3) A(3) A#(3) B(3)
Flamenco         C(3) C#(4) D(2) D#(5) E(3) F(3) F#(4) G(3) G#(5) A(2) A#(4) B(4)
Major            C(2) C#(4) D(4) D#(2) E(6) F(1) F#(5) G(3) G#(3) A(5) A#(1) B(6)
Natural Minor    C(2) C#(6) D(1) D#(5) E(3) F(3) F#(5) G(1) G#(6) A(2) A#(4) B(4)

When on terminal, the command above will highlight the Scales that have all needed notes. The number in the parenthesis show how many chord notes were included.

How to find common chords

You may use this command to find a chord that may serve as bridge to a different scale/key (i.e. modulation). Coltrane offers you a command to find common chords shared between both keys/scales. Here is how you use it. Say you wanna transition from C Major to D Natural Minor.

coltrane find common chords in scales

Dm:  D F A
Am:  A C E
Dm7: D F A C
Am7: A C E G
CM:  C E G
FM:  F A C
CM6: C E G A
FM6: F A C D
C6/9: C E G A D
F6/9: F A C D G
C6/9(add11): C E G A D F
[...]

You can also see the output in a graphical representation:

Dm:

โ”Œโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ”
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ”‚
โ”‚  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ”‚
โ”‚  โ•‘Dโ™ฎโ•‘  โ•‘Fโ™ฎโ•‘  โ•‘Aโ™ฎโ•‘  โ•‘  โ•‘Dโ™ฎโ•‘  โ•‘Fโ™ฎโ•‘  โ•‘Aโ™ฎโ•‘  โ”‚
โ””โ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ”˜

Am:

โ”Œโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ”
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ”‚
โ”‚  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ”‚
โ”‚Cโ™ฎโ•‘  โ•‘Eโ™ฎโ•‘  โ•‘  โ•‘Aโ™ฎโ•‘  โ•‘Cโ™ฎโ•‘  โ•‘Eโ™ฎโ•‘  โ•‘  โ•‘Aโ™ฎโ•‘  โ”‚
โ””โ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ”˜

[...]

Quickly generate chord progressions

coltrane show progression progression:Jazz representation:Piano root:A

Bm7: 

โ”Œโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ”
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚Fโ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚Fโ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚โ™ฏโ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚โ™ฏโ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ”‚
โ”‚  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ”‚
โ”‚  โ•‘D โ•‘  โ•‘  โ•‘  โ•‘A โ•‘B โ•‘  โ•‘D โ•‘  โ•‘  โ•‘  โ•‘A โ•‘B โ”‚
โ””โ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ”˜

E7: 

โ”Œโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ”
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚Gโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚Gโ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚โ™ฏโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚โ™ฏโ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ”‚
โ”‚  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ”‚
โ”‚  โ•‘D โ•‘E โ•‘  โ•‘  โ•‘  โ•‘B โ•‘  โ•‘D โ•‘E โ•‘  โ•‘  โ•‘  โ•‘B โ”‚
โ””โ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ”˜

A7: 

โ”Œโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ•ฅโ”€โ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”ฌโ”€โ”ฌโ”€โ”
โ”‚ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚Cโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚Cโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”‚โ™ฏโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ•‘ โ”‚โ™ฏโ”‚โ”‚ โ”‚ โ•‘ โ”‚ โ”‚โ”‚ โ”‚โ”‚ โ”‚ โ”‚
โ”‚ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ•‘ โ”•โ•ฅโ”™โ”•โ•ฅโ”™โ”•โ•ฅโ”™ โ”‚
โ”‚  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ•‘  โ”‚
โ”‚  โ•‘  โ•‘E โ•‘  โ•‘G โ•‘A โ•‘  โ•‘  โ•‘  โ•‘E โ•‘  โ•‘G โ•‘A โ•‘  โ”‚
โ””โ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ•จโ”€โ”€โ”˜

You can say Jazz, Pop, Blues, etc. You can also generate progressions in a custom way, using roman numerals:

coltrane custom progression progression_notation:I-vi-V-iidim representation:Text key:D

Generate fretboard sheets for improvising

Sometimes you wanna see the scale on guitar for improvising:

coltrane show scale scale:Pentatonic-Major tone:F

F Pentatonic Major:

E -- | F  -- G  -- A  -- -- C  -- D  -- -- F  -- G  -- A  -- -- C  -- D  --
A A  | -- -- C  -- D  -- -- F  -- G  -- A  -- -- C  -- D  -- -- F  -- G  --
D D  | -- -- F  -- G  -- A  -- -- C  -- D  -- -- F  -- G  -- A  -- -- C  --
G G  | -- A  -- -- C  -- D  -- -- F  -- G  -- A  -- -- C  -- D  -- -- F  --
B -- | C  -- D  -- -- F  -- G  -- A  -- -- C  -- D  -- -- F  -- G  -- A  --
E -- | F  -- G  -- A  -- -- C  -- D  -- -- F  -- G  -- A  -- -- C  -- D  --

             03    05    07    09       12       15    17    19

ProTip: You can force the guitar frets visualization for chords too using the --on guitar_frets option.

Finding the progression of a chord sequence

Perhaps this is the most complex operation that Coltrane performs. It searches the chords on all known scales, generates the progression notation and print in, sorted by notes left out. That is because most songs, specially knowadays, may use chords that contain notes which are outside of that scale.

This command us to analyze songs and discover what they have in common, even tho they have different notes.

Let's say we want to find the possible progressions of Red Hot Chili Pepper's Otherside:

coltrane find progressions from chords chords:Am-F-C-G

i-VI-III-VII   in A Natural Minor (0 notes out)
vi-IV-I-V      in C Major (0 notes out)
iii-I-V-II     in F Major (1 notes out)
vi-III-VII-IV  in D Hungarian Minor (1 notes out)
v-III-VII-IV   in D Natural Minor (1 notes out)
ii-VII-IV-I    in G Hungarian Minor (2 notes out)
ii-VII-IV-I    in G Natural Minor (2 notes out)
vii-V-II-VI    in A# Major (2 notes out)
iv-II-V-III    in D Pentatonic Minor (2 notes out)
v-II-VI-III    in D Blues Minor (2 notes out)
iii-I-IV-II    in F Pentatonic Major (2 notes out)
iv-I-V-II      in F Blues Major (2 notes out)

PS: Notice that vi-IV-I-V is the well known I-V-vi-IV progression, used in a lot of songs.

Interactive mode (shell)

Simply type coltrane or coltrane shell to enable interactive mode. You can then run commands without typing coltrane before, E.G.: scale D harmonic minor

Installation

$ gem install coltrane

PS: Once you install the gem the CLI is installed in your system and it's ready to be used.

Any questions? Feature requests? Bugs?

  1. Find me on Twitter. I'll be glad to answer.
  2. Open an issue.
  3. Join our chatroom

Extra

Contributing

How to contribute

  1. Fork this code
  2. Install the test suite (RSpec) by running good old bundle command
  3. Make your changes and maybe write a test or two.
  4. Check if specs pass bundle exec rspec spec
  5. Submit a PR.

License

The gem is available as open source under the terms of the MIT License.

by Pedro Maciel | twitter | [email protected]

coltrane's People

Contributors

bakedpotato101 avatar dependabot[bot] avatar ercollao avatar follower avatar gmoore avatar jjthrash avatar kianmeng avatar lucascaton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coltrane's Issues

Output sharps/flats based on the key

Super cool app (found it via your reddit post)! I was just reading through the README and saw that one of the Fm7 examples that, for example, D# is in the scale; generally, unless in some larger context, F minor is expressed in terms of flats (Ab, Bb, Db, Eb) instead of their sharp counterparts. It'd be nice to have coltrane express them accordingly.

tl;dr It just feels a little awkward to me to see "D#" in a spot where I'd expect "Eb"; makes me pause a sec and double-check what I'm looking at.

Interval methodlolgy is not iniutive.

When talking about intervals from a music theory perspective, the default is to assume the interval is assenting rather than descending. This is very important because reversing the operation creates undesired structures.

For example, a major chord is defined as a set of Root, Major 3rd, and a Perfect 5th. When building these ascending with a root of C, you end up with the nodes C, E, G which is what you expect. If you use the same intervals, but take them as descending instead, you end up with C, Ab, F which is a F minor chord.

Coltrane only seems to be able handle talking about descending intervals when figuring out the intervals based on two notes. From exploring the docs and trying in irb, I can only seem to create descending intervals means to use the gem, I'd have to think about a lot of operations in reverse to get the correct interval.

(currently works)
D down to C interval example:

2.5.0 :019 > interval = Coltrane::Note['D'] - Coltrane::Note['C']
 => #<Coltrane::IntervalClass:0x0000000001646ff8 @cents=200> 
2.5.0 :020 > interval.name
 => "M2" 

(proposed operation and current results)
C up to D interval example:

2.5.0 :021 > interval = Coltrane::Note['C'] + Coltrane::Note['D']
 => #<Coltrane::Note:0x0000000001671b40 @alteration=0, @integer=2> 
2.5.0 :022 > interval.name
 => "D" 

Problem with coltrane shell in Linux Mint 21

I installed coltrane and Konsole in Linux Mint 21, but when entering
./coltrane shell
I always get:
-> coltrane shell
Abnormal end

I also tried other terminals (rxvt, gnome-terminal, xterm) but none work.
Any idea whether this is a bug?

short commands don't work

% coltrane -h
Coltrane 2.1.0 | Error:  Invalid command.

% coltrane -v
Coltrane 2.1.0 | Error:  Invalid command.

% coltrane help
Coltrane 2.1.0 -- A music querying interface
by Pedro Maciel ([email protected])

Check the chat room for project discussion/help: https://gitter.im/coltrane-music/Lobby


Usage:

  coltrane <subcommand> [options]

Options:
        -h, --help         Show this message
        -v, --version      Print the name and version

enharmonic change

coltrane scale F pentatonic minor
results in:
F Gโ™ฏ Aโ™ฏ C Dโ™ฏ
where it should be:
F Aโ™ญ Bโ™ญ C Eโ™ญ F

The process basically consists of determining the intervals of the pentatonic scale:
minor 3rd, 4th, 5th, flat 7th.
E.g. the minor 3rd of F is foremost a 3rd, hence A. But A is a major 3rd, so we lower it by appending a โ™ญ. Same applies to the other notes.
You could argue that those notes (Gโ™ฏ, Aโ™ญ) are enharmonic equivalents. But this only applies in equal temperament. Also, you'll be battling against a well established convention in music.

See e.g. Step 7, and particularly Step 4 in the explanation on how to build the F pentatonic minor scale.

Status of project?

I just found this project today and I think it's great, however it seems a bit abandoned (the chat doesn't work for example and some of the links in the readme are 404, open PRs, etc).

I was using it to find chords and it also seems to lack some results that the other online chord finders have. I'd like to contribute but does anyone know what the status of this project is? Finished? On hold?

Ruby 3 support

It seems that this gem doesn't support Ruby 3.
Or it crashes on my PC for some other reason.

$ coltrane
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/router.rb:32:in `build_url'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/router.rb:19:in `get'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:82:in `flow'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `block in start'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `loop'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `start'
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/coltrane-4.0.6/exe/coltrane:24:in `<top (required)>'
/home/morigs/.asdf/installs/ruby/3.0.0/bin/coltrane:23:in `load'
/home/morigs/.asdf/installs/ruby/3.0.0/bin/coltrane:23:in `<main>'
wrong number of arguments (given 1, expected 2)
/home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `block in start': no implicit conversion of nil into Hash (TypeError)
        from /home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `loop'
        from /home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/gambiarra-0.0.3/lib/gambiarra/app.rb:26:in `start'
        from /home/morigs/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/coltrane-4.0.6/exe/coltrane:24:in `<top (required)>'
        from /home/morigs/.asdf/installs/ruby/3.0.0/bin/coltrane:23:in `load'
        from /home/morigs/.asdf/installs/ruby/3.0.0/bin/coltrane:23:in `<main>'

chords not recognized

{:notes=>["F#", "C#", "A", "G#"], :chord=>"?"}] #Gbmin add9
{:notes=>["C#", "C", "F"], :chord=>"?"}, #Dbmaj7(no5)

undefined method `match?'

I just did gem install coltrane, then tried running the coltrane cli and I got this error:

/Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/core_ext.rb:7:in `underscore': undefined method `match?' for /[A-Z-]|::/:Regexp (NoMethodError)
Did you mean?  match
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane/classic_scales.rb:25:in `block in <module:ClassicScales>'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane/classic_scales.rb:24:in `each'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane/classic_scales.rb:24:in `<module:ClassicScales>'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane/classic_scales.rb:5:in `<module:Coltrane>'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane/classic_scales.rb:3:in `<top (required)>'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/lib/coltrane.rb:29:in `<top (required)>'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/cwatts/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/coltrane-1.0.22/exe/coltrane:9:in `<top (required)>'
	from /Users/cwatts/.rbenv/versions/2.3.0/bin/coltrane:23:in `load'
	from /Users/cwatts/.rbenv/versions/2.3.0/bin/coltrane:23:in `<main>'

crashes with C9 or Cadd9 or C add9 or C add 9 etc.

Welcome to Coltrane 4.1.1 (You chose: chords)
? What do you need (You chose: show chord)
? Which chord?

C add 9
? How do you wanna see it? (You chose: Guitar)
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/theory/note.rb:29:in initialize' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/theory/note.rb:43:in new'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/theory/note.rb:43:in []' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/theory/chord.rb:93:in parse_from_name'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/theory/chord.rb:22:in initialize' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/commands/get_chords_from_string.rb:6:in new'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/commands/get_chords_from_string.rb:6:in block in run' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/commands/get_chords_from_string.rb:5:in map'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/commands/get_chords_from_string.rb:5:in run' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/commands/command.rb:7:in run'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/ui/views/show_chord.rb:14:in render' /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/lib/coltrane/ui/base_view.rb:5:in render'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/view.rb:34:in respond' /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/route.rb:13:in respond'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/history.rb:31:in refresh' /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/router.rb:21:in get'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:82:in flow' /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in block in start'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in loop' /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in start'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/exe/coltrane:24:in <top (required)>' /opt/local/bin/coltrane:23:in load'
/opt/local/bin/coltrane:23:in <main>' Bad constructor. Wrong argument(s). Traceback (most recent call last): 5: from /opt/local/bin/coltrane:23:in

'
4: from /opt/local/bin/coltrane:23:in load' 3: from /opt/local/lib/ruby2.7/gems/2.7.0/gems/coltrane-4.1.1/exe/coltrane:24:in <top (required)>'
2: from /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in start' 1: from /opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in loop'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/gambiarra-0.0.5/lib/gambiarra/app.rb:26:in `block in start': no implicit conversion of nil into Hash (TypeError)

Run in Hyper with `Abnormal end`

I'm a Windows user, but I can't run examples in Hyper. Message Abnormal end is printed. I guess some plugins should be installed. So what can I do next? Thanks!

Broken link for "Why did I write this library" URL in `README.md`.

Currently in the Extras section of the README the link for "Why did I write this library" points to https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227:

  • * [Why did I write this library](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).

However, that link now appears to redirect to https://blog.pedromaciel.com/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227 which generates a browser warning due to a self-signed certificate.

Side Note:

  • The certificate served seems to be the default for a project named "Traefik", which had an issue opened that might be relevant: traefik/traefik#5849

If you ignore the browser warning a 404 status is returned.

Due to some issues with redirects & parameters it was a little non-trivial to actually find the copy of the page that the Internet Archive's Wayback Machine does actually have but, for anyone else interested, here's the link which displays the content:

provide install via Homebrew

Project looks great, just thinking it would be nice to have install available via os package manager as well.

Commands not recognized

Recently I've installed coltrane and have been trying to get ruby to recognize
While the Core Music Theory library works with irb, the main CLI doesn't recognize any of the coltrane commands.

Here's an example of what I get when I input a command in irb

irb(main):005:0> coltrane chords --notes C-E-G
/usr/local/Cellar/ruby/3.1.2/lib/ruby/3.1.0/irb/workspace.rb:119:in `eval': (irb):5: syntax error, unexpected constant, expecting `do' or '{' or '(' (SyntaxError)
coltrane chords --notes C-E-G
                        ^
from /usr/local/Cellar/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
from /usr/local/opt/ruby/bin/irb:25:in `load'
from /usr/local/opt/ruby/bin/irb:25:in `<main>'

Outside of irb, I get the coltrane: command not found statement.
I'm using coltrane 4.1.1 and ruby 3.1.2p20

Coltrane doesn't display enharmonic intervals correctly

Coltrane does not give the correct name when creating an interval that has a more common enharmonic equivalent. Due to this, Coltrane cannot be used for music theory centric applications.

This interval is C to D (or D _down to _ C) and should be a Major Second (Correct)

2.5.0 :007 > interval = Coltrane::Note['D'] - Coltrane::Note['C']
 => #<Coltrane::IntervalClass:0x000000000142e248 @cents=200> 
2.5.0 :008 > interval.name
 => "M2" 

This interval is C to D# (or D# _down to _ C) and should be an Augmented Second (Wrong)

2.5.0 :009 > interval = Coltrane::Note['D#'] - Coltrane::Note['C']
 => #<Coltrane::IntervalClass:0x00000000013e46c0 @cents=300> 
2.5.0 :010 > interval.name
 => "m3" 

This interval is F to B (or B _down to _ F) and should be an Augmented Fourth (Correct)

> 2.5.0 :017 > interval = Coltrane::Note['B'] - Coltrane::Note['F']
>  => #<Coltrane::IntervalClass:0x00000000016d3958 @cents=600> 
> 2.5.0 :018 > interval.name
>  => "A4" 

This interval is B to F (or F _down to _ B) and should be a diminished fifth (Wrong, it gives and Augmented Fourth)

> 2.5.0 :017 > interval = Coltrane::Note['F'] - Coltrane::Note['B']
>  => #<Coltrane::IntervalClass:0x00000000016d3958 @cents=600> 
> 2.5.0 :018 > interval.name
>  => "A4" 

This interval is B to Fb (or Fb _down to _ B) and should be a doubly diminished fifth (Wrong, it gives a Perfect 4th)

2.5.0 :033 > interval = Coltrane::Note['Fb'] - Coltrane::Note['B']
 => #<Coltrane::IntervalClass:0x0000000001514810 @cents=500> 
2.5.0 :034 > interval.name
 => "P4" 

Output natural symbols only when relevant

This is another issue of preference. At least in my experience, you usually only see natural symbols in music when the context that you're in says that you should be playing a flat or sharp. Seeing them in, say, the D major scale example makes me pause and double-check the context I'm in: "hmmm... I see Gโ™ฎ--did I actually ask for the right thing?".

Seems like the UI would be less cluttered and it'd be a little more natural to only include the natural symbols when they mean to do something out of the scale's normal mode: like if the user wanted to see "f harmonic minor", you'd show an Eโ™ฎ instead of Eโ™ญ.

Again, just some thoughts I figured I throw out there.

Feature request: abilty to invert intervals

Coltrane should be able to invert intervals which is a very basic and useful operation for manipulating intervals.

For example, if I created an interval of a Perfect Fifth Coltrane should have a way to invert the original interval to a Perfect Fourth.

Abnormal end

Hello,
When using CLI parameters, I got an "Abnormal end" message.

To reproduce:

$ docker run -it --entrypoint /bin/bash ruby
$ gem install coltrane
$ coltrane chords CM7 --on guitar
This terminal doesn't seem to support true color. Try something like iTerm2 (for macOS), VTE or Konsole (for linux) or Hyper (for Windows) and you'll see the true magic!

-> coltrane chords CM7 --on guitar 

Abnormal end

coltrane ... --on guitar: Strings depicted in unconventional (reverse) order

coltrane scale F pentatonic --on guitar

Strings are depicted in unconventional order: topmost in coltrane's representation is the low E string:

E  | -- -- G  -- A  -- B  -- -- D  -- E  -- -- G  -- A  -- B  -- -- D  --
A  | -- B  -- -- D  -- E  -- -- G  -- A  -- B  -- -- D  -- E  -- -- G  --
D  | -- E  -- -- G  -- A  -- B  -- -- D  -- E  -- -- G  -- A  -- B  -- --
G  | -- A  -- B  -- -- D  -- E  -- -- G  -- A  -- B  -- -- D  -- E  -- --
B  | -- -- D  -- E  -- -- G  -- A  -- B  -- -- D  -- E  -- -- G  -- A  --
E  | -- -- G  -- A  -- B  -- -- D  -- E  -- -- G  -- A  -- B  -- -- D  --

Compare this to the representations found via: google image search, where topmost is the high E string.

abnormal end

I also run in "abnormal end" error when running it on Linux (debian)
Is this project still maintained?
:(

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.