Comments (12)
Hi,
I'm working hard on next version of tonal (0.50.x series) that I hope will be release at the end of next week. It will include note-range by default. Meanwhile, the only option is to clone this repo and install the package manually:
npm install ../path-to-tonal/packages/note-range
Cheers,
Dani
from tonal.
Good to hear a new version is coming soon!
I think I have a workaround for now, but I have a question on how you will be handling enharmonics for chromatic scales. My use case is that I want to generate a noteMatrix representing a guitar fretboard, based on a tuning. So, roughly my code is this:
const defaultTuning = List(['e3', 'a3', 'd4', 'g4', 'b4', 'e5'])
const SCALE = '1 2b 2 3b 3 4 4# 5 6b 6 7b 7'.split(' ')
const noteMatrix = (tuning = defaultTuning) => {
const matrix = []
for (const note of tuning) {
const string = []
string.push(tonal.scale(SCALE, note))
string.push(tonal.transpose(note, 'P8'))
matrix.push(List(string));
}
return List(matrix)
}
This results f.i. in that a raised A3 on the sixth string will be A#3, but on the fifth string Bb3, because for each string the scale method uses a different tonic. But when I render the fretboard I want them both to display "A#3 / Bb3" (and this for all 'simple' enharmonics)
I will write a formatting method to handle this, but I am curious for your thoughts on this.
thanks a lot,
Rob
from tonal.
Hi Rob, this is an interesting use case. Currently I'm outside for three days, but I will think about it, and propose some solutions as soon I'm back. ๐
El 30/04/2016, a las 09:35, devboell [email protected] escribiรณ:
Good to hear a new version is coming soon!
I think I have a workaround for now, but I have a question on how you will be handling enharmonics for chromatic scales. My use case is that I want to generate a noteMatrix representing a guitar fretboard, based on a tuning. So, roughly my code is this:const defaultTuning = List(['e3', 'a3', 'd4', 'g4', 'b4', 'e5'])
const SCALE = '1 2b 2 3b 3 4 4# 5 6b 6 7b 7'.split(' ')const noteMatrix = (tuning = defaultTuning) => {
const matrix = []
for (const note of tuning) {
const string = []
string.push(tonal.scale(SCALE, note))
string.push(tonal.transpose(note, 'P8'))
matrix.push(List(string));
}
return List(matrix)
}
This results f.i. in that a raised A3 on the sixth string will be A#3, but on the fifth string Bb3, because for each string the scale method uses a different tonic. But when I render the fretboard I want them both to display "A#3 / Bb3" (and this for all 'simple' enharmonics)
I will write a formatting method to handle this, but I am curious for your thoughts on this.thanks a lot,
Robโ
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
from tonal.
Hi Rob,
I'm back. I assume that you want to display the same scale over the fretboard. The problem with your example is that you are creating a different scale for each string (the same intervals, but with different tonic: different scale). What you need, in fact, is note-range. With note-range you can specify an scale and a first and last note and you will get that scale between that notes. The idea is to apply same scale to different note ranges. If you find useful, I don't mind to implement a tonal-fretboard module that help with that tasks.
from tonal.
Hi Dani,
Thanks for coming back to this. I agree using note-range would be the cleanest solution, so I'll just wait until you are ready with the next release. I don't think a special tonal-fretboard module is necessary, although I am unclear if the current version of note-range already supports the behaviour you describe (on the current master-branch I see range(scale, tonic, length)
.
I think I would need something like this:
range(scale, tonic, startnote, endnote)
or:
range(scale, tonic, startnote, length)
with either of these methods my use case would be adequately covered.
Cheers,
Rob
ps: It seems some of the examples in note-range aren't correct. I couldn't understand these two:
range('1 2 3 4 5 6 7', 'A2', 5) // => ['A2', 'C#3', 'E3', 'A3', 'C#4']
range('1 3 5', 'A2', -5) // => ['A2', 'E3', 'C#3', 'A1', 'E0']
from tonal.
Hi Rob,
The next iteration of tonal is being developed in the 0.50.x branch. Currently the scaleRange function is implemented at the bottom of: https://github.com/danigb/tonal/blob/tonal-0.50.x/packages/tonal-scales/lib/index.js (but I'm not sure if this is going to be the definitive place). The test are here: https://github.com/danigb/tonal/blob/tonal-0.50.x/packages/tonal-scales/test/scale-range-test.js
As you can see the signaure is what you expect:
scaleRange(scale|scaleName, startnote, endnote)
Thanks for pointing the problems with note-range module. I re-implemented the range related functions from scratch and I hope they are solved. Anyway I will look carefully to them.
Cheers,
Dani
from tonal.
Aha, that looks very good!
Thanks a lot Dani, and good luck with the release!
from tonal.
Thanks Rob. Latest update: range related methods finally has its own module (again): https://github.com/danigb/tonal/tree/tonal-0.50.x/packages/tonal-ranges
You can read the API here: https://github.com/danigb/tonal/blob/tonal-0.50.x/packages/tonal-ranges/API.md
from tonal.
cool, I also noticed the chromatic(...)
method, which is very handy. I cloned the 0.50 branch on my machine, and tried to play with it, but I ran into some installation problems. This could well be because I am not installing correctly, or just because the branch-repo is in flux at the moment.
So, I still have a couple of questions, but since you're working on the release, I'm not sure if this the right time to raise them.
from tonal.
Great! This is the perfect time to raise them. Cheers, Dani
from tonal.
ok, then first about the installation, I opened a separate issue, please have look.
from tonal.
Hi again,
The first of 0.50.x series is released with tonal-range included and enhanced. As you can test, you can pass several notes to create comples ranges: tonal.range('C2 C4 E3') => ['C2' ... 'C4' ... 'E3']
I'm closing this issue but please reopen if you have any problem or question.
from tonal.
Related Issues (20)
- tonaljs/key melodic minor chord HOT 3
- How to transpose note along scale based on interval (across octaves)? HOT 1
- Scale.detect() is producing incorrect results when using a tonic outside the list of provided notes HOT 1
- Chord.get cannot parse `G6add9` HOT 8
- `Scale.scaleNotes` returns an array instead of a pcset. HOT 2
- Cannot import into React Native Expo app HOT 1
- Can create localization? HOT 2
- Importing Mode from mode module call back error in browser environment HOT 1
- Natural notes (sign) HOT 2
- Missing import "Named" when using with Angular HOT 2
- Chord.get throws exception on some strings
- Exact versions HOT 6
- Broken link in README. `pitch-notation-abc` is now `abc-notation`
- Chord to leadsheet notation
- Chord detection inconsistency HOT 2
- Edge case with Interval, possibly note octave designation HOT 1
- Scale.get suggestions HOT 1
- note.height id note defined in various README files
- @tonaljs/note Note.distance does not exist
- [Feature request] Unicode symbol list HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tonal.