SynthMaker

Karplus-Strong

Archive · 2005 35 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

jorge ·

[old link] requires latest v.0.9.3o [old link]

Tom7777 ·

Great, thanks Jorge 🙂

jorge ·

Now with 3 Karplus-Strong modules:

[old link]

stefan ·

Argh! They are already here!

The arrays I mean!

Grr! If I only had the time!

lalo ·

oh yeah!!!!!!! we have arrays 🙂 and a random function i see 🙂...cool great jorge!!

lalo

rl ·

weeeeeehhhhh haaaaaaa!!!!

oh, there is rand(), are there more hidden treasures?

skOre ·

Argh, No time at all atm, feels like I'm losing touch ! Arrrrrghhh 😉

stefan ·

lalo wrote: oh yeah!!!!!!! we have arrays 🙂 and a random function i see 🙂...cool great jorge!!

lalo

I think it's a round integer function, not a random integer function 🙂

edit: wtf, we got both. there's a rand() there's as well.

Jorge & Malc, atm, you're my heroes, now, give an additional 8h / day (32h days that is) so I can spend some time with SM 🙂

Shifrin ·

Oh yeah! Been waiting for this for a while, arrays are awesome (and being able to do physical modelling too!) Can't wait to try this stuff out 😀

Wow! Cheers!

Shif.

lalo ·

wow....i'm excited 🙂

i wnoder if is it possible to 'freeze' the array... i mean to record in the array some signal and then keep in memory that signal... in other words until a particular index is reached the array 'stores' data...then it only reads data... maybe a kind of ('pseudocode' without all the indexing/pointing stuff)

float store[44100] ;

float read[44100] ;

store [index] = in ;

read [index]=store [index];

out = read[index] ;

?

lalo

stefan ·

polyin in; polyout out; float mem[10000]; float readCursor; float writeCursor;

writeCursor = writeCursor + (writeCursor < (10000 - 1)) & 1; readCursor = readCursor + 1; readCursor = readCursor - (readCursor > (10000 - 1) & 10000;

mem[writeCursor] = (writeCursor >= (10000 - 1)) & mem[writeCursor]; mem[writeCursor] = (writeCursor < (10000 - 1)) & in;

out = mem[readCursor];

Might work. Haven't tried it. Tell me if it doesn't 🙂

rl ·

another good use would be to read in / write out graph data.

more questions:

- does the loop now support variable boundaries?

e.g.

... polyin nSamples; float mem[nSamples]; loop ( nSamples ) { ... }

- float mem [10000]=rand(...); in jorges example looks like an initialization. When is it executed?

I really have to stop working, go home and install 0.9.3o.....

stefan ·

rl wrote: another good use would be to read in / write out graph data.

more questions:

- does the loop now support variable boundaries?

e.g.

... polyin nSamples; float mem[nSamples]; loop ( nSamples ) { ... }

That wouldn't work, since the value in nSamples could be different for different poly voices, and the code execution path must be the same for all of them.

lalo ·

thanx stefan..i'll try it and let u know 🙂

yes rl i wonder too about the array initialization.... is the array completely filled with the random values in 1/SR (the code component execution time)... this is good cause it saves all the coding needed to fill the array 🙂 a unique thing in code languages afaik 🙂

lalo

lalo ·

i wonder too if the array lenght can be as a variable obtained from an inlet 🙂 but i guess yes 🙂 lalo

jorge ·

lalo wrote: i wonder too if the array lenght can be as a variable obtained from an inlet 🙂 but i guess yes 🙂 lalo

Just create a fixed array with the maximum allowed size and use a circular buffer with size controlled by an input. Here's an example:

polyin in; polyin delay; polyin mult; polyout out; float write; float read; float mem[100000]; float var; write=write+1; read=read+mult; write=write-(write>delay)&delay; read=read-(read>delay)&delay; var=mem[read]; mem[write]=in; out=var;

The code above keeps a circular buffer and reads and writes at different rates changing the pitch of the input sound.

unkargherth ·

lalo wrote: thanx stefan..i'll try it and let u know 🙂

yes rl i wonder too about the array initialization.... is the array completely filled with the random values in 1/SR (the code component execution time)... this is good cause it saves all the coding needed to fill the array 🙂 a unique thing in code languages afaik 🙂

lalo

In fact rand function isn't recognized outsize an initialization like Jorge's post

( looks like a basis of some crude table func?)

lalo ·

woah!!! great jorge! this primitive roxxxx! ..pitch shifting...i'm coming 🙂

lalo

lalo ·

jorge and stefan 🙂

your codes works good...not to do what i've planned to do..but i like those a lot....

seems that arrays doesn't work when used in mono section...right?

lalo

lalo ·

infact i got a crash while tryin' to do a mono delay with the new array feature in the code component...it suddenly happen when i insert the module between a poly to mono and the asio output

i have the 2 debug and crash-log files on the other machine without interent connection...

if you like/need it jorge i can send it to you...only tell me where 🙂

lalo

jorge ·

lalo, I found some bugs related to the arrays that I'm fixing at the moment. Once it's fixed I'll upload a new release and then I'd be interested in knowing if your schematic still crashes. The best way you can help us fix bugs is to send schematics so we can replicate the bug and use the schematic for testing. Any time schematics can be posted to [email removed] or [email removed]. As you might have figured out already bugs related to sound would be better sent to me and GUI bugs to malc. If you're not sure you can always send to [email removed].

rl ·

as a little request, I would like to initialize arrays like;

float myArray[3] = {1.0, 3.0, 5.0};

Is this already possible? How would you advice to initialize an array to obtain some sort of wavetable?

jorge ·

rl wrote: as a little request, I would like to initialize arrays like;

float myArray[3] = {1.0, 3.0, 5.0};

Is this already possible? How would you advice to initialize an array to obtain some sort of wavetable?

[old link]

I'm at bug fixing stage now with the arrays so it should get reliable with the next releases. It was crashing for me in some situations.

rl ·

cool.

a nice feature(?) is that the float array indices are rounded to the next integer, so myArray[1.49999] == myArray[1] and myArray[1.5] == myArray[2]

jorge ·

rl wrote: cool.

a nice feature(?) is that the float array indices are rounded to the next integer, so myArray[1.49999] == myArray[1] and myArray[1.5] == myArray[2]

To try to keep the SSE efficiency all variables are floats, so the index is a float and it gets converted to an integer just at the point where the memory access its done. Basically myArray[index] is the same as myArray[ (int) index ].

unkargherth ·

Mmmmmm... stage(0) ?

If understood ok , all code in Stage(0) blcock gets called only in inicialization ( on relink, for mono, and on note on for poly), true?

There are other "stage"'s we should know about?

What happens if i try stage(1) , for example?

Shifrin ·

jorge wrote: Basically myArray[index] is the same as myArray[ (int) index ].

That's very useful to know 😉

Shif.

jorge ·

unkargherth wrote: Mmmmmm... stage(0) ?

If understood ok , all code in Stage(0) blcock gets called only in inicialization ( on relink, for mono, and on note on for poly), true?

There are other "stage"'s we should know about?

What happens if i try stage(1) , for example?

There are other stages, if you should know about them or not I'm not sure, it might confuse things but I'll try to explain and hope it doesnt. stage(0) will most probably change name to init(). Any code outside a stage gets compiled into stage(1). There's also stage(2) and stage(3). The synth is compiled into stage(0) for initialization running only once and to stage(1) + stage(2) + stage(3) running at full rate. The main use for stages 2 and 3 are for implementing Z^1. The code for a Z^-1 component would be something like:

polyin in; polyout out; float temp; stage(2) { out=temp; } stage(3) { temp=in; }

If you didnt have stages 2 and 3 the Z^-1 would behave in different ways depending on the order in which you connect them. If they'd be connected left to right it could create a waterfall effect where the input value just flows through the whole series of Z^-1 components. This is only an issue when you have separate Z^-1 components like the 1 sample delay. With stages you can run compiled code in the following way: - run initialization for the whole synth , same as stage 0 - run main processing stage, that's stage 1 for the whole synth - move all Z^1 temp variable to outs done at stage 2 for the whole synth - move all Z^-1 ins to temps done at stage 3 for the whole synth - ... stage 1 for the whole synth - ... stage 2 for the whole synth - ... stage 3 for the whole synth - ... stage 1 for the whole synth - ... stage 2 for the whole synth - ... stage 3 for the whole synth etc.

unkargherth ·

Mmmm. interesting to know, although i cannot see now any inmediate application ( except for the obvious stage0)

Anyway, thanks for sharing it whith us, jorge

bones ·

Quick question - what's an array?

jorge ·

bones wrote: Quick question - what's an array?

An array is a collection of values. While a float is one value like 1.2345, an array is many values together like 1.2323,3.2343,84.2343 etc Arrays are really important for creating effects like delay for example where you could setup an array of 44100 values to create a 1 sec delay.

unkargherth ·

Definition A collection of values of same type , adresable by an index

IN SM terms

float myarray[10] creates a var called myarray that could hold up to 10 float values. You can read a value by its index ( myarray[0] is the first value) and set the value the same way ( myarray[2]=0.5 sets 0.5 as the value for the THIRD position )

Notice that It holds TEN values with index starting at ZERO ( 0 is the first value, 1 is the 2nd, 2 is the 3rd,.....9 is the tenth)

bones ·

Cool, thanks.

rl ·

BTW: yesterday SM (0.9.3q) crashed very often e.g. when typing code into the code component or connecting wires. So I removed the stage (0) {...} block from my code and everything was fine again.

stefan ·

rl wrote: BTW: yesterday SM (0.9.3q) crashed very often e.g. when typing code into the code component or connecting wires. So I removed the stage (0) {...} block from my code and everything was fine again.

[old link]

🙂

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.