Guest User

Untitled

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