From 3ee3f76ad52cd3a00fc4e29f61447cc2b789c6f5 Mon Sep 17 00:00:00 2001 From: Xavier Lizarraga Date: Tue, 23 Jul 2024 12:47:12 +0200 Subject: [PATCH] Fix issue with the octaves left from the reference --- src/essentia/essentiamath.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/essentia/essentiamath.h b/src/essentia/essentiamath.h index 3b8d06da4..9e3606859 100644 --- a/src/essentia/essentiamath.h +++ b/src/essentia/essentiamath.h @@ -766,13 +766,12 @@ inline int note2octave(std::string note) { inline std::string midi2note(int midiNoteNumber) { std::string NOTES[] = {ALL_NOTES}; - //int nNotes = NOTES.size(); int nNotes = *(&NOTES + 1) - NOTES; int CIdx = 3; int diffCIdx = nNotes - CIdx; int noteIdx = midiNoteNumber - 69; int idx = abs(noteIdx) % nNotes; - int octave = (CIdx + 1) + floor((noteIdx + diffCIdx) / nNotes); + int octave = (CIdx + 1) + floor(float(noteIdx + diffCIdx) / nNotes); if (noteIdx < 0) { idx = abs(idx - nNotes) % nNotes; }