[Csnd] poscil with crossfade at an arbitrary loop point

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] poscil with crossfade at an arbitrary loop point

kghongaku
i've been working with poscil to playback tables at variable speeds that
are simultaneously being written to. i've lived with the clicks produced
as poscil crosses the write point but i'd like to smooth it out.

before i set out to modify poscil i wanted to ask, is there a poscil
like opcode that will skip ahead and cross fade the tail with the head
at the moving write point? it seems cheaper to do this than having the
recording instrument buffer and rewrite the tail every time it advances.

k.

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] poscil with crossfade at an arbitrary loop point

Oeyvind Brandtsegg-3
Hi Kelly,

I think it depend on what you do more often, rewriting the table or reading. If you run into problems with the read pointer crossing the write pointer I assume that you are perhaps reading the table all the way through many times per second? So that the read cycles per second is the fundamental of the synthesized tone?
If that is the case it seems to me that it would be cheaper to do the interpolation at the time of writing to the table. Of course, unless you are writing at the same speed too ... But if you are writing at the exact same speed perhaps you can make sure you don't have the read pointer cross the write pointer(?)
It also of course depends on the polyphony used with the table reader.

You might have an algorithm for the write time interpolation, but if not, here's my basic thought on how it could be done.
- let's say you want linear interpolation over 4 samples
- keep 4 samples from signal A (old table) and signal B (new table) as a circular buffer in an array
- for the most recent sample write A*0,0+B*1.0
- for the next most recent sample write A*0,25+B*0.75
- 3rd most recent is A*0.5+B*0.5
- 4th most recent is A*0.75+B*0.25
Other interpolation schemes might be better, but cost the same. The size of the filter could be adjusted for better quality.

Do forgive if I'm way out of the ballpark, just a 2c...

2018-05-23 6:33 GMT+02:00 Kelly Hirai <[hidden email]>:
i've been working with poscil to playback tables at variable speeds that
are simultaneously being written to. i've lived with the clicks produced
as poscil crosses the write point but i'd like to smooth it out.

before i set out to modify poscil i wanted to ask, is there a poscil
like opcode that will skip ahead and cross fade the tail with the head
at the moving write point? it seems cheaper to do this than having the
recording instrument buffer and rewrite the tail every time it advances.

k.

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] poscil with crossfade at an arbitrary loop point

kghongaku
maybe i am abusing the opcode but i am not using it as an oscilator so much as for sample playback. so in order to clean the click, i estimate that i will need a transition of around 100 samples or so. i was thinking i would write it as a k-rate for position and measure the transition in ksamp blocks though its unlikely that the transition would actually line up on a boundary.

there are cases in my instrument  where the sample gets pretty small and starts to create its own harmonics. might have to watch for these cases.
 
k.
On 05/24/2018 07:51 AM, Oeyvind Brandtsegg wrote:
Hi Kelly,

I think it depend on what you do more often, rewriting the table or reading. If you run into problems with the read pointer crossing the write pointer I assume that you are perhaps reading the table all the way through many times per second? So that the read cycles per second is the fundamental of the synthesized tone?
If that is the case it seems to me that it would be cheaper to do the interpolation at the time of writing to the table. Of course, unless you are writing at the same speed too ... But if you are writing at the exact same speed perhaps you can make sure you don't have the read pointer cross the write pointer(?)
It also of course depends on the polyphony used with the table reader.

You might have an algorithm for the write time interpolation, but if not, here's my basic thought on how it could be done.
- let's say you want linear interpolation over 4 samples
- keep 4 samples from signal A (old table) and signal B (new table) as a circular buffer in an array
- for the most recent sample write A*0,0+B*1.0
- for the next most recent sample write A*0,25+B*0.75
- 3rd most recent is A*0.5+B*0.5
- 4th most recent is A*0.75+B*0.25
Other interpolation schemes might be better, but cost the same. The size of the filter could be adjusted for better quality.

Do forgive if I'm way out of the ballpark, just a 2c...

2018-05-23 6:33 GMT+02:00 Kelly Hirai <[hidden email]>:
i've been working with poscil to playback tables at variable speeds that
are simultaneously being written to. i've lived with the clicks produced
as poscil crosses the write point but i'd like to smooth it out.

before i set out to modify poscil i wanted to ask, is there a poscil
like opcode that will skip ahead and cross fade the tail with the head
at the moving write point? it seems cheaper to do this than having the
recording instrument buffer and rewrite the tail every time it advances.

k.

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] poscil with crossfade at an arbitrary loop point

Oeyvind Brandtsegg-3
Ok, but then you could try to look into flooper, og iirc there's a flooer2 with some improvements too. It does looping with crossfading.

2018-05-24 22:28 GMT+02:00 Kelly Hirai <[hidden email]>:
maybe i am abusing the opcode but i am not using it as an oscilator so much as for sample playback. so in order to clean the click, i estimate that i will need a transition of around 100 samples or so. i was thinking i would write it as a k-rate for position and measure the transition in ksamp blocks though its unlikely that the transition would actually line up on a boundary.

there are cases in my instrument  where the sample gets pretty small and starts to create its own harmonics. might have to watch for these cases.
 
k.

On 05/24/2018 07:51 AM, Oeyvind Brandtsegg wrote:
Hi Kelly,

I think it depend on what you do more often, rewriting the table or reading. If you run into problems with the read pointer crossing the write pointer I assume that you are perhaps reading the table all the way through many times per second? So that the read cycles per second is the fundamental of the synthesized tone?
If that is the case it seems to me that it would be cheaper to do the interpolation at the time of writing to the table. Of course, unless you are writing at the same speed too ... But if you are writing at the exact same speed perhaps you can make sure you don't have the read pointer cross the write pointer(?)
It also of course depends on the polyphony used with the table reader.

You might have an algorithm for the write time interpolation, but if not, here's my basic thought on how it could be done.
- let's say you want linear interpolation over 4 samples
- keep 4 samples from signal A (old table) and signal B (new table) as a circular buffer in an array
- for the most recent sample write A*0,0+B*1.0
- for the next most recent sample write A*0,25+B*0.75
- 3rd most recent is A*0.5+B*0.5
- 4th most recent is A*0.75+B*0.25
Other interpolation schemes might be better, but cost the same. The size of the filter could be adjusted for better quality.

Do forgive if I'm way out of the ballpark, just a 2c...

2018-05-23 6:33 GMT+02:00 Kelly Hirai <[hidden email]>:
i've been working with poscil to playback tables at variable speeds that
are simultaneously being written to. i've lived with the clicks produced
as poscil crosses the write point but i'd like to smooth it out.

before i set out to modify poscil i wanted to ask, is there a poscil
like opcode that will skip ahead and cross fade the tail with the head
at the moving write point? it seems cheaper to do this than having the
recording instrument buffer and rewrite the tail every time it advances.

k.

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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