Simulate a clock signal / printing values

Post Reply
obliklines
Posts: 2
Joined: Sat Jan 19, 2019 6:49 pm

Simulate a clock signal / printing values

Post by obliklines »

Hi there,

VM is really a good platform !

I want to make a module that is synced to host. The test module of VMD does not seems to include options to test this so I thought I would simulate a clock signal with Named Timers.
1. Is this the most simple option?
2. What are the characteristics clocks signals? Is it +5V during 1 sample or longer?
3. Maybe a dummy question but how can I print values for debug ? System.out.println doesn't seem to work in the output console.

Thank you in advance :)
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Re: Simulate a clock signal / printing values

Post by DoctorG »

Hi there,
debugging is a bit of a nuisance. Here's what works for me...

1) the debugger lets you look at variables, etc. (Sorry, bit obvious.)
2) If you put a text box onto the canvas somewhere you can write text into the text box. Delete the text box when you're done.

Regarding 2, I have a text box with the module name in it that I sometime use for debugging. That way you don't take extra space on the canvas.

Very best regards...
gary
obliklines
Posts: 2
Joined: Sat Jan 19, 2019 6:49 pm

Re: Simulate a clock signal / printing values

Post by obliklines »

Thanks a lot ! Will try your text box tips ;)
Best regards,
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Re: Simulate a clock signal / printing values

Post by AndyMac »

I'd be really interested in any code snippets you'd be prepared to share on how to do the sync to host - especially if it is then possible to do division of the timer (i.e. 1/2 beat, 1/4 beat, 1/3 beat, etc.)
Cherry Dan
Site Admin
Posts: 257
Joined: Fri Jul 27, 2018 5:36 pm

Re: Simulate a clock signal / printing values

Post by Cherry Dan »

AndyMac wrote: Wed Jan 23, 2019 2:52 pm I'd be really interested in any code snippets you'd be prepared to share on how to do the sync to host - especially if it is then possible to do division of the timer (i.e. 1/2 beat, 1/4 beat, 1/3 beat, etc.)
There are two ways to sync to host. The simplest is to call GetTempo(), which is available in the VoltageModule class (along with GetTimeSignatureNumerator(), and GetTimeSignatureDenominator()). The other way is to use the Sync signal, which contains 96 pulses per quarter note. Dividing the sync signal into beats is simple - advance your clock every 96 pulses for quarter notes, every 48 pulses for eighth notes, every 32 pulses for triplets, etc. A reset jack is necessary in order to ensure your clock is properly synced to the playback clock.

Thanks,
Dan
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Re: Simulate a clock signal / printing values

Post by AndyMac »

Thank you, really clear.
User avatar
Captain
Posts: 103
Joined: Sat Aug 25, 2018 11:12 am

Re: Simulate a clock signal / printing values

Post by Captain »

DoctorG wrote: Sat Jan 19, 2019 7:58 pm 1) the debugger lets you look at variables, etc. (Sorry, bit obvious.)
2) If you put a text box onto the canvas somewhere you can write text into the text box. Delete the text box when you're done.
Also, you can use Log("something") to write to the Output console. Just have to run in the Debug mode for this to work. For continuously monitoring the value of a variable (or variables), I also use the textbox method all the time. :)
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Re: Simulate a clock signal / printing values

Post by AndyMac »

I've been doing the text box thing quite a lot recently. The log options looks quite nice - does this get optimised out for the published versions? But think having watch variables and break of variable change in the debugger would make the experience much better.
Post Reply

Return to “Module Designer”