Streamboolout in Code component

DSP related issues, mathematics, processing and techniques
Post Reply
nkiernan
Posts: 7
Joined: Tue Oct 05, 2010 3:11 pm

Streamboolout in Code component

Post by nkiernan »

Hi,
I have been using the code component to read the signal from a PWM module. The idea being to trigger every time the pulse from the PWM is high, and the frequency of the pulses varies (prototype for an engine dyno). I haven't been able to find a way to do this using the standard components.

I have the code component working and a scope shows the output to behave as expected. I am trying to use the 'streamboolout' function to output high every time a PWM high signal is detected so this can activate a counter.

I can't get the streamboolout to output any sort of signal, the bool output symbol on the right side of the code module us just grayed out, maybe I'm using the wrong syntax. I've tried:
streamboolout = 1;
streamboolout = 0;
streamboolout = high;
streamboolout = low; etc

How do I get the code component to output using streamboolout?
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: Streamboolout in Code component

Post by Exo »

Hey nkiernan, Welcome to Flowstone :)

Code: Select all

streamin pwm;
streamboolout high;
streamboolout low;
streamout countHigh;
float oldpwm;

high = (pwm>0) &(oldpwm<=0); //A streamboolout should be a comparison and not an actual variable.

countHigh = countHigh+(high&1);

oldpwm = pwm;


Something like that should work..... if your still having problems then post an .fsm file of what your trying to do and I'll see if I can see where you are going wrong.

Cheers ;)

Exo
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
nkiernan
Posts: 7
Joined: Tue Oct 05, 2010 3:11 pm

Re: Streamboolout in Code component

Post by nkiernan »

Hey Exo, thank you for the welcome. I'm enjoying the experimentation with Flowstone, but coming from Pure Data there are certain objects missing that I'd be used to. Just getting my head around the work-arounds.

Thank you for the code advise also. I've attached the scaled down .fsm file I'm working on and have added the comments in the schematic to show where I'm having problems! I'm sure its something simple I'm missing. Sorry if I'm wasting your time on trivial inquiries.
Attachments
Signal_Generator_001.fsm
Test signal generator section of an engine dyno project
(74.73 KiB) Downloaded 1752 times
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: Streamboolout in Code component

Post by Exo »

Ah I see what you are doing now....

To get from stream to "green" you need the component "Mono to Float" with a "ticker 100" .

I would do the counting in code though, the code component is sample accurate where as sampling to the "green" data is limited to 100hz.

Exo
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
nkiernan
Posts: 7
Joined: Tue Oct 05, 2010 3:11 pm

Re: Streamboolout in Code component

Post by nkiernan »

Exo, thank you for your help. That makes good sense, I'll see how I get on with your suggestion. Thanks again.
Post Reply