If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Stream Greater Than ...
7 posts
• Page 1 of 1
Stream Greater Than ...
Hello, I can't figure how to use the "Stream Greater Than" primitive, comparing two Streams.
See attached .fsm.
There is a DSP code trying to generate a recurrent Pulse (sorte of Dirac). That part is almost fine.
I want the DSP code to generate a Green Trigger each time a Dirac gets pulsed, for triggering the "Scope" primitive.
This way the scope runs in sync with the Dirac.
For generating such trigger, the DSP code is outputting a second stream, that one is a "dummy" constant 0.25 signal.
The idea is to rely on the "Stream Greater Than" primitive, comparing the two Streams (the Dirac and Dummy), automatically generating a "Green Trigger", possibly eating little CPU resource.
Surely there is something important I have not understood.
Any help much appreciated.
Steph.
See attached .fsm.
There is a DSP code trying to generate a recurrent Pulse (sorte of Dirac). That part is almost fine.
I want the DSP code to generate a Green Trigger each time a Dirac gets pulsed, for triggering the "Scope" primitive.
This way the scope runs in sync with the Dirac.
For generating such trigger, the DSP code is outputting a second stream, that one is a "dummy" constant 0.25 signal.
The idea is to rely on the "Stream Greater Than" primitive, comparing the two Streams (the Dirac and Dummy), automatically generating a "Green Trigger", possibly eating little CPU resource.
Surely there is something important I have not understood.
Any help much appreciated.
Steph.
- Attachments
-
- Stream Greater Than.fsm
- (9.02 KiB) Downloaded 889 times
-
- Stream Greater Than.png (48.5 KiB) Viewed 12648 times
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: Stream Greater Than ...
Hey steph,
you have run into a data type problem.
The stream prims are incompatible with the green 'on true'.
I'm not exactly sure what to do to achieve your functionality.
Will have a look.
One thing that may help is that green->blue works,
just not blue->green
you have run into a data type problem.
The stream prims are incompatible with the green 'on true'.
I'm not exactly sure what to do to achieve your functionality.
Will have a look.
One thing that may help is that green->blue works,
just not blue->green
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Stream Greater Than ...
conceptually, the greens and blues can not work together at samplerate.
the blue must always be grabbed with a primitive mono to sample,
and then sampled at a lower frequency, using a green tick generator or a ruby clock.
in this case it is better to make a comparison in blue, and convert the boolean in green,
this does not guarantee an accurate result at the sampling frequency.
But you could do with a ruby sampling using the Frame class, and from it generate the trig.
this should be in sync with the blue, with a buffer equal to your buffer driver of your sound card.
you can find an example here.
But if your goal and do not have a trig accurate,
just use a single primitive mono to sample after the comparison in blue to convert it to green, and generate the trig.
the blue must always be grabbed with a primitive mono to sample,
and then sampled at a lower frequency, using a green tick generator or a ruby clock.
in this case it is better to make a comparison in blue, and convert the boolean in green,
this does not guarantee an accurate result at the sampling frequency.
But you could do with a ruby sampling using the Frame class, and from it generate the trig.
this should be in sync with the blue, with a buffer equal to your buffer driver of your sound card.
you can find an example here.
But if your goal and do not have a trig accurate,
just use a single primitive mono to sample after the comparison in blue to convert it to green, and generate the trig.
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Stream Greater Than ...
A solution is to rely on a Green triggered Blue Dirac generator. In other words, the master trigger would be a Tick25 (possibly divided by five) used as input for the Dirac Blue code.nix wrote:Hey steph, one thing that may help is that green->blue works, just not blue->green
The first difficulty is to transform a trigger in something that can be read, reliably, by the Blue DSP Code.
The second difficulty is to write Blue code (i86 condition and mask) implementing the required if/then structure.
Using a flip-flop done in Green I can transform the Tick25 (trigger) into a Float equal 0.0 during 100 ms, and equal 1.0 during the next 100 ms, and this will be the Green sync signal entering the Blue DSP code implementing the Dirac.
The Blue DSP code of the Dirac would read the sync and do :
set the tmp variable to zero
if (new sync <> old sync) then : set tmp variable to one : end
output the tmp variable as audio (it will thus be a one during one sample, if we just experienced a trigger change)
Can you show an example?
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: Stream Greater Than ...
steph_tsf wrote:The Blue DSP code of the Dirac would read the sync and do :
set the tmp variable to zero
if (new sync <> old sync) then : set tmp variable to one : end
output the tmp variable as audio (it will thus be a one during one sample, if we just experienced a trigger change)
Can you show an example?
- Code: Select all
streamin Trigger; // 0<1 flip-flop
streamout Pulse; // out 1 only one sample
float Last;
Pulse=(Trigger!=Last)&1;
Last=Trigger
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Stream Greater Than ...
Thanks for the example, very efficient. I let you compare with what I've been fiddling!
- Attachments
-
- Synched Dirac.png (34.98 KiB) Viewed 12602 times
- steph_tsf
- Posts: 249
- Joined: Sun Aug 15, 2010 10:26 pm
Re: Stream Greater Than ...
to use my code
you could replace your flip flop with this.
you could replace your flip flop with this.
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 134 guests