Meneer_Jansen

Korg Monolouge determine settings of a patch

Mar 9th, 2022 (edited)
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 19.41 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3.  
  4. #######################################
  5. #  _     ____                         #
  6. # / |   |  _ \ _   _ _ __ ___  _ __   #
  7. # | |   | | | | | | | '_ ` _ \| '_ \  #
  8. # | |_  | |_| | |_| | | | | | | |_) | #
  9. # |_(_) |____/ \__,_|_| |_| |_| .__/  #
  10. #                             |_|     #
  11. #######################################
  12.  
  13. # Watch output from Korg on commandline:
  14. # aseqdump -p 24:1 | grep -v Clock
  15. # This script assumes that the Midi client is No. 24 and the port is 1.
  16.  
  17. clear
  18. echo -e "This script shows the settings that produce the sound that you are *currently* hearing.
  19.  
  20. Those settings (the \"patch\") might NOT be what you actually see on your Korg! If you've loaded a Program (and you've turned some knobs) then there is no way of knowing if what you see on the Korg are actually the settings that generate the sound you hear.
  21.  
  22. On the Korg press/turn the following buttons/knobs:
  23.   1. Press Edit Mode
  24.   2. Press No. 12 on the sequencer
  25.   3. Turn the Program knob
  26.   4. Press Write
  27.  
  28. When the message \"Transmitting\" has disappeared from the Monologue's display press CTRL + C on this computer.
  29. "
  30.  
  31. # Copy the Korg's dump to a file and remove uncecessary stuff from it.
  32. # Starting to dump stuff to text file:
  33. aseqdump -p 24:1 > aseqdumpfile.txt
  34.  
  35. # Removing all lines containing "Clock" etc.
  36. sed -i '/Clock\|Start\|Stop\|Note\|Control/d' aseqdumpfile.txt
  37.  
  38. # Delete certian parts to only leave the HEX numbers:
  39. sed -i 's/ 24:1   System exclusive           \|Waiting for data. Press Ctrl+C to end.\|Source  Event                  Ch  Data//g' aseqdumpfile.txt
  40.  
  41. # Remove empty lines that were left behind:
  42. sed -i '/^$/d' aseqdumpfile.txt
  43.  
  44. # Check if file is non-empty
  45. if [ -s aseqdumpfile.txt ]
  46.    then
  47.         echo "SysEx dumpfile exists and is non-empty"
  48.    else
  49.         echo -e "\e[31;5;1m \nSysEx dumpfile is empty. Is your Korg connected to this computer? Exiting...\n \e[0m"; exit
  50. fi
  51.  
  52.  
  53.  
  54.  
  55.  
  56. #######################################################
  57. #  ____      _   _                                    #
  58. # |___ \    | | | | _____  __   ___ ___  _ ____   __  #
  59. #   __) |   | |_| |/ _ \ \/ /  / __/ _ \| '_ \ \ / /  #
  60. #  / __/ _  |  _  |  __/>  <  | (_| (_) | | | \ V /   #
  61. # |_____(_) |_| |_|\___/_/\_\  \___\___/|_| |_|\_(_)  #
  62. #                                                     #
  63. #######################################################                                                  
  64.  
  65. # Converting numbers via functions.
  66.  
  67. # The Korg sends a HEX number between 0 and 127 (Midi!) that represents the amount of which a knob is turned. However, if a knob is turned more than half way this number represents the amount of which it is turned past 50%. So the number must be devided by 2 and it must be added to 64 if knob > 50%. Another number determines *if* the knob was turned more than 50%.
  68.  
  69. # Convert from HEX to DEC and devide by 2:
  70. function abc ()
  71. {
  72.    # NR==1 means first record or first line.
  73.    hex=`awk 'NR==1{print $'$1'}' aseqdumpfile.txt`
  74.    dec=`echo $(( 16#$hex / 2  ))`
  75.    echo $dec
  76. }
  77.  
  78.  
  79. # Determine value in DEC of entry No. $1 in record:
  80. function xyz ()
  81. {
  82.    # NR==1 means first record or first line.
  83.    hex=`awk 'NR==1{print $'$1'}' aseqdumpfile.txt`
  84.    dec=`echo $(( 16#$hex ))`
  85.    echo $dec
  86. }
  87.  
  88.  
  89. # Convert hex value to a value between 0 and 1023 and devide by 2:
  90. function val ()
  91. {
  92.    hex=`awk 'NR==1{print $'$1'}' aseqdumpfile.txt`
  93.    dec=`echo $(( 16#$hex / 2 ))`
  94.    val=`echo $((  ($dec + 1) * 100 / 127 * 1023 /100 ))`
  95.    echo $val
  96. }
  97.  
  98.  
  99. # Convert the devided number to percentage and devide by 2:
  100. function perc ()
  101. {
  102.    hex=`awk 'NR==1{print $'$1'}' aseqdumpfile.txt`
  103.    # The "+ 1" below to get 100% instead of 99% when fully turned open.
  104.    dec=`echo $(( 16#$hex / 2 ))`
  105.    perc=`echo $((  ($dec + 1) * 100 / 127 ))`
  106.    echo $perc
  107. }
  108.  
  109.  
  110. function knob_values_not_halfway ()
  111. {
  112.    perc=$(( $(perc $knob) ))       # This is the precentage of knob turned.
  113.     val=$(( $(val  $knob) ))       # This is the Korg value.
  114.     dec=$(( $(abc  $knob) ))       # This is the Midi value.   
  115. }                                        
  116.  
  117.                                                                                  
  118. function knob_values_halfway ()      
  119. {                                    
  120.    perc=$(( $(perc $knob) + 50  ))    
  121.     val=$(( $(val  $knob) + 512 ))  
  122.     dec=$(( $(abc  $knob) + 64  ))  
  123. }
  124.  
  125.  
  126. # Knobs:
  127. # 28 VCO1 shape
  128. # 31 VCO1 mixervolume
  129. # 42 Drive
  130. # 44 VCO2 octave
  131. # 50 LFO: wave, mode and target
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141. ######################################
  142. #  _____    ____  _             _    #
  143. # |___ /   / ___|| |_ __ _ _ __| |_  #
  144. #   |_ \   \___ \| __/ _` | '__| __| #
  145. #  ___) |   ___) | || (_| | |  | |_  #
  146. # |____(_) |____/ \__\__,_|_|   \__| #
  147. #                                    #
  148. ######################################
  149.  
  150. clear
  151. echo -e "TABLE 1. Settings in % of knob turned, value on the display (from 0 - 1023) and Midi values (0 - 127) of the various knobs and switches of the Korg Monologue. The values of the Intensity of the EG and the LFO are between 0 and +/-511 on the Korg's display and between 63 and 0 for Midi. If the intensity is negative then its Midi value is between 64 and 127.
  152. ______________________________________________________________________
  153.  
  154. \e[1mKnob  \t\t\t Value (%)  \t Korg value  \t Midi value \e[0m
  155. ______________________________________________________________________"
  156.  
  157.  
  158. ######################### 1. OVERDRIVE #########################################
  159. knob=42
  160. number=`echo $(xyz 40)`
  161. string01=(19 23 27 31 51 55 59 63 83 115)
  162. # If No. 40 element of { ... } then > 50%.
  163. # Notice that the < 50% value is always 2 lower.
  164.  
  165. knob_values_not_halfway $knob
  166. if [[ ${string01[@]} =~ $number ]]; then for element in ${string01[@]}; do
  167. if [[ $element       == $number ]]; then knob_values_halfway $knob; fi; done; fi
  168.  
  169. echo -e  "
  170. \e[4m1. OVERDRIVE\e[0m \t\t $perc  \t\t $val \t\t $dec"
  171.  
  172.  
  173.  
  174. ######################### 2. VCO 1 ##############################################
  175. echo -e "\n\e[4m2. VCO 1\e[0m"
  176. # 2a. VCO 1 WAVE FORM
  177. number01=`echo $(xyz 43)`
  178. number02=`echo $(xyz 40)`
  179. string01='17 19 25 27 40 49 51 57 81 83 89'
  180. # Numbers 40 and 43 determine VCO 1 Wave.
  181. # Number 40 appears to be 2 lower than the no. 40 value in Drive.
  182. # If No. 43 greater than 63, then wave = triangular:
  183. # Value No. 40 is always 4 higher for the Sawtooth than for the Pulse wave.
  184. wave="Sawtooth |\|\| "
  185. if  
  186.    [ $number01 -gt 63 ]  
  187.    then
  188.       wave="Triangular /\/\ "
  189.    else
  190.       if [[ ${string01[@]} =~ $number02 ]]; then for element in ${string01[@]}; do
  191.       if [[ $element       == $number02 ]]; then wave="Square |¯|_|"; fi; done; fi      
  192. fi
  193. echo -e  "\
  194. a. Wave form \t\t $wave"
  195.  
  196.  
  197.  
  198. # 2b. VCO 1 SHAPE
  199. knob=28                     # Knob 28 determines VCO 1 Shape.
  200. number=`echo $(xyz 24) / 8` # No. 24 determines if knob is > half way.
  201. # No. 43 might have someting to do w/ it too.
  202. # No. 24 must be devided by 8. If that number is odd then > 50%.
  203. # No. 24 depends on 'VCO1 Shape', 'VCO1 Mixer', 'VCO2 Shape' and'VCO2 Pitch'!
  204. if
  205.    [ $((number%2)) -eq 0 ]  
  206.    then
  207.    knob_values_not_halfway $knob
  208.    else
  209.    knob_values_halfway $knob
  210. fi
  211. echo -e  "\
  212. b. Shape \t\t $perc \t\t $val   \t\t $dec"
  213.  
  214.  
  215. # 2c. VCO 1 MIXER VOLUME
  216. knob=31
  217. # No. 24 must be greater than 64. If less, then knob not past half way.
  218. # No. 24 depends on 'VCO1 Shape', 'VCO1 Mixer', 'VCO2 Shape' and'VCO2 Pitch'!
  219. if
  220.    [ $(xyz 24) -gt 63 ]  
  221.    then
  222.    knob_values_halfway $knob
  223.    else
  224.    knob_values_not_halfway $knob  
  225. fi
  226. echo -e  "\
  227. c. Mixer volume \t $perc  \t\t $val  \t\t $dec"
  228.  
  229.  
  230.  
  231.  
  232.  
  233. ################################# 3. VCO 2 #######################################
  234. echo -e "\n\e[4m3. VCO 2\e[0m"
  235.  
  236. # 3a. VCO 2 WAVE FORM
  237. number01=`echo $(xyz 40)`
  238. number02=`echo $(xyz 44)`
  239. string01=(19 23 25 29 31 57 59 61 89 91 93)
  240. # [6-3-2017] Maybe 21 and 27 should be in there too. Making it 3 times 3 groups of uneven numbers.
  241. # Numbers 40 and 44 determine VCO 1 Wave.
  242. # If No. 40 element of { ... } then Sawtooth.
  243. # No. 40 changes w/ the 'VCO1 Wave' and 'EG Target' switches.
  244. # If No. 44 > 63, then wave = Triangular.
  245. # Else: Noise.
  246. wave="Noise \?^~- "
  247. if
  248.    [ $number02 -gt 63 ]  
  249.    then
  250.    wave="Triangular /\/\ "
  251.    else
  252.    if [[ ${string01[@]} =~ $number01 ]]; then for element in ${string01[@]}; do
  253.    if [[ $element       == $number01 ]]; then wave="Sawtooth |\|\| "; fi; done; fi
  254.  
  255. fi
  256. echo -e  "\
  257. a. Wave form \t\t $wave"
  258.  
  259.  
  260.  
  261. # 3b.VCO 2 SHAPE
  262. knob=30                            # Knob 30 determines VCO 2 Shape.
  263. number01=`echo $(xyz 24)`          # Knob 24 determines if > or < 50%.
  264. string01=(4 20 68 72 76 84 88 92)  # Shape < 50%.
  265. # No. 24 depends on 'VCO1 Shape', 'VCO1 Mixer', 'VCO2 Shape' and 'VCO2 Pitch'!
  266. # For > 50% the values are 32 higher
  267. # No. 44 seems to be associated too...
  268.  
  269. knob_values_halfway $knob
  270.  
  271. if [[ ${string01[@]} =~ $number01 ]]; then for element in ${string01[@]}; do
  272. if [[ $element       == $number01 ]]; then
  273. knob_values_not_halfway $knob; fi; done; fi
  274.  
  275. echo -e  "b. Shape \t\t $perc \t\t $val \t\t $dec"
  276.  
  277.  
  278.  
  279.  
  280.  
  281. # 3c. VCO 2 MIXER VOLUME
  282. knob=33
  283. # Knob 33 determines VCO 2 mixer level.
  284. # No. 32 must be even for knob 33 < 50%.
  285.  
  286. if
  287.    [ $(($(xyz 32)%2)) -eq 0  ]  
  288.    then
  289.       knob_values_not_halfway $knob
  290.    else
  291.       knob_values_halfway $knob
  292. fi
  293. echo -e  "\
  294. c. Mixer volume \t $perc \t\t $val \t\t $dec"
  295.  
  296.  
  297.  
  298.  
  299. # 3d. VCO 2 SYNC/RING
  300. switch=`echo $(xyz 45)` # Number 45 determines VCO2's Synch/Ring settings
  301. if
  302.    [ $switch -eq 102 -o $switch -eq 106 ]  
  303.    then
  304.    ring="Synch"
  305.    else
  306.       if
  307.          [ $switch -eq 101 -o $switch -eq 105 ]
  308.          then
  309.          ring="Neutral"
  310.          else
  311.          ring="Ring"
  312.       fi
  313. fi
  314. echo -e  "\
  315. d. Synch/Ring \t\t $ring"
  316.  
  317.  
  318.  
  319.  
  320. # 3e. VCO 2 PITCH
  321. knob=29
  322. number01=`echo $(xyz 24)`
  323. string01=(18 20 52 60 84 92 116 124)  # Pitch > 50%
  324. # VCO 2 Pitch is between -1200C and +1200C on the Korg's display!
  325. # Midi behaves normally.
  326. # If No. 24 element of { ... } then Pitch > 50%.
  327. # No. 24 depends on 'VCO1 Shape', 'VCO1 Mixer', 'VCO2 Shape' and 'VCO2 Pitch'!
  328.  
  329. if [[ ${string01[@]} =~ $number01 ]]; then for element in ${string01[@]}; do
  330. if [[ $element       == $number01 ]]; then
  331. temp_var01=1
  332. knob_values_halfway $knob
  333. # echo -e  "Pitch \t\t\t $perc \t\t $(( ($perc - 50) * 24 ))C    \t\t $dec"; fi; done; fi
  334.   echo -e  "c. Pitch \t\t $perc \t\t (not linear) \t $dec"; fi; done; fi
  335.  
  336. if
  337.    [ -z $temp_var01 ]
  338.    then
  339.    knob_values_not_halfway $knob
  340. #  echo -e  "Pitch \t\t\t $perc \t\t -$(( (50 - $perc) * 24 ))C      \t $dec"
  341.    echo -e  "c. Pitch \t\t $perc \t\t (not lineair) \t $dec"
  342. fi
  343.  
  344.  
  345.  
  346. # 3f. VCO 2 OCTAVE SWITCH
  347. switch01=`echo $(xyz 44)`
  348.  
  349. if
  350.     [[ $(xyz 44) -ge 0 && $(xyz 44) -lt 16 ]]
  351.     then octave="4"
  352.     elif
  353.     [[ $(xyz 44) -ge 16 && $(xyz 44) -lt 32 ]]
  354.     then octave="3"
  355.     elif
  356.     [[ $(xyz 44) -ge 32 && $(xyz 44) -lt 48 ]]
  357.     then octave="2"
  358.     elif
  359.     [[ $(xyz 44) -ge 48 ]]
  360.     then octave="1"
  361. fi
  362. echo -e  "\
  363. f. Octave  \t\t $octave"
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372. ############################### 4. FILTER ##########################################
  373. echo -e "\n\e[4m4. FILTER\e[0m"
  374.  
  375. # 4a. FILTER CUTOFF
  376. knob=34
  377. number=`echo $(xyz 32)`
  378.   string01=(34 35 38 39 42 43 47 48  50 51 55 58 62 63 98 99 102 103 110 111 114 126 127) # Knob > 50%
  379. # string01=(32 33 36 37 40 41    46  48 49       60    96    100     108 109     124    ) # Knob < 50%
  380. # Knob 32 determines > or < 50% Notice that the string is: two numbers that diifer 1, then + 4
  381. # then two more differing 1 and 4, etc. (sure???)
  382. # VCO2 mixer EG attack, EG decay, EG rate, EG intensity, Filter and Resonance all
  383. # influence knob 32's value too.
  384. # For < 50% add 2.
  385.  
  386. knob_values_not_halfway $knob
  387. if [[ ${string01[@]} =~ $number ]]; then for element in ${string01[@]}; do
  388. if [[ $element       == $number ]]; then knob_values_halfway $knob; fi; done; fi
  389.  
  390. echo -e  "\
  391. a. Cutoff  \t\t $perc \t\t $val \t\t $dec"
  392.  
  393.  
  394. # 4b. FILTER RESONANCE
  395. knob=35
  396. number=`echo $(xyz 32)`
  397. string01=(32 33 34 37 39 49 51 53 97 98 99 109 114) # < 50%
  398. # VCO2 mixer EG attack, EG decay, EG rate, EG intensity, Filter and Resonance all
  399. # influence knob 32's value too (so 13 elements in string01?).
  400. # For > 50% add 4.
  401.  
  402. knob_values_halfway $knob
  403. if [[ ${string01[@]} =~ $number ]]; then for element in ${string01[@]}; do
  404. if [[ $element       == $number ]]; then knob_values_not_halfway $knob; fi; done; fi
  405.  
  406. echo -e  "\
  407. b. Resonance \t\t $perc \t\t $val \t\t $dec"
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415. ################## 5. ENVELOPE GENERATOR #########################################
  416. echo -e "\n\e[4m5. ENVELOPE GENERATOR\e[0m"
  417.  
  418. # 5a. EG TYPE
  419. switch=`echo $(xyz 47)`
  420. # string01=(2 6 10 14 18 26 30 34 38 46 50 54 62 66 82 86 90 102) # Attack/release
  421. # string02=(1 5 9  13 17 25 29 33 37 45 49 53 61 65 81 85 89 101) # Attack/sustain/release
  422. # string03=(0 4 8  12 16 24 28 32 36 44 48 52 60 64 80 84 88 100) # Gate & attack/decay
  423. # It might be so that the difference between two values in a string is 4.  What
  424. # about 22, 42, 58 and ... in string01?
  425. # String 1 to 3 differ 1 each time.
  426. if
  427.    [ $(( $switch % 4 )) -eq 2 ]
  428.    then
  429.    type="Attack/release /\ "           
  430. fi
  431. if
  432.    [ $(( $switch % 4 )) -eq 1 ]
  433.    then
  434.    type="Attack/sustain/release /¯¯\ "
  435. fi
  436. if
  437.    [ $(( $switch % 4 )) -eq 0 ]
  438.    then
  439.    type="Gate & attack/decay |¯/\¯¯| "  
  440. fi
  441. if
  442.    [ -z "$type" ]
  443.    then type="Error in EG Type"
  444. fi
  445.  
  446. echo -e  "\
  447. a. Type \t\t $type"
  448.  
  449.  
  450.  
  451. # 5b. EG ATTACK
  452. knob=36
  453. number=`echo $(xyz 32)`                 # Determines if knob 36 was turned > 50% or not.
  454. string01=(32 40 41 42 43 45 47 59 60 61 107 122 125 127) # > 50%
  455. # String02 is 8 lower than string01.
  456.  
  457. knob_values_not_halfway $knob
  458. if [[ ${string01[@]} =~ $number ]]; then for element in ${string01[@]}; do
  459. if [[ $element       == $number ]]; then knob_values_halfway $knob; fi; done; fi
  460.  
  461. echo -e  "\
  462. b. Attack \t\t $perc \t\t $val \t\t $dec"
  463.  
  464.  
  465. # 5c. EG DECAY
  466. knob=37
  467. number=`echo $(xyz 32)`
  468. string01=(27 48 49 50 51 52 53 55 58 59 61 115 116 125 127) # > 50%
  469. # String02 is 16 lower than string01.
  470.  
  471. knob_values_not_halfway $knob
  472. if [[ ${string01[@]} =~ $number ]]; then for element in ${string01[@]}; do
  473. if [[ $element       == $number ]]; then knob_values_halfway $knob; fi; done; fi
  474.  
  475. echo -e  "\
  476. c. Decay \t\t $perc \t\t $val \t\t $dec"
  477.  
  478.  
  479.  
  480.  
  481. # 5d. EG INTENSITY
  482. knob=38
  483. switch=`echo $(xyz 32)`  # No. 32 in the Record is the +/- switch.
  484.   string01=(32 34 36 37 39 42 45 50 52 53 59 61 98 99 104 109 114 120 122 124 125 126 127)  # INT is +
  485. # string02=(0  2  4  5  7  10 13 18 20 27 29 66 67 72  77  82  88  90  92  93  94  95 )     # INT is -
  486. # String01 and 02 differ 32.
  487. # If INT is + then string01 32 - 63 OR 96 - 127 ???
  488. # If INT is - then string02 00 - 31 OR 64 - 95  ????
  489. # The intensity is between 0 and 511 on the Korg's display!
  490. # If INT = negative then INT inverses to 100% to 0%!
  491. # Positive EG Int is between 64 and 127 in Midi.
  492. # Negative EG Int is between 64 and 0   in Midi.
  493.    knob_values_not_halfway $knob
  494.    EG_intensity="-$((100 - $perc*2)) \t\t -$((511 - $val )) \t\t $(( 64 - $dec))"
  495. if [[ $(xyz 32) -gt 31 && $(xyz 32) -lt 64 ]]  
  496.    then
  497.    EG_intensity="+$(($perc*2)) \t\t +$val \t\t $(( 64 + $dec ))"
  498.    elif [[ $(xyz 32) -gt 95 ]]
  499.    then
  500.    EG_intensity="+$(($perc*2)) \t\t +$val \t\t $(( 64 + $dec ))"
  501. fi
  502. # If $EG_intensity is null then error etc.
  503. echo -e "\
  504. d. Intensity \t\t $EG_intensity"
  505.  
  506.  
  507.  
  508. # 5e. EG TARGET
  509. switch01=`echo $(xyz 40)`
  510. switch02=`echo $(xyz 47)`
  511. if
  512.    [ $switch01 -gt 80 ]; then target="Pitch"  ; else if
  513.    [ $switch02 -gt 63 ]; then target="Pitch 2"; else
  514.                               target="Cutoff" ; fi
  515. fi
  516. echo -e  "\
  517. e. Target \t\t $target"
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525. ########################## 6. LFO ###############################################
  526. echo -e "\n\e[4m6. LFO\e[0m"
  527.  
  528. # 6a. LFO WAVE
  529. switch=`echo $(xyz 50)`             # Entry No. 50 in Record is LFO Wave form
  530. #string01=(2 6 10 18 22 26 34 38 42 66 70 74)       # Sawtooth
  531. #string02=(1 5 9  17 21 25 33 37 41 65 69 73)       # Triangular
  532. #string03=(0 4 8  16 20 24 32 36 40 64 68 72)       # Square
  533. # Differs 1 from string to string.
  534. # If No. 50 multiple of 4 mod 0 then square, mod 1 = tri, mod 2 = saw. See '5a. EG type' for algorhytm.
  535.  
  536. if
  537.    [ $(( $switch % 4 )) -eq 0 ]
  538.    then
  539.    lfo_wave="Square |¯|_| "           
  540. fi
  541. if
  542.    [ $(( $switch % 4 )) -eq 1 ]
  543.    then
  544.    lfo_wave="Triangular /\/\ "
  545. fi
  546. if
  547.    [ $(( $switch % 4 )) -eq 2 ]
  548.    then
  549.    lfo_wave="Sawtooth |\|\| "
  550. fi
  551. if
  552.    [ -z "$lfo_wave" ]
  553.    then lfo_wave="Error in LFO wave type"
  554. fi
  555.  
  556. echo -e  "\
  557. a. Wave \t\t $lfo_wave"
  558.  
  559.  
  560. # 6b. LFO MODE
  561. switch=`echo $(xyz 50)`                
  562. string01=(8 9 10 24 25 26 40 41 42 72 73 74)    # Fast
  563. string02=(4 5 6  20 21 22 36 37 38 68 69 70)    # Slow
  564. string03=(0 1 2  16 17 18 32 33 34 64 65 66)    # 1-Shot
  565. # Differs 4 from string to string.
  566. # If No. 50 is a multiple of 16 plus 0, 1 or 2 then one-shot.
  567. # In an "if then" condition "-o" means: "or".
  568.  
  569. if
  570.    [ $(($switch % 16)) -eq 0 -o $(($switch % 16)) -eq 1 -o $(($switch % 16)) -eq 2 ]
  571.    then
  572.    mode="One shot"
  573. fi
  574. if
  575.    [ $(($switch % 16)) -eq 4 -o $(($switch % 16)) -eq 5 -o $(($switch % 16)) -eq 6 ]
  576.    then
  577.    mode="Slow"
  578. fi
  579. if
  580.    [ $(($switch % 16)) -eq 8 -o $(($switch % 16)) -eq 9 -o $(($switch % 16)) -eq 10 ]
  581.    then
  582.    mode="Fast"
  583. fi
  584. if
  585.    [ -z "$mode" ]
  586.    then mode="Error in LFO mode type"
  587. fi
  588.  
  589. echo -e "\
  590. b. Mode \t\t $mode"
  591.  
  592.  
  593.  
  594. # 6c. LFO Rate
  595. knob=39
  596. number=`echo $(xyz 32)`
  597. if
  598.    [[ $number -gt 63 ]]  
  599.    then
  600.    knob_values_halfway $knob  
  601.    else
  602.       if
  603.          [[ $number  -lt 64 ]]
  604.          then
  605.          knob_values_not_halfway $knob
  606.          else
  607.          echo -e "\n\t Error in LFO Rate"
  608.       fi
  609. fi
  610. echo -e  "\
  611. c. Rate \t\t $perc \t\t $val \t\t $dec"
  612.  
  613.  
  614.  
  615. # 6d. LFO INT
  616. # The intensity is between 0 and 511 on the Korg's display!
  617. # Positive EG Int is between 64 and 127 in Midi.
  618. # Negative EG Int is between 0 and 64 in Midi.
  619. knob=41
  620. knob02=`echo $(xyz 40)`                                          # Determines if INT is + or -
  621. # string01=(17 19 21  25 27 29 31 53 61 81 83 85 87 89 93 95 113 117)  # INT is +
  622. # string02 is 1 lower?
  623. # If knob02 uneven then INT is +?
  624.  
  625.  
  626. knob_values_not_halfway $knob
  627. sign="-"
  628. midi="64 -"
  629. value01="100 -"
  630. value02="511 -"
  631.  
  632. if [ $(($(xyz 40)%2)) -eq 1  ]
  633.    then
  634.    knob_values_not_halfway $knob
  635.    sign="+"
  636.    midi="64 +"
  637.    value01=""
  638.    value02=""
  639. fi
  640.  
  641. echo -e  "d. Intensity \t\t $sign$(($value01 $perc*2)) \t\t $sign$(($value02 $val)) \t\t $(($midi $dec))"
  642.  
  643.  
  644.  
  645.  
  646. # 6e. LFO TARGET
  647. switch=`echo $(xyz 50)`                # Entry No. 50 in Record is "Target"
  648. string01=(32 33 34 36 37 38 40 41 42 98)  # Pitch
  649. string02=(16 17 18 20 21 22 24 25 26 82)  # Shape
  650. string03=(0  1  2  4  5  6  8  9  10 66)  # Cutoff
  651. # Differs 16 from string to string.
  652. # ? If switch is multiple of 64 plus a number between 0 and 15 then lfo_target = cutoff?
  653.  
  654. for i in {0..15}; do
  655.     if
  656.        [ $(($switch % 64 )) -eq $i ]
  657.        then
  658.        lfo_target="Cutoff"
  659.     fi
  660. done
  661. for i in {16..31}; do
  662.     if
  663.        [ $(($switch % 64 )) -eq $i ]
  664.        then
  665.        lfo_target="Shape"
  666.     fi
  667. done
  668. for i in {32..47}; do
  669.     if
  670.        [ $(($switch % 64 )) -eq $i ]
  671.        then
  672.        lfo_target="Pitch"
  673.     fi
  674. done
  675. if
  676.    [ -z "$lfo_target" ]
  677.    then lfo_target="Error in LFO target type"
  678. fi
  679.  
  680. echo -e  "\
  681. e. Target \t\t $lfo_target"
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688. echo "______________________________________________________________________"
Add Comment
Please, Sign In to add comment