Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turing Machine V1
#1
The Turing Machine V1.  Works with V2.0C

.map   TURING1.MAP (Size: 1,47 KB / Downloads: 58)  

This V1 got only the left shift option. Sounds best with any global scale enabled.
It uses the CV Input as 'switches' where 0 Volt means switch OFF another value means switch ON.
CV Input 1 : Set bit 0
CV Input 2 : Reset bit 0
CV Input 3 : Invert bit 0
CV Input 4 : Random bit 0
Of course you can replace the CV inputs with any other source easily.
If you got a trigger expander then you can see the turing parts nicely on Triggers 1-12.
You can use variables C, G and H to change some turing settings (see variables below)

The turing machine is connected to the sequencer and starts if the sequencer is started.
Var A: Switch/CV Input threshold (Initialized)
Var B: Type of trigger (Initialized w Trigger E1)
Var C: Amount of used turing bits
Var D: Helper variable for calculation (Initialized)
Var E: Used for program flow
Var F: Variable to hold the turing bits
Var G: Multiplicator for turing output (if less bits are used to get the full range anyways)
Var H: Pitch Offset

Code:
| 00 | GLOB | CLKO | ---- |>| ---- | ---- | ---- |  Use clock output as a 'clock source'
| 01 | CALC | CNT  | 00=0 |>| ---- | ---- | ---- |  Count on raising row 00
| 02 | ---- | ---- | ---- |>| ---- | ---- | ---- | 
| 03 | CALC | IF > | 01=1 |>| SETV | RW01 | RST  |  If row 01 is bigger than 1 then reset row 01
| 04 | SKIP | 03 > | 01=0 |>| ---- | ---- | ---- |  Skip the next 3 rows if row 01 is bigger than constant 0
| 05 | SKIP | 02 = | 09=0 |>| ---- | ---- | ---- |  Skip the next 2 rows if row 09 is 0
| 06 | CALC | SHTL | VFVC |>| SETV | V  F | SRC  |  Leftshift Var F, Use Var C for the amount of shifts. Store back in Var F
| 07 | VAR  | V  E | #001 |>| ---- | ---- | ---- |  Set Var E to constant 1
| 08 | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 09 | GLOB | SRUN | ---- |>| ---- | ---- | ---- |  Use the state 'Sequencer started'
| 0A | CALC | DINV | 09=0 |>| SETV | RW01 | RST  |  (digital) Invert row 09 and reset row 01 if the invert result is true
| 0B | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 0C | CV   | IN 1 | ---- |>| ---- | ---- | ---- |  Use CV Input 1
| 0D | SKIP | 01 < | 0CVA |>| ---- | ---- | ---- |  Skip the next row if row 0C is smaller than Var A (VA is a threshold)
| 0E | CALC | B OR | VF=1 |>| SETV | V  F | SRC  |  Bitwise OR of Var F and the constant 1 (which means always set LSB)  Store back in Var F
| 0F | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 10 | CV   | IN 2 | ---- |>| ---- | ---- | ---- |  Use CV Input 2
| 11 | SKIP | 01 < | 10VA |>| ---- | ---- | ---- |  Skip the next row if row 10 is smaller than Var A (VA is a threshold)
| 12 | CALC | BAND | VFVD |>| SETV | V  F | SRC  |  Bitwise AND of Var F with Var D (which is initialized to FFE)-> always clear LSB, Store in VF
| 13 | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 14 | CV   | IN 3 | ---- |>| ---- | ---- | ---- |  Use CV Input 3
| 15 | SKIP | 02 < | 14VA |>| ---- | ---- | ---- |  Skip the next 2 rows if row 14 is smaller than Var A (VA is a threshold)
| 16 | SKIP | 01 = | VE=0 |>| ---- | ---- | ---- |  Skip the next row if Var E is 0
| 17 | CALC | BXOR | VF=1 |>| SETV | V  F | SRC  |  Bitwise XOR of Var F with 1 (flip LSB of Var F) Store back in Var F
| 18 | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 19 | SKIP | 04 = | VE=0 |>| ---- | ---- | ---- |  Skip the next 4 rows if Var E is 0
| 1A | CALC | MUL  | VFVG |>| ---- | ---- | ---- |  Multiply Var F with Var G  (widen the range of the turing bits so the notes are more spread)
| 1B | CALC | ADD  | 1AVH |>| ---- | ---- | ---- |  ADD row 1A with Var H (add note offset so the pitches are a bit higher)
| 1C | CALC | P2NT | 1B=0 |>| CV   | NOTE | CV 1 |  Convert Pitchvalues (in row 1B) to Notenumbers and output notes on CV1
| 1D | VAR  | V  B | SRC  |>| TRIG | VAL* | TR 1 |  Use the value of Var B as the trigger type (E1) and output on Trigger 1
| 1E | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 1F | SKIP | 06 = | VE=0 |>| ---- | ---- | ---- |  Skip the next 6 rows if Var E is 0
| 20 | CV   | IN 4 | ---- |>| ---- | ---- | ---- |  Use CV Input 4
| 21 | SKIP | 04 < | 20VA |>| ---- | ---- | ---- |  Skip the next 4 rows if row 20 is smaller than Var A (threshold)
| 22 | GLOB | RAND | ---- |>| ---- | ---- | ---- |  Generate random value
| 23 | CALC | BAND | 22=1 |>| ---- | ---- | ---- |  Bitwise AND row 22 with 1 (results in only the LSB)
| 24 | CALC | BAND | VFVD |>| SETV | V  F | SRC  |  Bitwise AND Var F with Var D and store in Var F
| 25 | CALC | B OR | VF23 |>| SETV | V  F | SRC  |  Bitwise OR Var F with row 23 and store in Var F
| 26 | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 27 | VAR  | V  E | #000 |>| ---- | ---- | ---- |  Reset Var E to 0
| 28 | ---- | ---- | ---- |>| ---- | ---- | ---- |
| 29 | CALC | BAND | VF=1 |>| TRIG | GATE | 1- 1 |  Bitwise AND of Var F with 1 (bit 0)and output on Trigger16 #1
| 2A | CALC | BAND | VF=2 |>| TRIG | GATE | 1- 2 |  Bitwise AND of Var F with 2(bit 1) and output on Trigger16 #2
| 2B | CALC | BAND | VF=4 |>| TRIG | GATE | 1- 3 |  Bitwise AND of Var F with 4(bit 2) and output on Trigger16 #3
| 2C | CALC | BAND | VF=8 |>| TRIG | GATE | 1- 4 |  Bitwise AND of Var F with 8(bit 3) and output on Trigger16 #4
| 2D | CALC | RSFT | VF=4 |>| ---- | ---- | ---- |  Rightshift Var F with 4 bits (do not store in Var F)
| 2E | CALC | BAND | 2D=1 |>| TRIG | GATE | 1- 5 |  Bitwise AND of row 2D with 1(2nd bit) and output on Trigger16 #5
| 2F | CALC | BAND | 2D=2 |>| TRIG | GATE | 1- 6 |  Bitwise AND of row 2D with 2(2nd bit) and output on Trigger16 #6
| 30 | CALC | BAND | 2D=4 |>| TRIG | GATE | 1- 7 |  Bitwise AND of row 2D with 4(2nd bit) and output on Trigger16 #7
| 31 | CALC | BAND | 2D=8 |>| TRIG | GATE | 1- 8 |  Bitwise AND of row 2D with 8(2nd bit) and output on Trigger16 #8
| 32 | CALC | RSFT | 2D=4 |>| ---- | ---- | ---- |  Rightshift row 2D with 4 bits 
| 33 | CALC | BAND | 32=1 |>| TRIG | GATE | 1- 9 |  Bitwise AND of row 32 with 1(2nd bit) and output on Trigger16 #9
| 34 | CALC | BAND | 32=2 |>| TRIG | GATE | 1-10 |  Bitwise AND of row 32 with 2(2nd bit) and output on Trigger16 #10
| 35 | CALC | BAND | 32=4 |>| TRIG | GATE | 1-11 |  Bitwise AND of row 32 with 4(2nd bit) and output on Trigger16 #11
| 36 | CALC | BAND | 32=8 |>| TRIG | GATE | 1-12 |  Bitwise AND of row 32 with 8(2nd bit) and output on Trigger16 #12

So how does it work. In general it is a turing machine which uses the 4 CV inputs. If Input 1 is on (high) then turing bits (on the LSB) are set.
If Input 2 is on (high) then turing bits on the LSB are reset. If Input 3 is on (high) then the LSB of the turing value is being inverted. If Input 4 is on (high) then the LSB of the turing value with randomly be set or reset.
Rows 00 to 0A will use the Clock output and on a raising edge (and running sequencer) then the turing value will be shifted. Var E will be set then as well (if sequencer is running AND a raising edge) which is being used in later checks then (like if Var E is set then other commands following can be executed). 
Row 0C to 0E do the check for the first input and will set the turing LSB if the input was high.
Row 10 to 12 do the check for the second input and will reset the turing LSB if the input was high.
Row 14 to 17 do the check for the third input and will invert the LSB if the input was high. Checking Var E is taking care that the LSB is not inverting all the time but only once on each raising edge of the clock.

Row 19 to 1D will check if Var E is set and then it will output the current turing value to output CV1 and generates a trigger. The value is optimized via multiplication and an offset so it is audibly more interresting.
Row 1F to 25 will check Input 4 and will randomly set or reset the LSB of the turing value if the input was high.
Note: the block row19-1D and row 1F-25 could/should be swapped for the better readability but it doesn't really matter for the result as always Variable F is being used for the output.

Row does reset Variable E again which takes care that all the important stuff up there is always only being executed once when the raising clock with a started sequencer happened.

Row 29-36 does generally a bitwise check of all the turing bits and outputs the bit states on the Trigger 16 Expander (NSA1) outputs 1-12. This gives a nice visual feedback of the turing value.
PLEASE use the search function if something have been asked or discussed before.
Every (unnessesary) forum support means less time to develop! But of course, i am here to help!  Smile
Reply
#2
I just added the code of the map (extracted using the new mapping editor https://xor-electronics.com/mappingeditor/) with an explanation of how it works basically.
PLEASE use the search function if something have been asked or discussed before.
Every (unnessesary) forum support means less time to develop! But of course, i am here to help!  Smile
Reply
#3
Thank you for posting this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)