Csound Csound-dev Csound-tekno Search About

Hard/soft sync sound - attempted aliasing solutions

Date2016-07-23 08:03
FromFfanci Silvain
SubjectHard/soft sync sound - attempted aliasing solutions
Hey hey everyone,
I'm trying to to implement a method approximating the sound of hard sync. 
There are a couple of ideas, but lacking the exact math, I don't know if they 
are valid at all, and if so, what to do exactly.

The naive solution: use a table read and scale the phasor reading the wave by 
the required factor:

Assumption: the original waveform is bandlimited.

; kslavefreq >= kmasterfreq
aph phasor kmasterfreq
aread = aph * (kslavefreq / kmasterfreq)
asound table aread, iwave, 1, 0, 1
...

Problem: aliasing due to the discontnuous waveform at the new start of the 
cycle.

Ideas for solutions:
1. Apply audio modulation to the output signal, so the the 
very last part of a cycle is smoothly ramped down to zero. This will only 
work, if the waveform starts at zero.
2. Apply audio modulation to the modified phasor (aread in the above example) 
to quickly, but continuously ramp down to zero at the end of each cycle.
3. Somehow modify the phasor to quickly complete a full wave cycle of the 
iwave table. So the phasor won't stop somewhere in the middle of the waveform 
causing the discontinuity. So the phasor's last value will always be an 
integer number.

Questions: is anyone of the above ideas feasible? If so, which function would 
be appropriate to do the necessary scaling or modification.

Experiments: using GEN05 (exponential segments) with a long line at one and a 
small segment at the end ramping down to a very small value. Same with cubic 
segments (GEN06).

Thoughts: if a modulation method with such a function can work, the ramp 
should be done with a function that is continuous in the value of 1 - or any 
other value using function table normalisation. Perhaps creating a function 
externally using any programming language and reading it using GEN23 might be 
helpful.

Any hints are welcome. Thanks for bearing with me.

Ta-ta,
----
Ffanci
* Homepage: https://freeshell.de/~silvain
* Twitter:  http://twitter.com/ffanci_silvain
* GitHub:   https://github.com/fsilvain

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here