tonaljs / tonal

A music theory library for Javascript
https://tonaljs.github.io/tonal/docs
3.85k stars 220 forks source link

Tonal.Chord.detect(["D", "F", "C"]) empty result #234

Closed jacopomaroli closed 2 years ago

jacopomaroli commented 4 years ago

Hey guitar player here! We sometimes omit the 5th from a chord to make it more manageable to play. Having tonic, 3rd and 7th should be enough to characterize a chord and identify a Dmin7. (other implementations do here and here) Since I'm transcribing from tabs in realtime, a workaround on the input is not really manageable for my specific use case

I'm using tonal 4.6.0 pulled from jsdelivr CDN here

~~If you're happy with it, I can open you a PR on https://github.com/tonaljs/tonal/blob/master/packages/chord-type/data.ts#L24 adding ["1P 3m 7m", "minor seventh", "m7 min7 mi7 -7"], just right after that line.~~

Guitar world will thank you :)

edit: actually you could just programmatically infer all the alternative versions by dynamically populating a version of that array with the 5P removed

razznblue commented 3 years ago

Yes, you don't need the 5th in a chord to identify it. As you mentioned, The 3rd and 7th are the notes to look at to identify the basic chord quality. I'm a piano player myself and I often omit the fifth in many chords as well. I see what you are wanting.

Tonal.Chord.detect(["D","F","C"]) should return Dm7

It would be great to identify seventh and even ninth chords like this! It definitely could be added in!

jacopomaroli commented 3 years ago

I just filed in the proposal I was working on. Let me know what you think!