Page 1 of 1

Square root in code

Posted: Thu Sep 02, 2010 10:10 am
by flowstone
Hi,

I'm a Flowstone novice trying to make an RMS voltmeter for the output of an audio processing stream. It would be fairly easy to do in code as the square root of the sum of the squares for an adjustable number of samples of the stream, but I don't see a square root function listed in the code expressions. Is there one? If not, how can I do it just in code?

Is there an alternative method using only the components? So far, I am trying to use mono to float from the output of an amplifier, then stack, square, square root. If that's right, all I need to do is trigger the mono to float block on every sample, but I don't see how to do that.

Thanks in advance for any advice and suggestions.

Re: Square root in code

Posted: Thu Sep 02, 2010 3:38 pm
by Exo
Hi Flowstone,

Your right there is no square root in the code component. But there is a square root command in the assembler component, you have to use that. I'm sure it will be implemented in code at some point.

Your method using components will not work because the triggers cannot be sent at sample rate. When working in 'green' the fastest anything can go is about 100hz using the ticker.

I've knocked up a quick example of how to do RMS in Flowstone. Sorry if I've just done it for you but it's easier for me to just do it than it is to try an explain it :D .

Cheers ;)

Exo

Re: Square root in code

Posted: Thu Sep 02, 2010 4:10 pm
by flowstone
Hi Exo,

That great! Thanks very much for your help! Can you recommend a good reference for assembler commands?

Clayton

Re: Square root in code

Posted: Thu Sep 02, 2010 4:47 pm
by Exo
Here's a list of the know supported ASM opcodes

Since Flowstone is based on synthmaker it's a good idea to check out the Synthmaker site and forum lots of useful info over there.

Cheers ;)

Exo

Re: Square root in code

Posted: Wed Sep 08, 2010 2:15 pm
by admin
FYI: Square Root in now added to the list of funtions in the code compoent :)