Advertisement
nyapoleon_legionary

Soundlib TOkyu 8500

Jun 4th, 2023
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. function onUpdate(su)
  2. {
  3. sound_compressor(su);
  4. var speed = su.getSpeed();
  5. var notch = su.getNotch();
  6. if (notch != 0 && speed > 0.01)
  7. {
  8. if (speed >= 12.5 && speed < 20)
  9. {
  10. var pitch0 = 0.009 * speed+0.5;
  11. var vol5 = 0.05 * speed;
  12. su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
  13. }
  14. else if (speed >= 20 && speed < 60)
  15. {
  16. var pitch0 = 0.009 * speed+0.5;
  17. var vol5 = 0.025 * speed+0.5;
  18. su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
  19. }
  20. else if (speed >= 60 && speed < 80)
  21. {
  22. var pitch0 = 0.009 * speed+0.5;
  23. var vol5 = -0.1 * speed+8.0;
  24. su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
  25. }
  26. else
  27. {
  28. su.stopSound('sound_tokyu8500', 'train.tq00');
  29. }
  30. }
  31. else
  32. {
  33. su.stopSound('sound_tokyu8500', 'train.tq00');
  34. }
  35. if (notch != 0 && speed > 0.01)
  36. {
  37. if (speed >= 0.01 && speed < 12.5)
  38. {
  39. var pitch0 = 0.064 * speed+0.4;
  40. var vol5 = 0.025 * speed;
  41. su.playSound('sound_tokyu8500', 'train.tq02', vol5, pitch0);
  42. }
  43. else
  44. {
  45. su.stopSound('sound_tokyu8500', 'train.tq02');
  46. }
  47. }
  48. else
  49. {
  50. su.stopSound('sound_tokyu8500', 'train.tq02');
  51. }
  52. if (notch == 0 && speed > 0.01)
  53. {
  54. if (speed >= 12.5 && speed < 20)
  55. {
  56. var pitch0 = 0.009 * speed+0.5;
  57. var vol5 = 0.05 * speed;
  58. su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
  59. }
  60. else if (speed >= 20 && speed < 60)
  61. {
  62. var pitch0 = 0.009 * speed+0.5;
  63. var vol5 = 0.025 * speed+0.5;
  64. su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
  65. }
  66. else if (speed >= 60 && speed < 80)
  67. {
  68. var pitch0 = 0.009 * speed+0.5;
  69. var vol5 = -0.1 * speed+8.0;
  70. su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
  71. }
  72. else
  73. {
  74. su.stopSound('sound_tokyu8500', 'train.tq03');
  75. }
  76. }
  77. else
  78. {
  79. su.stopSound('sound_tokyu8500', 'train.tq03');
  80. }
  81. if (speed > 0.01)
  82. {
  83. if (speed >= 60 && speed < 80)
  84. {
  85. var pitch0 = 0.009 * speed+0.5;
  86. var vol5 = 0.05 * speed-3.0;
  87. su.playSound('sound_tokyu8500', 'train.tq01', vol5, pitch0);
  88. }
  89. else if (speed >= 80 && speed < 120)
  90. {
  91. var pitch0 = 0.009 * speed+0.5;
  92. var vol5 = 0.025 * speed-1.0;
  93. su.playSound('sound_tokyu8500', 'train.tq01', vol5, pitch0);
  94. }
  95. else
  96. {
  97. su.stopSound('sound_tokyu8500', 'train.tq01');
  98. }
  99. }
  100. else
  101. {
  102. su.stopSound('sound_tokyu8500', 'train.tq01');
  103. }
  104. if(notch >= 1 && speed > 0.01)
  105. {
  106.  
  107. if (speed >= 0.01 && speed < 2)
  108. {
  109. var pitch0 = 0.06 * speed+0.5;
  110. var vol3 = 0.25 * speed;
  111. su.playSound('sound_tokyu8500', 'train.tq04', vol3, pitch0);
  112. }
  113. else if (speed >= 2 && speed < 20)
  114. {
  115. var pitch0 = 0.06 * speed+0.5;
  116. var vol3 = 0.005 * speed+0.49;
  117. su.playSound('sound_tokyu8500', 'train.tq04', vol3, pitch0);
  118. }
  119. else
  120. {
  121. su.stopSound('sound_tokyu8500', 'train.tq04');
  122. }
  123.  
  124. if (speed >= 20 && speed < 25)
  125. {
  126. var pitch0 = 0.06 * speed-0.2;
  127. var vol3 = 0.001 * speed+0.57;
  128. su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
  129. }
  130. else if (speed >= 25 && speed < 30)
  131. {
  132. var pitch0 = 0.04 * speed+0.3;
  133. var vol3 = 0.001 * speed+0.57;
  134. su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
  135. }
  136. else if (speed >= 30 && speed < 40)
  137. {
  138. var pitch0 = 0.01 * speed+1.2;
  139. var vol3 = -0.06 * speed+2.4;
  140. su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
  141. }
  142. else
  143. {
  144. su.stopSound('sound_tokyu8500', 'train.tq05');
  145. }
  146. }
  147. else
  148. {
  149. su.stopSound('sound_tokyu8500', 'train.tq04');
  150. su.stopSound('sound_tokyu8500', 'train.tq05');
  151. }
  152. }
  153. function sound_compressor(su)
  154. {
  155. var count = su.getData("count");
  156. if (su.isComplessorActive() )
  157. {
  158. if (count < 200)
  159. {
  160. su.playSound('sound_tokyu8500', 'train.tq8500cp00', 1, 1, false);
  161. su.stopSound('sound_tokyu8500', 'train.tq8500cp02');
  162. count++;
  163. }
  164. else
  165. {
  166. su.playSound('sound_tokyu8500', 'train.tq8500cp01', 1, 1);
  167. }
  168. }
  169. else
  170. {
  171. su.stopSound('sound_tokyu8500', 'train.tq8500cp00');
  172. su.stopSound('sound_tokyu8500', 'train.tq8500cp01');
  173. su.playSound('sound_tokyu8500', 'train.tq8500cp02', 1, 1, false);
  174. }
  175. su.setData("count", count);
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement