tonaljs / tonal

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

tonal-fretboard #8

Open danigb opened 8 years ago

danigb commented 8 years ago

Hi @devboell,

I would like to have a tonal-fretboard module, and I thought maybe we can share some ideas before. The API I was thinking is something like this:

What do you think? Do you find useful? Anything missing?

Cheers, Dani

devboell commented 8 years ago

Hey Dani,

Sure, sounds good. You have to bear in mind that guitarists like to use different tunings. Next to standard tuning, the are lots of alternate tunings, some of which are used often. Here's a whole list: https://en.wikipedia.org/wiki/List_of_guitar_tunings

As long as build(tuning, first, last) takes an array of notes as a first param, there's no problem, but it may complicate the naming in the tuning-dictionary. To only have 'guitar' would be a limited use case. And you would have to handle that string instruments have different number of strings, but I assume you know that.

I am not quite sure what you mean by 'set' in buildSet?

danigb commented 8 years ago

Great! Thanks, I would try to write a first implementation. By set I'm basically referring to scales, a collection of unique pitch classes (https://en.wikipedia.org/wiki/Set_theory_(music). It can be used to represent chords.

grimmdude commented 8 years ago

This would be a useful module. I'm happy to help as well,

-Garrett

danigb commented 8 years ago

Hi Garret! The first version of the module it's implemented here: https://github.com/danigb/tonal/blob/master/modules/fretboard/index.js

It's not published on npm yet. Suggestions and PR welcomed :-)

grimmdude commented 8 years ago

Nice, it's looking good. I just though of an interesting idea; a method that takes a chord name and returns an array of objects containing the string and fret number. Could be useful for building chord charts, etc. The logic would have to take into account tuning of course, and nearby chord notes that are within reaching distance of each other.

chordShapes(chord) => [{'E2' : 3, 'A2' : 2}]

I'll see if I can come up with something in my fork,

-Garrett

danigb commented 8 years ago

Great Garret! Looking forward a PR ;-) Don't hesitate to ask if you found any trouble.

mitselek commented 8 years ago

If this means I could generate a chord diagrams for arbitrary tuning, then Your work might start an unexpected revolution in pop music.

mitselek commented 8 years ago

The classical tuning is mathematically quite solid but I'm not sure it's optimal for fingers. Next thing somebody will build a tuning generator where you feed in the array of chords to play and get back finger-optimized tuning. Combining this with guitar tuner app will make any piece playable for everybody. Imagine an app, where you put in your favourite song and instantly get back to adjusted tuner plus chord diagrams plus chord-annotated lyrics. 🎸

grimmdude commented 7 years ago

Hi @danigb,

I'm working on a browser based project which I would like to incorporate this package with. I'm having a bit of a hard time getting this built correctly for the browser, could you please point me in the right direction? Thanks,

-Garrett

grimmdude commented 7 years ago

Nevermind, I see now the build/index.js in the npm package and was able to use browserify to get that going. Thanks!

-Garrett

grimmdude commented 7 years ago

Sorry...so many messages. I would like to know though how you would build this package during development? I may be contributing more to this package shortly.

-Garrett

danigb commented 7 years ago

Hi @grimmdude

Yes... to many packages. I'm thinking in a way to reduce them and provide a simpler build process.

There's a pre-built package in dist folder (but it doesn't include fretboard). The process is done with rollup: see the "build" and "dist" scripts in package.json and the rollup.config.dist.js file.

Hope it helps.

grimmdude commented 7 years ago

Thanks @danigb, I think I figured it out. FYI I'm using this along with VexChords to create a guitar chord lookup page here: http://musictheorysite.com/guitar-chord-chart/

That page makes it easier to dial this package in a bit. I submitted a PR, and will probably have more to come. Working on limiting the shapes chordShapes() it returns to be more realistically reachable.

-G

danigb commented 7 years ago

Hi @grimmdude

The chord lookup page looks terrific! Great job! I tried to create something like this but I never finished it (https://danigb.github.io/tonal-app/) ... Glad to see that some people do! 👍

Thanks for your PR, and sorry for the delay. I still think this module it's a little bit too complex (at least the interface to it) and there's room to improve, so any PR will be more than welcomed ;-)

Cheers, Dani

martijnmichel commented 4 years ago

I just found this issue while scrolling around a bit in tonal and thought of a little tool i made some years back which im planning to revise with tonal (and Vue)

http://tocadomusic.nl/guitarneck/

4lejandrito commented 4 years ago

Same as @martijnmichel. I'd like to share my project https://react-guitar.com. All the music theory stuff is built on top of tonal. Thanks so much for such a great project!

justinlawrence commented 4 years ago

Love this, nice work Alejandro!

On Mon, 21 Sep 2020 at 22:49, Alejandro Tardín notifications@github.com wrote:

Same as @martijnmichel https://github.com/martijnmichel. I'd like to share my project https://react-guitar.com. All the music theory stuff is built on top of tonal. Thanks so much for such a great project!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tonaljs/tonal/issues/8#issuecomment-696396590, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTMHY3QVAEIHXMZMI474LSG7C5VANCNFSM4CDGS6QQ .

danigb commented 4 years ago

Nice work! Probably you already know that there's a Projects using tonal section of the readme. PRs to add those projects to the list are welcomed.

4lejandrito commented 4 years ago

Thanks @danigb! I just sent https://github.com/tonaljs/tonal/pull/213.

leocaseiro commented 3 years ago

Hey @danigb, just found that opened issue. Are there any chances to bring back the fretboard module in the newest version?