- Posts: 19899
- Thank you received: 4655
Parameters
- andypugh
- Offline
- Moderator
-
Less
More
12 years 9 months ago #42921
by andypugh
Yes, sort of.
#11 = 5
#31 = 10
#12 = 6
#32 = 6
O<mysub>call [1] [2]
O<mysub> sub
G0 X#[#1 + 10] Y#[#1 + 30] U#[#2 + 10] V#[#2 + 30]
Replied by andypugh on topic Parameters
grey1beard wrote: For example, is there a way to give the position X[5] Y[10] as #1, and X[6] Y[15] as #2
Yes, sort of.
#11 = 5
#31 = 10
#12 = 6
#32 = 6
O<mysub>call [1] [2]
O<mysub> sub
G0 X#[#1 + 10] Y#[#1 + 30] U#[#2 + 10] V#[#2 + 30]
Please Log in or Create an account to join the conversation.
- clunc
- Offline
- Elite Member
-
Less
More
- Posts: 245
- Thank you received: 37
12 years 9 months ago - 12 years 9 months ago #42930
by clunc
Replied by clunc on topic Parameters
I went off of this:
(main program)
(define a table of XY pairs for all the notes to be played, odd numbers are the Xposn, evens the Yposn)
( to necessary to play each note)
(88*2 ought to be enough for all the notes of a piano, ymmv)
(I put the table out here in main so it would be loaded once and not EACH time the sub is called)
#1= ; Xposn to play lowest note
#2= ; Yposn to play lowest note
#3= ; Xposn to play 2nd-lowest note
...
#175= ; Xposn to play highest note
#176= ; Yposn to play highest note
(define a set of "memorable" params to "point to" the top of each note pair)
( you will call sub with ONLY these, odd, numbers)
#<_C_OCTAVE0>=1 ; or whatever lowest note and octave are ; global so sub can read them
#<_Cs_OCTAVE0>
...
#<_F_OCTAVEn>=175 ; or whatever highest note and octave are
#<_MIDDLEC>=2500 ; every note has an EVEN number (something tells me 88 ought to be enough...)
O<mysub> call [#<_C_OCTAVE0>]
O<mysub> sub
(check that #1 is an odd number, else complain and stop)
(the parameter passed-in is the ADDRESS-OF a parameter pair containing)
( the Xposn, Yposn to play a note)
G0 X[##1] Y[#[#1+1]] ; go to (contents of #1 and #2 in main)
G91 G0 Z#<hammerdepth> F#<hammerspeed>
(dwell)
G91 G0 Z#<hammerdepth> F#<rapid>
O<mysub> endsub
...or something like it.
and based on later information that it's to play music, I think it wants something like the following.grey1beard wrote: ...it would be nice to be able to indicate the value of X for the particular note more compactly in the form of a single parameter.
(main program)
(define a table of XY pairs for all the notes to be played, odd numbers are the Xposn, evens the Yposn)
( to necessary to play each note)
(88*2 ought to be enough for all the notes of a piano, ymmv)
(I put the table out here in main so it would be loaded once and not EACH time the sub is called)
#1= ; Xposn to play lowest note
#2= ; Yposn to play lowest note
#3= ; Xposn to play 2nd-lowest note
...
#175= ; Xposn to play highest note
#176= ; Yposn to play highest note
(define a set of "memorable" params to "point to" the top of each note pair)
( you will call sub with ONLY these, odd, numbers)
#<_C_OCTAVE0>=1 ; or whatever lowest note and octave are ; global so sub can read them
#<_Cs_OCTAVE0>

...
#<_F_OCTAVEn>=175 ; or whatever highest note and octave are
#<_MIDDLEC>=2500 ; every note has an EVEN number (something tells me 88 ought to be enough...)
O<mysub> call [#<_C_OCTAVE0>]
O<mysub> sub
(check that #1 is an odd number, else complain and stop)
(the parameter passed-in is the ADDRESS-OF a parameter pair containing)
( the Xposn, Yposn to play a note)
G0 X[##1] Y[#[#1+1]] ; go to (contents of #1 and #2 in main)
G91 G0 Z#<hammerdepth> F#<hammerspeed>
(dwell)
G91 G0 Z#<hammerdepth> F#<rapid>
O<mysub> endsub
...or something like it.
Last edit: 12 years 9 months ago by clunc. Reason: add clarif.
Please Log in or Create an account to join the conversation.
Time to create page: 0.306 seconds