Coder Social home page Coder Social logo

Comments (18)

elanhickler avatar elanhickler commented on September 26, 2024

hmm oh maybe it's because I use * isntead of + for pitch offset. I need to setup a ratio system / multiplication system rather than use addition.

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

hmmm - actually, adding in the (logarithmic) pitch domain sounds right to me. this is mathematically the same as multiplying in the raw frequency domain as logarithms take multiplication to addition: log(a*b) = log(a)+log(b). so when you add a constant in the pitch domain, and then convert to frequency after addeing, this should yield constant frequency ratios.

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

maybe i need more details and/or look at your actual code

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

it's heavily influenced by amplitude of modulation as well.

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

hmm I think it's working correctly (just played with another FM synth to see how it sounds), just the results are not as I want them to be. Not sure what the solution is other than to have per-key settings to fine-tune each key in terms of mod depth and frequency. When I do that I might see a pattern that I could use to have more musical FM.

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

maybe some amount of (negative) keytracking of the modulation depth? this would make higher notes more muffled

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

naa, that's not the issue. will close!

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

re-opening this issue. I'd like to fix this before releasing:

https://puu.sh/wbMeI/9bd9aa25b8.mp4

It's the pitch offset that is bothering me. If you have pitch offset set to -24 -12 0 12 24 etc it works as expected. If you do something like 12.5 or even 13 or ANYTHING that is not a perfect multiple of 12 you get a frequency that is more and more off depending on the note you play.

How would I get a consistent sound with a pitch offset?

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

ok here's a clue

.1 semitone offset playing C3 equates to playing C4 with 0.05 semitone offset. So every octave up needs to halve the semitone offset.

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

aaahh! i think, i see. maybe...how to explain....you are getting some kind of beating effect there which is perceived in the time domain - like an lfo. and you want the "lfo-frequency" to stay the same throughout the keyrange. but when you let the pitch-offset between the two oscillators stay the same throughout the keyrange, the frequency ratio of the 2 oscs stays the same - and the beating frequency goes up as well. so when you play a note an octave higher, you have also twice the beating frequency...oh my god...i think what i just said sounds very convoluted. but yeah - i think, for constant beating frequency, you need the frequency difference between the two oscs (not the frequency ratio) stay the same throughout the keyrange. ...which is what happens when you divide the pitch-offset by two for each octave you go up

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

you could also just add something to the frequency of one osc (after conversion from pitch to frequency), i.e. introduce an additional absolute frequency offset

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

ok, yes, a simple frequency offset works.

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

also, you have to use to use LINEAR frequency modulation not exponential for FM, if you want things to stay in tune. In other words, I shouldn't be doing pitchToFreq(lfo_mod * depth + tuning); I need to do pitchToFreq(tuning) + lfo_mod * depth

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

oh - yes - i think exponential FM creates inharmonic spectra even for simple carrier/modulator ratios (where linear FM produces harmonic spectra)

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

or...does it? not sure

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

ah: https://www.kvraudio.com/forum/viewtopic.php?t=310508

"The main problem with exponential FM is, as you increase the FM index, the perceived fundamental of the pitch shifts."

from rs-met.

RobinSchmidt avatar RobinSchmidt commented on September 26, 2024

here is a paper about exponential FM: http://recherche.ircam.fr/pub/dafx11/Papers/60_e.pdf it has equations that could probably be used to compensate for this detuning, making exponential FM playable in tune. ...could be interesting to explore....

from rs-met.

elanhickler avatar elanhickler commented on September 26, 2024

I would be musical exponential fm, will return to this topic in the future.

from rs-met.

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.