Giter Site home page Giter Site logo

Divide by zero error about tinyoal HOT 3 CLOSED

samsinsane avatar samsinsane commented on June 26, 2024
Divide by zero error

from tinyoal.

Comments (3)

ErikMcClure avatar ErikMcClure commented on June 26, 2024

I'm going to guess the correct fix here is to either move the !_format check earlier in the function, or insert a few extra "if zero don't blow up" checks, but before I blindly go changing code, do you have an example of an unsupported wave file I could repro this bug with?

from tinyoal.

samsinsane avatar samsinsane commented on June 26, 2024

http://www.nch.com.au/acm/11kadpcm.wav I was able to replicate the issue with this file, which is listed on the Wikipedia page for WAV, https://en.wikipedia.org/wiki/WAV#WAV_file_audio_coding_formats_compared hope that helps narrow it down :)

from tinyoal.

ErikMcClure avatar ErikMcClure commented on June 26, 2024

This bug turns out to be a bit more subtle than I anticipated. While the format itself is technically not supported, it actually is a valid format. The real bug here is that all formats with less than 8 bits per sample will divide by zero. This was fixed by forcing the byte calculation to work in terms of bits, and only convert down to bytes afterwards. I wasn't able to do this elsewhere due to precision concerns, but TinyOAL doesn't support any 4 bit formats anyway.

In addition to this, I've added a few checks to prevent any divide by zeros that might occur from null format data.

from tinyoal.

Related Issues (3)

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.