Coder Social home page Coder Social logo

MIDI with negative beginning tick about symusic HOT 5 CLOSED

Natooz avatar Natooz commented on August 25, 2024
MIDI with negative beginning tick

from symusic.

Comments (5)

Yikai-Liao avatar Yikai-Liao commented on August 25, 2024

This looks like an int overflow is occurring, I'll check further.

from symusic.

lzqlzzq avatar lzqlzzq commented on August 25, 2024

Seems same problem occurred in mido.
7PtCAzQKNS

from symusic.

Natooz avatar Natooz commented on August 25, 2024

I found other MIDIs for which the resample operation shifts some of their events to negative time values
midis.zip
They all have in common very large end tick values.

To reproduce:

from pathlib import Path
from symusic import Score

paths = list(Path("midis").glob("**/*.mid"))
for path in paths:
    score = Score(path)
    score = score.resample(12, min_dur=1)
    start_tick = score.start()

from symusic.

Yikai-Liao avatar Yikai-Liao commented on August 25, 2024

@Natooz This is an int overflow caused by improper multiplication order during resample.

I've adjusted the order of multiplication in the resample and these examples no longer overflow. But an inappropriate resample can still cause an overflow, so I've further added an overflow check to determine if the scaled time is still valid.

from symusic.

Natooz avatar Natooz commented on August 25, 2024

Wonderful thank you!

from symusic.

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.