Sampler in ChucK
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

59 行
1.4KB

  1. <CsoundSynthesizer>
  2. <CsOptions>
  3. -o dac
  4. </CsOptions>
  5. <CsInstruments>
  6. sr = 48000
  7. ksmps = 32
  8. nchnls = 2
  9. 0dbfs = 1
  10. ; localhost means communication on the same machine, otherwise you need
  11. ; an IP adress
  12. #define IPADDRESS # "localhost" #
  13. #define S_PORT # 47120 #
  14. #define R_PORT # 47120 #
  15. turnon 1000 ; starts instrument 1000 immediately
  16. turnon 1001 ; starts instrument 1001 immediately
  17. instr 1000 ; this instrument sends OSC-values
  18. kValue1 randomh 0, 0.8, 4
  19. kNum randomh 0, 8, 8
  20. kMidiKey tab (int(kNum)), 2
  21. kOctave randomh 0, 7, 4
  22. kValue2 = cpsmidinn (kMidiKey*kOctave+33)
  23. kValue3 randomh 0.4, 1, 4
  24. ;Stext sprintf "%i", $S_PORT
  25. OSCsend kValue1+kValue2, $IPADDRESS, $S_PORT, "/QuteCsound",
  26. "fff", kValue1, kValue2, kValue3
  27. endin
  28. instr 1001 ; this instrument receives OSC-values
  29. kValue1Received init 0.0
  30. kValue2Received init 0.0
  31. kValue3Received init 0.0
  32. ;Stext sprintf "%i", $R_PORT
  33. ihandle OSCinit $R_PORT
  34. kAction OSClisten ihandle, "/QuteCsound", "fff",
  35. kValue1Received, kValue2Received, kValue3Received
  36. if (kAction == 1) then
  37. ;printk2 kValue2Received
  38. ;printk2 kValue1Received
  39. endif
  40. aSine poscil3 kValue1Received, kValue2Received, 1
  41. outs aSine, aSine
  42. endin
  43. </CsInstruments>
  44. <CsScore>
  45. f 1 0 1024 10 1
  46. f 2 0 8 -2 0 2 4 7 9 11 0 2
  47. e 3600
  48. </CsScore>
  49. </CsoundSynthesizer>
  50. ; example by Alex Hofmann (Mar. 2011)