Skip to content

Commit a770d1b

Browse files
authored
Merge pull request #1435 from xaviliz/fix-note2midi
Fix issue with the octaves left from the reference
2 parents 52d8a35 + 3ee3f76 commit a770d1b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/essentia/essentiamath.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,12 @@ inline int note2octave(std::string note) {
766766

767767
inline std::string midi2note(int midiNoteNumber) {
768768
std::string NOTES[] = {ALL_NOTES};
769-
//int nNotes = NOTES.size();
770769
int nNotes = *(&NOTES + 1) - NOTES;
771770
int CIdx = 3;
772771
int diffCIdx = nNotes - CIdx;
773772
int noteIdx = midiNoteNumber - 69;
774773
int idx = abs(noteIdx) % nNotes;
775-
int octave = (CIdx + 1) + floor((noteIdx + diffCIdx) / nNotes);
774+
int octave = (CIdx + 1) + floor(float(noteIdx + diffCIdx) / nNotes);
776775
if (noteIdx < 0) {
777776
idx = abs(idx - nNotes) % nNotes;
778777
}

0 commit comments

Comments
 (0)