pedrozath / coltrane Goto Github PK
View Code? Open in Web Editor NEW🎹🎸A music theory library with a command-line interface
License: MIT License
🎹🎸A music theory library with a command-line interface
License: MIT License
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.
Sound wave harmonic detection
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.
homebrew sucks
If possible, can you provide an option to change the guitar tuning on the command line? It would be super helpful for learning scales and playing around with chords when you switch to a brand new tuning.
Thank you :)
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.
E.g. coltrane find-scale --chords E6/9-BM returns "abnormal end"
coltrane with the "GUI" works.
Version: coltrane 4.1.2
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"
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>'
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?
{:notes=>["F#", "C#", "A", "G#"], :chord=>"?"}] #Gbmin add9
{:notes=>["C#", "C", "F"], :chord=>"?"}, #Dbmaj7(no5)
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.
r =RomanChord.new("I7", key: "C")
r.chord.tritone_substitution.name
This gives "G7" when it should be "Gb7".
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!
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
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"
I know, this is not trivial and most likely not going to be implemented 😄 but who knows, maybe someone has the time and interest to do it someday (?)
Project looks great, just thinking it would be nice to have install available via os package manager as well.
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?
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
:
Line 261 in c05d407
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:
I also run in "abnormal end" error when running it on Linux (debian)
Is this project still maintained?
:(
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:ininitialize' /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:ininitialize' /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:inblock 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:inrun' /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:inrender' /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:inrespond' /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:inrefresh' /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:inflow' /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:inloop' /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:inload' 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:instart' 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)
I am using ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
and Gem v2.7.7
.
I found this link referring to deprecating Gem v2.7.6
. I'm not sure if this issue comes from my installation or Coltrane?
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.
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
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>'
% 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.