[PD-dev] help building string for an external

Alexandre Torres Porres porres at gmail.com
Sun Jul 9 20:07:56 CEST 2023


So, i have a code that I copied from ceammc's sfizz~ for my new sfz~ object
to load alternate tunings. The object loads SFZ soundfont files

All we need is a string into a built in sfizz_load_scala_string function.

The string is tuning name, number of steps and steps in cents in this format
 "weird\n4\n155\n555\n777\n1111\n"

So I am trying to build this string from a list of intervals in cents and
it is failing, but trying the string above works!

The code from ceammc's sfizz~ uses this structure and if I print the string
in the code I do get something that looks exactly like a string that gets
accepted, but trying to build this string this way fails somehow (while it
must work for ceammc maybe, haven't tested)

    *char* scale[2048] = "autogenerated scale\n";

    *char** pscale = &scale[0] + strlen(scale);

    pscale += sprintf(pscale, "%d\n", ac);

    *for*(*int* i = 1; i < ac; i++)

        pscale += sprintf(pscale, "%f\n", atom_getfloat(av+i));

So I am here asking for some other strategy to build this string or a way
to fix whatever could be wrong here.

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20230709/32f98b54/attachment.htm>


More information about the Pd-dev mailing list