[Csnd] While and audio arrays
Date | 2020-09-02 18:06 |
From | "Jeanette C." |
Subject | [Csnd] While and audio arrays |
Hey hey, I think somehow I've fallen into the execution time trap, but I can't work out how. I'm working on a kind of bandpass-filter based vocoder. Since the number of bands is fixed, I use a few arrays: kWidths[] init 10 ; bandwidths iCentres[] = fillarray(v1, v2, ..., v10) aCarBands[] init 10 ; analysis bands of the carrier aModBands[] init 10 ; analysis bands of the modulator Then there's the main analysis loop: kIndex = 0 while (kIndex < 10) do aCarBands[kIndex] = butterbp(aCarrier, iCentres[kIndex], kWidths[kIndex]) ... od Grabbing any of these bands, produces a VERY loud impulse and silence. Setting the centre frequency to a literal value or a fixed element of the array - iCentres[5] - produces the expected results. I also tried making the array iCentres an array kCentres with no change. Adding print statement shows that all the values in iCentres/kCentres and kWidths are as expected. Can any one guess a reason? Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Give me a sign... Hit me Baby one more time <3 (Britney Spears) 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 |
Date | 2020-09-02 19:38 |
From | Rory Walsh |
Subject | Re: [Csnd] While and audio arrays |
I don't think you can use opcodes like this in a loop. I think if you want to do something like this you need to use a recursive UDO? I could be wrong... On Wed, 2 Sep 2020 at 18:06, Jeanette C. <julien@mail.upb.de> wrote: Hey hey, |
Date | 2020-09-02 19:44 |
From | john |
Subject | Re: [Csnd] While and audio arrays |
+1 You want a searate instancefor each filter in theloop bt you are only getting oneand reusing it On Wed, 2 Sep 2020, Rory Walsh wrote: > I don't think you can use opcodes like this in a loop. I think if you want to > do something like this you need to use a recursive UDO? I could be wrong... > > On Wed, 2 Sep 2020 at 18:06, Jeanette C. |
Date | 2020-09-02 19:52 |
From | Rory Walsh |
Subject | Re: [Csnd] While and audio arrays |
And this, I believe, is the reason John was not a fan of these looping opcodes when they were introduced. After many years of getting stung by this very same issue, I am starting to agree with him. On Wed, 2 Sep 2020 at 19:44, john <jpff@codemist.co.uk> wrote: +1 |
Date | 2020-09-02 19:56 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
The solution is to use recursion, as explained in the Csound book we did for Springer.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 2 Sep 2020, at 19:53, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2020-09-02 20:02 |
From | Steven Yi |
Subject | Re: [Csnd] While and audio arrays |
Looping constructs are no different than labels+gotos, so the issue has always been there. On Wed, Sep 2, 2020 at 2:53 PM Rory Walsh |
Date | 2020-09-02 21:46 |
From | "Jeanette C." |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
OK, recursion it is then. I almost feared as much. The while loop just looked so attractive, especially with arrays all round. Well, recursion it will be. ;) Best wishes and thanks all of you, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Give me a sign... Hit me Baby one more time <3 (Britney Spears) 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 |
Date | 2020-09-04 04:21 |
From | Josh Moore |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
I ended up just coding a basic C program that automatically prints out as many iterations of whatever as i wanted so I can just dump it to a text file. You could probably do the same thing in bash or python or whatever but I'm not as familiar with those. On Wed, Sep 2, 2020 at 1:45 PM Jeanette C. <julien@mail.upb.de> wrote: OK, recursion it is then. I almost feared as much. The while loop just looked |
Date | 2020-09-04 04:29 |
From | Josh Moore |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
Doing that is especially helpful for people like me who sometimes plays around with spectral/additive stuff that's in the hundreds of individual bands that need individual tuning capability. That's a lot of copying and pasting and number iterations and adding that you can just fix with a couple for loops and printfs making a 10 hour job a 10 minute job. On Thu, Sep 3, 2020 at 8:21 PM Josh Moore <kh405.7h30ry@gmail.com> wrote:
|
Date | 2020-09-04 08:46 |
From | "Jeanette C." |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
Sep 4 2020, Josh Moore has written: > Doing that is especially helpful for people like me who sometimes plays > around with spectral/additive stuff that's in the hundreds of individual > bands that need individual tuning capability. Josh, I have worked with manipulating PVS bands and that works fine with while loops. For detailed manipulation I used pvsftw and pvsftr with the wile loop going through the tables and it worked fine. The upshot, compared to a program unwinding the loop is that the original loop is much easier to maintain. ... Best wishes, Jeanette -- * Website: http://juliencoder.de - for summer is a state of sound * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g * Audiobombs: https://www.audiobombs.com/users/jeanette_c * GitHub: https://github.com/jeanette-c Just call out my name, and I will be there... <3 (Britney Spears) 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 |
Date | 2020-09-04 14:07 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
The key to understand the limitations of loops for processing signal is this: - each opcode inside a loop refers to ONE instance only - when you run a loop, that single instance is called repeatedly - if the opcode holds any state, that state is updated at every iteration for example, an oscil holds state referring to its current phase. Every time you call it, it gets incremented. So if you are running it in a loop, the every time you call it, you update the phase. In a bank of oscillators, each one has its own separate phase and they are all updated in parallel. You don’t get that with a single oscillator in a loop. Similar ideas apply to filters (which have memory for delays) or to anything that holds some form of state. Contrast this with recursion: every time a UDO calls itself, it instantiates a new copy of it, with its separate state etc. Opcodes that implement pure functions (no state) can be used in loops as you please. You can implement a bank of oscillators using sin() and an audio array to hold phases. Hope that clears the matter. best ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 4 Sep 2020, at 08:46, Jeanette C. |
Date | 2020-09-05 16:50 |
From | Josh Moore |
Subject | Re: [Csnd] [EXTERNAL] Re: [Csnd] While and audio arrays |
Yeah, for PVS stuff where you might use a single opcode as Victor says will work fine. It's when you get into multiple signals that you run into hiccups (as you were having with your vocoder stuff). Like having a pvsanal and individual or sub grouped resynthesis bins, each with their own output (ie, for spectral compression/expansion or something like that). You really do need a separate instance for each voice as was said. Calling a UDO a bunch of times would work, but I would imagine you also lose some flexibility and conciseness, and perhaps a performance drop vs just sending a big block to get interpreted. Using a standard programming language's loops to generate the individual lines for the appropriate instances *will* have the desired effect of creating individual instances (or what you would expect loops to normally do) and since you can just generate the whole CSD tags and all there's really no reason to use the loops internal to csound nor would you be really reading or modifying the CSD dump just running it. It's just a fancy text processor at that point, old skool bell labs style. Even if you were to use it to generate a UDO that you would need to only call once, instead of multiple times you could easily do the same. On Fri, Sep 4, 2020 at 12:46 AM Jeanette C. <julien@mail.upb.de> wrote: Sep 4 2020, Josh Moore has written: |