Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function noteDetune (note, offset) {
const props = noteProps(note)
const newNote = Note.props(Note.fromMidi(props.midi + offset))
return {
name: unicodeNote(Note.enharmonic(newNote.pc)),
octave: newNote.oct
}
}
items () {
const items = []
const startCode = Note.midi(this.root)
for (let i = 0; i < this.length; i++) {
const note = Note.props(Note.fromMidi(startCode + i))
const item = {
fret: i,
octave: note.oct,
name: note.pc
}
const enharmonic = Note.enharmonic(item.name)
if (enharmonic !== item.name) {
item.flatName = item.name.replace('b', '♭')
item.name = enharmonic.replace('#', '♯')
}
items.push(item)
}
return items
}
},
stringNotes (root) {
const notes = []
const startCode = Note.midi(root)
for (let i = 0; i <= this.frets; i++) {
const note = Note.props(Note.fromMidi(startCode + i))
const item = {
fret: i,
octave: note.oct,
name: note.pc
}
const enharmonic = Note.enharmonic(item.name)
if (enharmonic !== item.name) {
item.flatName = item.name.replace('b', '♭')
item.name = enharmonic.replace('#', '♯')
}
notes.push(item)
}
return notes
},
fretNote (note, octave, fret) {
items () {
const items = []
const startCode = Note.midi(this.root)
for (let i = 0; i < this.length; i++) {
const note = Note.props(Note.fromMidi(startCode + i))
const item = {
fret: i,
octave: note.oct,
name: note.pc
}
const enharmonic = Note.enharmonic(item.name)
if (enharmonic !== item.name) {
item.flatName = item.name.replace('b', '♭')
item.name = enharmonic.replace('#', '♯')
}
items.push(item)
}
return items
}
},
stringNotes (root) {
const notes = []
const startCode = Note.midi(root)
for (let i = 0; i <= this.frets; i++) {
const note = Note.props(Note.fromMidi(startCode + i))
const item = {
fret: i,
octave: note.oct,
name: note.pc
}
const enharmonic = Note.enharmonic(item.name)
if (enharmonic !== item.name) {
item.flatName = item.name.replace('b', '♭')
item.name = enharmonic.replace('#', '♯')
}
notes.push(item)
}
return notes
},
fretNote (note, octave, fret) {
.map(note => (note.includes('b') ? Note.enharmonic(note) : note))
);