[Csnd] Feature request: new GEN routine

I'd like to make a request based on a modification of the GEN16 routine.

GEN33 & 34 can easily allow creation of algorithmically based wavetables of any size with any number of tables, each containing any number of (in)harm partials, using a source table to hold the necessary parameters.

For example, to create a wavetable of 32 individual tables, each having a different number/amount of partials (inharmonic partials can be non-integer values), strengths &/or phases one can do something like:

iNumberOfTables init 32
iSrc = ftgentmp(0, 0, 1024, -2, 0)

while iNumberOfTables > 0 do
  iNumberOfPartials = random:i(2, 30)

  while iNumberOfPartials > 0 do
  ; bunch of stuff to create random values &
  ; write them to the iSrc table
    iNumberOfPartials -=1
  od

  iNumberOfTables -= 1
od

iWave = ftgen(0, 0, 1024, 34, "iSrc" ...)

If there was a routine based on GEN16 that could use a source table in a similar way it would allow for algorithmic creation of a "wavetable" containing complex individual tables for waveforms, (looping) envelopes, LFOs etc., similar to the concept of transeg but not limited to a set number of segments (number and values of points, durations and exp/log/linear slopes).

I hope I was able to describe this reasonably well. If not I could post more illustrative code to demonstrate.

Best,
Scott

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

GEN 33 and 34 were introduced before we had arrays. These days we can reproduce the functionality using the array version of
ftgen

[

ftgen
csound.com

](ftgen)

You can put any arbitrary numbers of parameters into an array and then use the relevant GEN directly.

Prof. Victor Lazzarini
Maynooth University
Ireland

The issue here is GEN16 requires all parameters are entered at the time of it’s creation, there cannot be a variable number of parameters. So I believe in this instance an array is impractical.

For example, if 1 segment is requested, 4 variables are necessary for GEN16:
ftgen 0, 0, size, 16, val1, dur1, type1,val2

So if one wants to randomly create 64 individual tables within a loop with a random number of segments from say 2 to 32 segments, 32 segments would require initializing the GEN16 with 97 parameters whereas 2 segments only requires 7.

GEN34 & GEN33 do not have such limitation. They can accept a source table that is size 3 (1 partial, 3 variables) or size 300 (100 partials), all of which can be automatically generated in a loop. GEN16 does not allow this as all variables must be entered at the time it is instantiated - it will not allow a randomly created and therefore variable length source table nor array.

Best,
Scott

Apologies, I just saw the link you posted, I had assumed it was the same one I had been referencing. It appears to have different information than the Csound.com link available thru the manual which one typically finds on Google:
https://csound.com/docs/manual/GEN16.html

That page does not reference arrays.

Thanks,
Scott

It absolutely can with an array. That’s the whole point, you just make the array to the required length.

I do this all the time. All you need is to create an array and pass it to ftgen. GEN33 and 34 are obsolescent. You can do the same thing with just GEN 9 or GEN 10.

Prof. Victor Lazzarini
Maynooth University
Ireland

You won’t find that info on the gen page, but on ftgen. It works for all numeric parameter gens.

Prof. Victor Lazzarini
Maynooth University
Ireland

Yes, I understand completely now. When I first made the request I was unaware of the page you linked, I had only referenced the GEN16 page from the canonical manual which itself makes no mention of using arrays.

I thank you for the response, that’s great.

Best,
Scott

Victor or Scott or both - it would be cool to have an example (as Scott describes) or one by Victor that shows how to do this in FLOSS or in the Manual or in both. (I think that Joachim has something like this in FLOSS already doing generative additive, but it would be cool to see more)

yes i agree --- this feature is much too hidden.
@victor: can you share one or two of the examples which you mentioned?

See attached.

wavetable.csd (3.76 KB)

cool, thanks.

i have added now a description to the floss manual about array argument in ftgen, and two examples --- one basic, and the one from victor. it is online in the develop version of the floss manual: The Csound FLOSS Manual (examples 03D03 and 03D06)

  joachim