Git Product home page Git Product logo

Comments (8)

hpx7 avatar hpx7 commented on September 24, 2024 2

It doesn't seem to work with Python3:

Loading audio...
Extracting melody f0 with MELODIA...
Converting Hz to MIDI notes...
Traceback (most recent call last):
  File "audio_to_midi_melodia.py", line 225, in <module>
    savejams=args.jams)
  File "audio_to_midi_melodia.py", line 191, in audio_to_midi_melodia
    notes = midi_to_notes(midi_pitch, fs, hop, smooth, minduration)
  File "audio_to_midi_melodia.py", line 115, in midi_to_notes
    if p_prev > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

from audio_to_midi_melodia.

justinsalamon avatar justinsalamon commented on September 24, 2024 1

This specific error is described in #5. Fixing this issue seems straight forward, full python 3 support might require a few more changes. I'll have time to look into python 3 support in about 1 month. In the meanwhile, the easiest solution is to create a python 2.7 environment (e.g. using miniconda) and run the script from within this environment. Thanks in advance for your patience!

from audio_to_midi_melodia.

DavidParkin avatar DavidParkin commented on September 24, 2024 1

I changed the initialisation of p_prev (about line 107) to
p_prev = 0

from audio_to_midi_melodia.

FoxesAreCute avatar FoxesAreCute commented on September 24, 2024 1

I just want to add, there are two instances of p_prev you need to change. Line 126, and 107. Otherwise you get the error specified here

The codes sound, no pun intended and it's honestly amazing how it works with such a newer version of python so easily. I wouldn't abandon this project, it has a LOT of potential for DJs, Parody makers, and samplers like me alike.

from audio_to_midi_melodia.

ucasiggcas avatar ucasiggcas commented on September 24, 2024

I have the same question.
We also need python3 support !

from audio_to_midi_melodia.

DavidParkin avatar DavidParkin commented on September 24, 2024

What is broken with Python 3? I've just used it.

from audio_to_midi_melodia.

moziguang avatar moziguang commented on September 24, 2024

I fixed it as follow.
change
notes.append((onset_sec, duration_sec, p_prev))
to
notes.append((onset_sec, duration_sec, int(p_prev)))

from audio_to_midi_melodia.

Wattbag avatar Wattbag commented on September 24, 2024

Great code Justin πŸ‘ & Great fix guys !
Set p_prev = 0 at line 107
Replace p_prev by int(p_prev) at lines 121 & 133 and it just works fine in Python 3 !! Awesome result !!

from audio_to_midi_melodia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.