Skip to content

EQ4/BLIT-based_sinewave_hardsync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BLIT-based sinewave hardsync(vst3/VC++2013)

Screenshot


Algorithm

This waveform is constructed with additive synthesis and BLIT synthesis.

Figure1

# test.rb

# initialize...
sample_rate = 44100.0   # sample rate
leak = 0.995            # [0.99, 1.0)
                        # used for leaky integrator
slave = 1.2             # [1.0, 2.0]
                        # (slave_freq = master_freq * slave)

# set frequency...
master_freq = 440.0                                             # master frequency
n = (sample_rate/2/master_freq).truncate                        # Nyquist limit (round down)
dt = master_freq/sample_rate                                    # delta t
b1 = -2*Math.sin(Math::PI*slave)/(Math::PI*(1+slave)*(1-slave)) # Fourier coefficient for sin(2*PI*1*t)
b2 = -4*Math.sin(Math::PI*slave)/(Math::PI*(2+slave)*(2-slave)) # Fourier coefficient for sin(2*PI*2*t)
b3 = -4*Math.sin(Math::PI*slave)                                # used for BLIT section

# for each sample...
t = 0.5                 # current position
blit_sum = 0.0          # current value for BLIT section
1000.times do
    # output
    p b1*Math.sin(2*Math::PI*1*t) + b2*Math.sin(2*Math::PI*2*t) + b3*blit_sum

    # update position
    t += dt

    # update BLIT (dividing by zero is not considered!)
    blit_sum = leak*blit_sum \
             + Math.cos((n+3)*Math::PI*t)*Math.sin((n-3+1)*Math::PI*t)/Math.sin(Math::PI*t)*dt
end

Implementation by Reaktor

About

BLIT-based sine wave hard sync

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.0%
  • Ruby 9.0%