Skip to content

Unexpected performance in melody tracking #1409

Open
@zumpchke

Description

@zumpchke

Hi, I have an audio clip with a pretty clear synth based melody but the melodia is unable to track it.

Here is my code

from mir_eval.sonify import pitch_contour
import numpy
import essentia.standard as es
import matplotlib.pyplot as plt

sample_rate = 44100
loader = es.MonoLoader(filename="better_off_alone_segment.mp3")
audio = loader()
print(f"Duration of the audio sample [sec]: {len(audio) / sample_rate:.3f}")
# PitchMelodia takes the entire audio signal as input - no frame-wise processing is required here...
pExt = es.PitchMelodia(frameSize=2048, hopSize=128)
pitch, pitchConf = pExt(audio)


time = numpy.linspace(0.0, len(audio) / sample_rate, len(pitch))
## plot the pitch contour and confidence over time
f, axarr = plt.subplots(2, sharex=True)
axarr[0].plot(time,pitch)
axarr[0].set_title('estimated pitch[Hz]')
axarr[1].plot(time,pitchConf)
axarr[1].set_title('pitch confidence')
plt.show()

from tempfile import TemporaryDirectory
temp_dir = TemporaryDirectory()


synthesized_melody = pitch_contour(time, pitch, 44100).astype(numpy.float32)[:len(audio)]
es.AudioWriter(filename = temp_dir.name + 'melody.wav', format='wav')(es.StereoMuxer()(audio, synthesized_melody))

print(temp_dir.name + 'melody.wav')

Figure_1

better_off_alone_segment.mp3.zip

Any ideas what I can do to improve performance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions