Support

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

Accurate Waveform-cycle Display

For general discussion related FlowStone

Accurate Waveform-cycle Display

Postby tulamide » Thu Nov 26, 2015 6:42 pm

I know I'm asking for much, but I don't see any light at the end of the tunnel:

For Martin's awesome SWM-Sine Oscillator (from this thread) I would like to have a display of the waveform, so that any change to SWM is visible to the user. I don't need help regarding the displaying itself, but I have no clue how to get the correct data from the osc. Here are the requirements:

-Data should only be given out on a green trigger, to prevent contiguous cpu-load while active.
-The data should also be given out when no sound is playing.
-It needs to be the exact data needed to display exactly one cycle of the waveform, from beginning to end (not starting inbetween)

There's no size requirement; I can always map to 256 pixels, or 128 or whatever. The scope doesn't help me, because it just displays what is coming in.
My read is that it is somehow related to a frequency against the samplerate to get the right spot for the start of the data. But since there is no data if nothing is playing, I wouldn't know how to solve this.

Is someone able to help me finding a solution that meets the three points mentioned above?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Accurate Waveform-cycle Display

Postby adamszabo » Thu Nov 26, 2015 6:53 pm

You mean like this? :)
Attachments
PWM-SineGenerator_GRAPH.fsm
(100.7 KiB) Downloaded 866 times
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Accurate Waveform-cycle Display

Postby tulamide » Thu Nov 26, 2015 7:51 pm

Thank you so much for the quick answer! Unfortunately I have a lot of questions, and I can only hope you don't mind :oops:

It only works with an extra oscillator?
And how does it work exactly?
You seem to have calculated a frequency (how did you do it?) and I guess that a constant green float value forces the osc to stay active all time?
Would a selector switch activate and de-activate the oscillator, so that I can use it when needing to redraw, but keep it from cpu-usage when no redrawing is needed?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Accurate Waveform-cycle Display

Postby martinvicanek » Thu Nov 26, 2015 11:05 pm

tulamide, the key is the analyzer prim. It will make the connected stream moduke run NS times and then stop. No wasted CPU. It is a very handy prim.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Accurate Waveform-cycle Display

Postby tulamide » Thu Nov 26, 2015 11:53 pm

martinvicanek wrote:tulamide, the key is the analyzer prim. It will make the connected stream moduke run NS times and then stop. No wasted CPU. It is a very handy prim.

Thanks a lot, Martin! I didn't know that it works this way. Indeed very handy.

Now the only thing left is the calculation of the frequency. I don't mean the conversion from Hz to 0-1 or vice-versa, but how to calculate the actual value? Why is 0.008 something the correct value? It should be around 180 Hz which means 180 sample points per second. NS is at 256 sample points. I'm obviously missing something, just don't know what.

EDIT: Of course I meant 180 cycles, not sample points^^

EDIT 2: OH STUPID ME! Sample rate divided by the number of sample points = frequency to use :oops:
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Accurate Waveform-cycle Display

Postby RJHollins » Fri Nov 27, 2015 3:57 am

Thanks tulamide !

That made it clearer for me :mrgreen:
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Accurate Waveform-cycle Display

Postby adamszabo » Fri Nov 27, 2015 11:25 am

tulamide wrote:Now the only thing left is the calculation of the frequency.


Actually I just connected the float and changed the values until 1 cycle of waveform was displayed... nothing scientific lol. But what you wrote with the sample rate division should be the scientific answer.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Accurate Waveform-cycle Display

Postby tulamide » Fri Nov 27, 2015 1:26 pm

adamszabo wrote:But what you wrote with the sample rate division should be the scientific answer.


I'm not sure if this is what people mean by "time domain", but at a sample rate of, for example, 44100, exactly 44100 sample points are used to play 1 second of sound.
So 256 sample points are just representing 0.0058s, which is the 1/172.265625th part of a second (you get this when dividing 44100 by 256).
So which frequency oscillates 172.265625 times per second? 172.265625 Hz, of course.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: Google [Bot] and 73 guests

cron