| Hi Ffanci,
I've attached my attempt at an overlap-sync implementation. It uses a
k-rate while loop to look for trigger points within the 2nd phase
signal. When it does, it mixes in one grain into the ring buffer.
Both the master and slave oscillators use table3 for reading from the
ftable. One issue with the overlap sync is that the gain is going to
fluctuate with the number of overlaps, so should be accounted for in
some way. (The code I wrote does not really do that.) This
implementation is a bit simpler than what I wrote in the previous
email in regards to the phase calculations.
Hope that's useful!
steven
On Tue, Jul 26, 2016 at 7:16 PM, Steven Yi wrote:
> Hi Ffanci,
>
> Regarding Overlap sync, it's certainly possible to write code to do
> it. The way I'd go about it would be:
>
> 1. Use two counters that track phases for the two oscillators.
> 2. For the master, advance the phasor as normal and wrap as it hits
> the limits for given frequency.
> 3. Advance the slave phasor as in 2 but for the related frequency.
> However, when 1 resets, additional reset the phase of the slave.
> 4. For the master, you could use it directly with tablei or table3 to
> generate the waveform.
> 5. For the slave, track whenever the phase resets. When it does,
> write the entire grain of the wavetable to a ring buffer.
> 6. For the slave's audio, read from the ring buffer at a constant rate.
>
> You could probably use an array for the ring buffer, and would have to
> make sure it's long enough for the maximum size of the grain.
>
> I'm curious about this, and will see if I can write up an
> implementation to demonstrate.
>
> steven
>
>
> On Tue, Jul 26, 2016 at 12:59 PM, Ffanci Silvain wrote:
>> Hey hey everyone,
>> so it turns out that the internet has a few more open resources, or last
>> time I didn't search properly. So I found a Csound example of "reset inhibit
>> sync" and I added one of "phase advance sync".
>>
>> I've been wondering though: is there a way to perform "overlap sync" in
>> Csound?
>> ( https://en.wikipedia.org/wiki/Oscillator_sync#Overlap_Sync )
>>
>> I thought about using some kind of granular synthesis technique with table
>> writing opcodes.
>>
>> Could anyone suggest ways to improve my versions of reset inhibit or phase
>> advance sync?
>>
>> *** sync.csd ***
>>
>>
>> -o sync.wav -W
>>
>> ; ==============================================
>>
>>
>> sr = 48000
>> ksmps = 1
>> nchnls = 2
>> 0dbfs = 1
>>
>> instr 1 ; Reset inhibit sync
>> istart_ratio = p5
>> istop_ratio = p6
>> ifreq = p4
>> kmod line istart_ratio, p3, istop_ratio
>> khi = floor(kmod) ; shorten the actual value to the next lowest
>> integer harmonic
>> ; This removes some aliasing, but introduces stepping
>> ; filtering with port reintroduces aliasing
>> aph phasor ifreq
>> aread limit (aph * kmod), 0, khi
>> asound table3 aread, 1, 1, 0, 1
>> aout dcblock asound
>> outs aout*0.9, aout*0.9
>> endin
>>
>> instr 2 ; phase reversal sync
>> ifreq = p4
>> istart_ratio = p5
>> istop_ratio = p6
>> kmfreq line ifreq*istart_ratio, p3, ifreq*istop_ratio
>> amod poscil3 1, ifreq, 2
>> asound poscil3 0.7, kmfreq*amod, 1
>> aout dcblock asound
>> outs aout, aout
>> endin
>>
>> instr 3 ; Naive sync (this is BAD!)
>> ifreq = p4
>> istart_ratio = p5
>> istop_ratio = p6
>> kmod line istart_ratio, p3, istop_ratio
>> aph phasor ifreq
>> asound table (aph * kmod), 1, 1, 0, 1
>> aout dcblock asound
>> outs aout*0.8, aout*0.8
>> endin
>>
>>
>> ; ==============================================
>>
>> f1 0 32768 10 1
>> ;f2 0 32768 -23 "sync.ftable"
>> f2 0 8192 -27 0 1 4095 1 4096 -1 8191 -1
>>
>> i1 0 1 220 16 1
>> i1 1 4 220 32 1
>> i2 5 1 220 16 1
>> i2 6 4 220 32 1
>> i3 10 1 220 16 1
>> i3 11 4 220 32 1
>> e
>>
>>
>> *** sync.csd ***
>>
>> I hope you enjoy it and even more so that you could improve it. :)
>> 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
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
|