Going beyond creating a chord library #286
Replies: 3 comments 5 replies
-
I think ChordType.get() should do what you're looking for: Tonal.ChordType.get('M7').name; // "major seventh" |
Beta Was this translation helpful? Give feedback.
-
@sedwardmino DId you see the video and code I sent to Rene yesterday on Discord? That looks like the same code you're posting here. I tried it out in a CodePen and it works fine for me. I also sent him a video explaining how it works, where you can see that the setTimeout runs.. Here it is. You will have to add the code actually playing the chord where it says or "Play the chord here" or call a function playing the chord from there. The issue that it repeats is probably because you hit a button multiple times. You could remove the event listener from the button-div at the top of the playChord function, the re-add it inside the setTimeout after the chord has played. |
Beta Was this translation helpful? Give feedback.
-
The first code (#1) shows the buttons as we want it but does not play any of the chords or say their names. The second code (#2) populates all the chord buttons along with the ones we want played. How would I be able to maintain only the chord buttons I want to be played (the four buttons in the top row which are M, m, dim and aug) and eliminate the other chord buttons (all the buttons that are below row 1) I do not want to see in the UI? code #1 const buttons = document.querySelector(".buttons"); const arrayOfChordNames = ["M", "m", "aug", "dim"]; arrayOfChordNames.forEach((chord) => { function createElement(element, content) { code #2 const sound = new Howl({ const startNotes = ['C', 'C#', 'Db', 'D', 'D#', 'Eb', 'E', 'F', 'F#', 'Gb', 'G', 'G#', 'Ab', 'A', 'A#', 'Bb', 'B']; const startNoteSelector = document.querySelector('#start-note'); const intervalsInChord = document.querySelector('.intervals-in-chord'); let selectedStartNote = 'C'; const app = {
} const soundEngine = {
} app.init(); const allChordNames = entries() |
Beta Was this translation helpful? Give feedback.
-
Hope someone can help with this! So using the tonal js libary i was able to create a chord library but now i want to expand on that. I am trying to be able to have the button speak the name of the button. If the button m7 is clicked we want the audio to say "minor seven". Is there a certain place where the names of these buttons are, for example where do we find the list of names for the chord buttons? Is there a specific place they are stored, or possibly a line of code I could use to call each chord button type?
Example with the code below, when I click on the button named "minor 7"
<script> /* JS comes here */ function textToAudio() { let msg = document.getElementById("button").value;
Beta Was this translation helpful? Give feedback.
All reactions