Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected performance in melody tracking #1409

Open
zumpchke opened this issue Apr 27, 2024 · 0 comments
Open

Unexpected performance in melody tracking #1409

zumpchke opened this issue Apr 27, 2024 · 0 comments

Comments

@zumpchke
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant