Csound Csound-dev Csound-tekno Search About

using convolution in Real-time

Date2016-11-27 09:45
FromAnton Kholomiov
Subjectusing convolution in Real-time
Thanks Victor your code is super cool!

It's an old thread. I was asking for it quite a lot time ago. But at the moment of asking
I havn't got the time to test the answers. my bad. But recently my friend gave me good
library of responses for a classical reverberation unit. So there was finally a strong reason to try the responses out finally.

The Csound code works quite well! I'm very impressed by the results. It seems like the magic to me
being able to reproduce the reverb with this level of quality. 

Some feedback on performance:

pconvolve      eats 50% of CPU (for 44100 / 32)
Victor's code eats: 10% 

For my speakers and headphones audible results are almost the same, pconvolve is slightly better but maybe I'm lying to myself
it's too subtle. Is there a theoretical difference for accuracy of those algorithms?

As far as I understand the trick can be applied not only for reverb but we can get a snapshot
of any fx-chain. That opens up lots of possibilities to build the good FX-processor on budget

PS: Victor's code from the old forum

Here’s a UDO for zero-latency partitioned convolution

/**************************************************
asig ZConv ain,ipart,irat,inp,ifn
ain - input signal
ipart - first partition size in samples
irat - partition growth ratio
inp - total number of partition sizes
ifn - function table number containing the IR
**************************************************/
opcode ZConv,a,aiiiio
 asig,iprt,irat,inp,ifn,icnt xin
 if icnt < inp-1 then
  acn ZConv asig,iprt,irat,inp,ifn,icnt+1
 endif
 if icnt == 0 then
   a1 dconv asig,iprt,ifn
 elseif icnt < inp-1 then
   ipt = iprt*irat^(icnt-1)
   isiz = ipt*(irat-1)
   print ipt
   print isiz
   a1 ftconv asig,ifn,ipt,ipt,isiz
 else
   ipt = iprt*irat^(icnt-1)
   a1 ftconv asig,ifn,ipt,ipt
 endif
 xout a1 + acn
endop

…….

 a1 ZConv asig,64,4,6,1

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

Date2016-11-27 12:21
From"Peter P."
SubjectRe: using convolution in Real-time
AttachmentsNone  

Date2016-11-27 13:05
FromJustin Smith
SubjectRe: using convolution in Real-time
responding to just one point:

As far as I understand the trick can be applied not only for reverb but we can get a snapshot
> of any fx-chain. That opens up lots of possibilities to build the good FX-processor on budget

this works for linear processing effects only, there are many for which it won't work at all, including amplitude modulations, distortions, frequency modulations, and non linear filters among others

On Sun, Nov 27, 2016 at 4:21 AM Peter P. <peterparker@fastmail.com> wrote:
* Anton Kholomiov <anton.kholomiov@GMAIL.COM> [2016-11-27 10:45]:
> Thanks Victor your code is super cool!
>
> It's an old thread. I was asking for it quite a lot time ago. But at the
> moment of asking
> I havn't got the time to test the answers. my bad. But recently my friend
> gave me good
> library of responses for a classical reverberation unit. So there was
> finally a strong reason to try the responses out finally.
>
> The Csound code works quite well! I'm very impressed by the results. It
> seems like the magic to me
> being able to reproduce the reverb with this level of quality.
>
> Some feedback on performance:
>
> pconvolve      eats 50% of CPU (for 44100 / 32)
> Victor's code eats: 10%
>
> For my speakers and headphones audible results are almost the same,
> pconvolve is slightly better but maybe I'm lying to myself
> it's too subtle. Is there a theoretical difference for accuracy of those
> algorithms?

One reason amongst many others could be:

http://ecmc.rochester.edu/ecmc/docs/csound/csound-manual-5.14/pconvolve.html
says
"convolve — Convolution based on a uniformly partitioned overlap-save algorithm"

while victor's partition sizes grow by a ratio parameter (of which I
hope it can be non-integer).

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

Date2016-11-27 14:14
From"Peter P."
SubjectRe: using convolution in Real-time
AttachmentsNone  

Date2016-11-27 20:36
FromAnton Kholomiov
SubjectRe: using convolution in Real-time
Thanks for the answers!

2016-11-27 17:14 GMT+03:00 Peter P. <peterparker@fastmail.com>:
* Justin Smith <noisesmith@GMAIL.COM> [2016-11-27 14:05]:
> responding to just one point:
>
> > As far as I understand the trick can be applied not only for reverb but
> we can get a snapshot
> > of any fx-chain. That opens up lots of possibilities to build the good
> FX-processor on budget
>
> this works for linear processing effects only, there are many for which it
> won't work at all, including amplitude modulations, distortions, frequency
> modulations, and non linear filters among others
And I would like to add that you can only model time-invariant
processes. Anything that changes over time, eg. a phasor or flanger,
time-variant filter such as wahwah etc. are excluded as well.

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

Date2016-12-01 18:18
FromAnton Kholomiov
SubjectRe: using convolution in Real-time
Just stumbled on this video. It's show case of real-time convolution with csound. 
He says that he uses pconvolve


2016-11-27 23:36 GMT+03:00 Anton Kholomiov <anton.kholomiov@gmail.com>:
Thanks for the answers!

2016-11-27 17:14 GMT+03:00 Peter P. <peterparker@fastmail.com>:
* Justin Smith <noisesmith@GMAIL.COM> [2016-11-27 14:05]:
> responding to just one point:
>
> > As far as I understand the trick can be applied not only for reverb but
> we can get a snapshot
> > of any fx-chain. That opens up lots of possibilities to build the good
> FX-processor on budget
>
> this works for linear processing effects only, there are many for which it
> won't work at all, including amplitude modulations, distortions, frequency
> modulations, and non linear filters among others
And I would like to add that you can only model time-invariant
processes. Anything that changes over time, eg. a phasor or flanger,
time-variant filter such as wahwah etc. are excluded as well.

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

Date2016-12-01 18:53
FromOeyvind Brandtsegg
SubjectRe: using convolution in Real-time
Hi,
I do use convolution frequently in realtime, but recently I've also
experimented with replacing the IR in realtime, so that convolution
can be a bit more flexible and moldable.
Here's an early attempt (from September):
https://www.youtube.com/watch?v=_kyCTpTQKtQ&feature=youtu.be
Since then I've refined it together with my colleague Sigurd Saue, and
we have a new opcode coming out soon. It will be called liveconvolve,
and allows replacing the IR partition by partition without clicks. I
did some experiments yesterday to show how we can use this to convolve
two live source with each other. I am expremely happy with the results
so far. Convolution will be just as flexible and moldable as granular
processing, combining random time offsets and backwards/forwards IR,
different IR lengths, parametric processing of the IR, and so on.
Oeyvind

2016-12-01 10:18 GMT-08:00 Anton Kholomiov :
> Just stumbled on this video. It's show case of real-time convolution with
> csound.
> He says that he uses pconvolve
>
> https://www.youtube.com/watch?v=B8vCLtGxgEk
>
> 2016-11-27 23:36 GMT+03:00 Anton Kholomiov :
>>
>> Thanks for the answers!
>>
>> 2016-11-27 17:14 GMT+03:00 Peter P. :
>>>
>>> * Justin Smith  [2016-11-27 14:05]:
>>> > responding to just one point:
>>> >
>>> > > As far as I understand the trick can be applied not only for reverb
>>> > > but
>>> > we can get a snapshot
>>> > > of any fx-chain. That opens up lots of possibilities to build the
>>> > > good
>>> > FX-processor on budget
>>> >
>>> > this works for linear processing effects only, there are many for which
>>> > it
>>> > won't work at all, including amplitude modulations, distortions,
>>> > frequency
>>> > modulations, and non linear filters among others
>>> And I would like to add that you can only model time-invariant
>>> processes. Anything that changes over time, eg. a phasor or flanger,
>>> time-variant filter such as wahwah etc. are excluded as well.
>>>
>>> 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


Date2016-12-01 19:06
FromDave Seidel
SubjectRe: using convolution in Real-time
That new opcode should be great, Oeyvind! Nice demo.

On Thu, Dec 1, 2016 at 1:53 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Hi,
I do use convolution frequently in realtime, but recently I've also
experimented with replacing the IR in realtime, so that convolution
can be a bit more flexible and moldable.
Here's an early attempt (from September):
https://www.youtube.com/watch?v=_kyCTpTQKtQ&feature=youtu.be
Since then I've refined it together with my colleague Sigurd Saue, and
we have a new opcode coming out soon. It will be called liveconvolve,
and allows replacing the IR partition by partition without clicks. I
did some experiments yesterday to show how we can use this to convolve
two live source with each other. I am expremely happy with the results
so far. Convolution will be just as flexible and moldable as granular
processing, combining random time offsets and backwards/forwards IR,
different IR lengths, parametric processing of the IR, and so on.
Oeyvind

2016-12-01 10:18 GMT-08:00 Anton Kholomiov <anton.kholomiov@gmail.com>:
> Just stumbled on this video. It's show case of real-time convolution with
> csound.
> He says that he uses pconvolve
>
> https://www.youtube.com/watch?v=B8vCLtGxgEk
>
> 2016-11-27 23:36 GMT+03:00 Anton Kholomiov <anton.kholomiov@gmail.com>:
>>
>> Thanks for the answers!
>>
>> 2016-11-27 17:14 GMT+03:00 Peter P. <peterparker@fastmail.com>:
>>>
>>> * Justin Smith <noisesmith@GMAIL.COM> [2016-11-27 14:05]:
>>> > responding to just one point:
>>> >
>>> > > As far as I understand the trick can be applied not only for reverb
>>> > > but
>>> > we can get a snapshot
>>> > > of any fx-chain. That opens up lots of possibilities to build the
>>> > > good
>>> > FX-processor on budget
>>> >
>>> > this works for linear processing effects only, there are many for which
>>> > it
>>> > won't work at all, including amplitude modulations, distortions,
>>> > frequency
>>> > modulations, and non linear filters among others
>>> And I would like to add that you can only model time-invariant
>>> processes. Anything that changes over time, eg. a phasor or flanger,
>>> time-variant filter such as wahwah etc. are excluded as well.
>>>
>>> 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



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://crossadaptive.hf.ntnu.no
http://gdsp.hf.ntnu.no/
http://soundcloud.com/brandtsegg
http://flyndresang.no/
http://soundcloud.com/t-emp

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

Date2016-12-01 19:50
FromAnton Kholomiov
SubjectRe: using convolution in Real-time
Interesting phenomena! I wonder what the pro beat-boxers can do with that.

2016-12-01 22:06 GMT+03:00 Dave Seidel <dave.seidel@gmail.com>:
That new opcode should be great, Oeyvind! Nice demo.

On Thu, Dec 1, 2016 at 1:53 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Hi,
I do use convolution frequently in realtime, but recently I've also
experimented with replacing the IR in realtime, so that convolution
can be a bit more flexible and moldable.
Here's an early attempt (from September):
https://www.youtube.com/watch?v=_kyCTpTQKtQ&feature=youtu.be
Since then I've refined it together with my colleague Sigurd Saue, and
we have a new opcode coming out soon. It will be called liveconvolve,
and allows replacing the IR partition by partition without clicks. I
did some experiments yesterday to show how we can use this to convolve
two live source with each other. I am expremely happy with the results
so far. Convolution will be just as flexible and moldable as granular
processing, combining random time offsets and backwards/forwards IR,
different IR lengths, parametric processing of the IR, and so on.
Oeyvind

2016-12-01 10:18 GMT-08:00 Anton Kholomiov <anton.kholomiov@gmail.com>:
> Just stumbled on this video. It's show case of real-time convolution with
> csound.
> He says that he uses pconvolve
>
> https://www.youtube.com/watch?v=B8vCLtGxgEk
>
> 2016-11-27 23:36 GMT+03:00 Anton Kholomiov <anton.kholomiov@gmail.com>:
>>
>> Thanks for the answers!
>>
>> 2016-11-27 17:14 GMT+03:00 Peter P. <peterparker@fastmail.com>:
>>>
>>> * Justin Smith <noisesmith@GMAIL.COM> [2016-11-27 14:05]:
>>> > responding to just one point:
>>> >
>>> > > As far as I understand the trick can be applied not only for reverb
>>> > > but
>>> > we can get a snapshot
>>> > > of any fx-chain. That opens up lots of possibilities to build the
>>> > > good
>>> > FX-processor on budget
>>> >
>>> > this works for linear processing effects only, there are many for which
>>> > it
>>> > won't work at all, including amplitude modulations, distortions,
>>> > frequency
>>> > modulations, and non linear filters among others
>>> And I would like to add that you can only model time-invariant
>>> processes. Anything that changes over time, eg. a phasor or flanger,
>>> time-variant filter such as wahwah etc. are excluded as well.
>>>
>>> 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



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://crossadaptive.hf.ntnu.no
http://gdsp.hf.ntnu.no/
http://soundcloud.com/brandtsegg
http://flyndresang.no/
http://soundcloud.com/t-emp

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

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