DSP frequency generator amplitude

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
S.Muse
Posts: 4
Joined: Mon Jul 08, 2019 5:47 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

DSP frequency generator amplitude

Post by S.Muse »

Hi,
it's my first post here, hello to everybody!

I've recently bought FC8 and I'm playing with the DSP components.

Please, which is the proper way to control the FreqGenerator wave amplitude with a potentiometer?
so that 0V gives zero amplitude, and 5V full amplitude?

I've been trying with the Scale DSP component without good results,
the closest I can get is to actually scale the input waveform, but unfortunately it becomes also completely distorted when I watch it in the data recorder...

Thanks in advance for your time and patience with such newbie question.
cheers!
Sandro

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DSP frequency generator amplitude

Post by Benj »

Hello Sandro,

Welcome to the forums. Can you attach what you have done so far and we will have a look for you and hopefully point you back in the right direction.

S.Muse
Posts: 4
Joined: Mon Jul 08, 2019 5:47 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: DSP frequency generator amplitude

Post by S.Muse »

Hi Benj,
thanks for your quick reply.
Here is my file attached.

Red potentiometer is the sine wave rate, and the blue one should be the sine wave amplitude control, from zero to unity gain.
I'm trying to use the Scale DSP component, have tried any macro within it, but without getting close to the desired behaviour.

I suspect I should do something to the blue potentiometer reading before using it with the Scale DSP, but can't figure out what to do.
many thanks for your help!
Attachments
LFO.fcfx
(14.02 KiB) Downloaded 150 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DSP frequency generator amplitude

Post by Benj »

Hello,

It looks like the scale maths is going a bit strange for signed buffers in the simulator. I've changed the buffers to be unsigned and changed the parameters of the sine wave generator and now it is hopefully working as expected.
LFO.fcfx
(14.57 KiB) Downloaded 201 times
Let me know how you get on.

S.Muse
Posts: 4
Joined: Mon Jul 08, 2019 5:47 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: DSP frequency generator amplitude

Post by S.Muse »

Thanks Benj !
Will try it tonight,
thank you very much.
best
Sandro

S.Muse
Posts: 4
Joined: Mon Jul 08, 2019 5:47 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: DSP frequency generator amplitude

Post by S.Muse »

Hi Benj

the code was perfect, thank you very much.
I've also added an offset control, using a Sum DSP component... and it works!!

Now I'm trying to use one of the DSP buffers as a float variable,
please which would be the standard procedure to do so?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DSP frequency generator amplitude

Post by Benj »

Hello,

Brilliant, glad it's working correctly for you now.

The easiest way is to use an DSP output component and read the value into a float variable. Once there you can do any floating point calculations required.

Post Reply