Sampler in ChucK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 年之前
10 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <CsoundSynthesizer>
  2. <CsOptions>
  3. -iadc -odac -dm0
  4. </CsOptions>
  5. <CsInstruments>
  6. ; CSound parameters
  7. sr = 44100 ; Sample rate
  8. ksmps = 20 ; Number of audio samples in each control cycle
  9. nchnls = 2 ; Number of channels (2=stereo)
  10. 0dbfs = 1 ; Maximum amplitude
  11. ; FLTK GUI interface
  12. FLcolor 200, 200, 255, 0, 0, 0
  13. FLpanel "M I L C H L O D E", 500, 300, 0, 0, 0, 1
  14. gkOnOff,ihOnOff FLbutton "Input On/Off", 1, 0, 22, 180, 25, 5, 5, 0, 1, 0, -1
  15. ; Sliders
  16. gkdlt,ihdlt FLslider "Delay Time (sec)", .001, 5, 0, 23, -1, 490, 25, 5, 50
  17. gkmix,ihmix FLslider "Dry/Wet Mix", 0, 1, 0, 23, -1, 490, 25, 5, 100
  18. gkfeedamt,ihfeedamt FLslider "Feedback Ratio", 0, 1, 0, 23, -1, 490, 25, 5, 150
  19. gkamp,ihamp FLslider "Output Amplitude Rescaling", 0, 1, 0, 23, -1, 490, 25, 5, 200
  20. gkingain,ihingain FLslider "Input Gain", 0, 1, 0, 23, -1, 140, 20, 350, 5
  21. ih FLbox "Keys: ", 1, 5, 14, 490, 20, 0, 250
  22. ; Set defaults
  23. FLsetVal_i 1, ihOnOff
  24. FLsetVal_i .5, ihingain
  25. FLsetVal_i 4, ihdlt
  26. FLsetVal_i 0.5, ihmix
  27. FLsetVal_i 0.95, ihfeedamt
  28. FLsetVal_i .7, ihamp
  29. FLpanel_end ;End of GUI
  30. FLrun ;Run the FLTK thread
  31. ; Instr 1 is the source
  32. instr 1
  33. ; Turn off with the switch
  34. if gkOnOff=0 then
  35. turnoff
  36. endif
  37. ; Get input from mic/line
  38. asigL, asigR ins
  39. gasigL = asigL * gkingain
  40. gasigR = asigR * gkingain
  41. endin
  42. ; Instr 2 is the delay line
  43. instr 2
  44. adlt = gkdlt
  45. ;Left channel
  46. abufferL delayr 5 ;Buffer
  47. adelsigL deltap3 adlt ;Tap
  48. delayw gasigL + (adelsigL * gkfeedamt) ;Feedback
  49. ;Right channel
  50. abufferR delayr 5 ;Buffer
  51. adelsigR deltap3 adlt ;Tap
  52. delayw gasigR + (adelsigR * gkfeedamt) ;Feedback
  53. aL ntrpol gasigL, adelsigL, gkmix
  54. aR ntrpol gasigR, adelsigR, gkmix
  55. outs aL * gkamp, aR * gkamp ; Mix wet/dry
  56. clear gasigL, gasigR ; Clear global audio sends
  57. endin
  58. </CsInstruments>
  59. <CsScore>
  60. i 2 0 -1 ;Instrument 2 plays a held note
  61. f 0 3600 ;Keep performance going
  62. </CsScore>
  63. </CsoundSynthesizer>