Sampler in ChucK
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.7KB

  1. <CsoundSynthesizer>
  2. <CsOptions> -iadc -odac -dm0 </CsOptions>
  3. <CsInstruments>
  4. ; CSound parameters
  5. sr = 44100 ; Sample rate
  6. ksmps = 20 ; Number of audio samples in each control cycle
  7. nchnls = 2 ; Number of channels (2=stereo)
  8. 0dbfs = 1 ; Maximum amplitude
  9. ; Delay parameters
  10. gkporttime = 0.3 ; Portamento time
  11. gkdlt = 5 ; Max delay
  12. gkmix = .5 ; Dry/wet
  13. gkfeedamt = .95 ; Feedback ratio
  14. gkamp = .7 ; Output amplitude rescaling
  15. gkingain = .5 ; Input gain
  16. ; Instr 1 is the source
  17. instr 1
  18. ; Turn off with the switch
  19. if gkOnOff=0 then
  20. turnoff
  21. endif
  22. ; Get input from mic/line
  23. asigL, asigR ins
  24. gasigL = asigL * gkingain
  25. gasigR = asigR * gkingain
  26. endin
  27. ; Instr 2 is the delay line
  28. instr 2
  29. ; Sense keyboard
  30. kKey FLkeyIn
  31. kChanged changed kKey
  32. printk2 kKey
  33. ;if kKey=112&&kChanged=1 then
  34. ;printf_i "awd"
  35. ;FLsetVal_i 0.0, gkfeedamt
  36. ;endif
  37. kporttime linseg 0, .001, 1, 1, 1 ; A short envelope
  38. kporttime = kporttime * gkporttime ; TODO: remove this
  39. kdlt portk gkdlt, kporttime ; Apply portamento
  40. adlt interp kdlt ; Interpolate
  41. ;Left channel
  42. abufferL delayr 5 ;Buffer
  43. adelsigL deltap3 adlt ;Tap
  44. delayw gasigL + (adelsigL * gkfeedamt) ;Feedback
  45. ;Right channel
  46. abufferR delayr 5 ;Buffer
  47. adelsigR deltap3 adlt ;Tap
  48. delayw gasigR + (adelsigR * gkfeedamt) ;Feedback
  49. aL ntrpol gasigL, adelsigL, gkmix
  50. aR ntrpol gasigR, adelsigR, gkmix
  51. outs aL * gkamp, aR * gkamp ;Mix wet/dry
  52. clear gasigL, gasigR ;Clear global audio sends
  53. endin
  54. </CsInstruments>
  55. <CsScore>
  56. i 2 0 -1 ;Instrument 2 plays a held note
  57. f 0 3600 ;Keep performance going
  58. </CsScore>
  59. </CsoundSynthesizer>