Replies: 10 comments
-
You need to use the 'key' module to get the data you are looking for. import { Key } from "@tonaljs/tonal"; const keyChords = Key.majorKey("C"); Output: Documentation on the tonal-key package: Hope this helps! :) |
Beta Was this translation helpful? Give feedback.
-
Ah, alright! I missed the
I noticed that the Any advice on how I should be applying the original output to these chords to get the full list of chords/variants that would fit in my key/scale? |
Beta Was this translation helpful? Give feedback.
-
Yes good find about the triads in the tonal-key package! I also am a musician so I was confused too between the scale and key packages! 😂 I love music theory so this library is very interesting to me! Also could you provide a specific example for what you are wanting to access in your last paragraph? It is the part where you mention about getting the full list of chords/variants in your key/scale. |
Beta Was this translation helpful? Give feedback.
-
I am currently running a puppeteer script to scrape the scale/chord associations from some outdated website. 😋 What I needed to get from tonal is, for example, is the following chords when I input "A major":
Basically, I need to be able to access every chord and variation that fits in a key/scale. |
Beta Was this translation helpful? Give feedback.
-
Here is the data I scraped. The source seemed pretty trustworthy, albeit outdated. 🤷♂️ |
Beta Was this translation helpful? Give feedback.
-
Ok I see what you need. I am not too sure at the moment how to do that but I will research it more and hopefully we can find a good solution! |
Beta Was this translation helpful? Give feedback.
-
Since you seem to know a little more about music theory than I do, let me you ask you this: If, for example, C major contains the notes C, D, E, F, G, A, and B, would any chord I composed out of these notes fit in the scale? |
Beta Was this translation helpful? Give feedback.
-
Yes, that is correct. As long as all of the notes in a given chord fit into a scale, then the chord fits in that scale. |
Beta Was this translation helpful? Give feedback.
-
Hello! I think you are mixing several things here. Each key naturally have some chords. You can find them using the Key module 👉 https://github.com/tonaljs/tonal/tree/master/packages/key 1. Major key chordsThe import { Key } from "@tonaljs/tonal";
const majorC = Key.majorKey('C')
const allChords = [
...majorC.chords,
...majorC.secondaryDominants,
...majorC.secondaryDominantsMinorRelative,
...majorC.substituteDominants,
...majorC.substituteDominantsMinorRelative
].filter(x => x)
console.log(allChords) Outputs:
2. Major key scalesBut also each Key has several scales (or modes). And lot of chords can "fit" an scale. That's when Scale.scaleChords('C major') // =>
[
'5', 'sus4',
'M7sus4', 'M',
'maj7', '6',
'sus2', 'sus24',
'M9sus4', 'Madd9',
'maj9', '6/9',
'maj13', 'M7add13'
] That result means that "C5", "Csus4", "CM7sus4", ... chords fits on C major scale. You could apply the same operation to every scale on the key. |
Beta Was this translation helpful? Give feedback.
-
Regarding this, when trying
Cheers update Using |
Beta Was this translation helpful? Give feedback.
-
I am confused as to how to work with this. I was expecting the output to be more along the lines of the actual chords in the scale, i.e: Cmaj, Dmin, Emin, Fmaj, Gmaj, Amin, Bdim, Cmaj7, etc...
Any advice on how I can get the data I am looking for?
Beta Was this translation helpful? Give feedback.
All reactions