Code Monkey home page Code Monkey logo

Comments (4)

tfry-git avatar tfry-git commented on July 23, 2024

Very interesting. Possibly our audio output timer is slightly off.

Some questions:

  1. Am I right in guessing that the sample also plays 1.5% faster?
  2. Have you tried different AUDIO_RATEs?
  3. What STM32 is this, exactly? Any chance F_CPU is not set quite correctly? Are you seeing the same thing on other boards of the same or different type (if available)?
  4. Perhaps you might want to take a look at
    audio_update_timer.setPeriod(1000000UL / AUDIO_RATE);
    . Possibly we run into a case of bad rounding, there.

from mozzi.

Tinwelint78 avatar Tinwelint78 commented on July 23, 2024
  1. You are right there.
  2. Now I have tried 16384 and the frequency is near exact... See point 4!
  3. It is STM32F103C at 72 MHz, a classic "Blue Pill" board. I don't have another type to try right now, but I don't think the problem is there...
  4. Well spotted! the problem is indeed a bad rounding:
    1000000/16384 = 61.03515625 => rounded to 61, error of less than 0.05%
    1000000/32768 = 30.517578125 => rounded to 30, error of 1.7%!
    I think it will be better to set that timer prescaler and overflow manually instead of using setPeriod function. I will look into that and propose a PR in the next few days.

from mozzi.

tfry-git avatar tfry-git commented on July 23, 2024

Thanks! Looking forward to that!

from mozzi.

tomcombriat avatar tomcombriat commented on July 23, 2024

Hi,

I think the Teensy are also subject to this. Will try to append this correction to #137 .

from mozzi.

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.