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 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
пре 10 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. ; Delay parameters
  12. gkporttime init 0.3 ; Portamento time
  13. ;gkdlt init 5 ; Max delay
  14. ;gkmix init .5 ; Dry/wet
  15. ;gkfeedamt init .95 ; Feedback ratio
  16. ;gkamp init .7 ; Output amplitude rescaling
  17. ;gkingain init .5 ; Input gain
  18. ;gkOnOff init 1 ; Input on off
  19. ;FLTK GUI interface
  20. FLcolor 200, 200, 255, 0, 0, 0
  21. FLpanel "M I L C H L O D E", 500, 300, 0, 0, 0, 1
  22. gkOnOff,ihOnOff FLbutton "Input On/Off", 1, 0, 22, 180, 25, 5, 5, 0, 1, 0, -1
  23. ; Sliders
  24. gkdlt,ihdlt FLslider "Delay Time (sec)", .001, 5, 0, 23, -1, 490, 25, 5, 50
  25. gkmix,ihmix FLslider "Dry/Wet Mix", 0, 1, 0, 23, -1, 490, 25, 5, 100
  26. gkfeedamt,ihfeedamt FLslider "Feedback Ratio", 0, 1, 0, 23, -1, 490, 25, 5, 150
  27. gkamp,ihamp FLslider "Output Amplitude Rescaling", 0, 1, 0, 23, -1, 490, 25, 5, 200
  28. gkingain,ihingain FLslider "Input Gain", 0, 1, 0, 23, -1, 140, 20, 350, 5
  29. ih FLbox "Keys: ", 1, 5, 14, 490, 20, 0, 250
  30. ;Set defaults
  31. FLsetVal_i 1, ihOnOff
  32. FLsetVal_i .5, ihingain
  33. FLsetVal_i 4, ihdlt
  34. FLsetVal_i 0.5, ihmix
  35. FLsetVal_i 0.95, ihfeedamt
  36. FLsetVal_i .7, ihamp
  37. FLpanel_end ;End of GUI
  38. FLrun ;Run the FLTK thread
  39. ; Instr 1 is the source
  40. instr 1
  41. ; Turn off with the switch
  42. if gkOnOff=0 then
  43. turnoff
  44. endif
  45. ; Get input from mic/line
  46. asigL, asigR ins
  47. gasigL = asigL * gkingain
  48. gasigR = asigR * gkingain
  49. endin
  50. ; Instr 2 is the delay line
  51. instr 2
  52. kporttime linseg 0, .001, 1, 1, 1 ; A short envelope
  53. kporttime = kporttime * gkporttime ; TODO: remove this
  54. kdlt portk gkdlt, kporttime ; Apply portamento
  55. adlt interp kdlt ; Interpolate
  56. ;Left channel
  57. abufferL delayr 5 ;Buffer
  58. adelsigL deltap3 adlt ;Tap
  59. delayw gasigL + (adelsigL * gkfeedamt) ;Feedback
  60. ;Right channel
  61. abufferR delayr 5 ;Buffer
  62. adelsigR deltap3 adlt ;Tap
  63. delayw gasigR + (adelsigR * gkfeedamt) ;Feedback
  64. aL ntrpol gasigL, adelsigL, gkmix
  65. aR ntrpol gasigR, adelsigR, gkmix
  66. outs aL * gkamp, aR * gkamp ; Mix wet/dry
  67. clear gasigL, gasigR ; Clear global audio sends
  68. endin
  69. </CsInstruments>
  70. <CsScore>
  71. i 2 0 -1 ;Instrument 2 plays a held note
  72. f 0 3600 ;Keep performance going
  73. </CsScore>
  74. </CsoundSynthesizer>