Open daks opened 10 months ago
Maybe my question can be extended to: is it possible to modify (add/remove) any note anywhere on the fretboard?
I tried to manipulate my fretboard fretboard.elements
with OpenNote and FrettedNote without success.
Maybe it's not the objective of this package, which is more to generate scales and chords easily.
Hi, thank you for opening the issue
If I understand well, to do what you want you could either :
get_scale
method on the NoteContainer Object. From this scale you can just drop the string you want. Here is a full example :from fretboardgtr import FretBoard
from fretboardgtr.notes_creators import ScaleFromName
TUNING = ["E", "A", "D", "G", "B", "E"]
config = {
"general": {
"first_fret": 0,
"last_fret": 16,
"fret_width": 50,
"show_note_name": True,
"show_degree_name": False,
}
}
fretboard = FretBoard(config=config)
c_scale = ScaleFromName(root="C", mode="Ionian").build().get_scale(TUNING)
c_scale[-1] = []
fretboard.add_scale(c_scale, root="C")
fretboard.export("c_scale.svg", format="svg")
To explain a bit more
ScaleFromName(root="C", mode="Ionian").build()
is actually a NoteContainer
so we can call the get_scale
method. This method returns a List of List of string.
We replace the last element of this list by a empty list. This way no note are created nor shown on the last string of the fretboard.
Feel free to reopen this issue if this is not what you were expecting
* Deal with the elements directly. I've checked this part, and it was not really easy to do. So in the latest version (0.2.6), I've introduced the `get_scale ` method on the NoteContainer Object. From this scale you can just drop the string you want.
Yes, this is what I tried to do: I generated a C scale and wanted to remove all notes on the 1st string
This is my code
config = {
"general": {
"first_fret": 0,
"last_fret": 12,
"show_tuning": False,
"show_frets": True,
"show_note_name": True,
"show_nut": True,
}
}
fretboard_config = FretBoardConfig.from_dict(config)
fretboard = FretBoard(config=fretboard_config)
c_major = ScaleFromName(root="C", mode='Ionian').get()
fretboard.add_notes(scale=c_major)
fretboard.export("c_scale_half_fretboard.svg", format="svg")
which generates the image visible in the README.
What I wanted to obtain was this (modified with Inkscape)
so my idea was:
remove any note anywhere on the fretboard, that's when I tried to play with OpenNote
and FrettedNote
without success
I tried accessing to fretboard.elements
using to_list()
and manipulate those of classes notes.FrettedNotes
and notes.OpenNote
is it possible to completely remove all notes from a string?
Yes, with the last version :
from fretboardgtr import FretBoard
from fretboardgtr.notes_creators import ScaleFromName
TUNING = ["E", "A", "D", "G", "B", "E"]
config = {
"general": {
"first_fret": 0,
"last_fret": 16,
"fret_width": 50,
"show_note_name": True,
"show_degree_name": False,
}
}
fretboard = FretBoard(config=config)
c_scale = ScaleFromName(root="C", mode="Ionian").build().get_scale(TUNING)
c_scale[-1] = []
fretboard.add_scale(c_scale, root="C")
fretboard.export("c_scale.svg", format="svg")
If you want to keep the "E" from the tuning you can replace
- c_scale[-1] = []
+ c_scale[-1] = [TUNING[-1]]
remove any note anywhere on the fretboard, that's when I tried to play with OpenNote and FrettedNote without success
Yes you can with manipulation of the elements
but i'm not really recommand that since you will manipulate some internals. You'd be better manipulating this higher-level matrix : c_scale = ScaleFromName(root="C", mode="Ionian").build().get_scale(TUNING)
representing the scale according to the tuning.
I just tried to use this new possibility, but got a weird result: 1st string is in fact blanked but two notes appeared after the last_fret
$ pip list|grep fretboardgtr
fretboardgtr 0.2.7
My code looks like
config = {
"general": {
"first_fret": 0,
"last_fret": 12,
"show_tuning": False,
"show_frets": True,
"show_note_name": True,
"show_nut": True,
}
}
TUNING = ["E", "A", "D", "G", "B", "E"]
fretboard = FretBoard(config=config)
c_major = ScaleFromName(root="C", mode='Ionian').build().get_scale(TUNING)
c_major[-1] = []
fretboard.add_scale(scale=c_major, root="C")
fretboard.export("/tmp/t.svg", format="svg")
Weird in fact, thanks for reporting I'll check what's going on when I could It's like the index of the last fret is represented as n+1 somewhere
I guess you can use this workaround in the mean time
{
"last_fret":11
}
Is your feature request related to a problem? Please describe.
I looked at a way to blank a string, e.g. remove all notes on it. I didn't find any but I may have simply missed it.
Describe the solution you'd like
I generated a C scale fretboard and want to blank the high E one (1st string), because notes are the same that on the low E (6th string).
Describe alternatives you've considered
Open the svg and then edit it manually to remove all notes on the 1st string.
Additional context
I just found this Python library and it's really great, thanks for sharing it :)