Sampler in ChucK
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. main.csd
  2. Pete Shadbolt.2014
  3. Based on code by Iain McCurdy, 2006
  4. ksmps MAY NEED TO BE LOW (AND kr THEREFORE HIGH) WHEN WORKING WITH SHORT DELAY TIMES DEFINED INITIALLY AT KRATE
  5. TODO: implement octave down/up (like old delay pedal), key control, panic button
  6. <CsoundSynthesizer>
  7. <CsOptions>
  8. -iadc -odac -dm0
  9. </CsOptions>
  10. <CsInstruments>
  11. sr = 44100 ;Sample rate
  12. ksmps = 20 ;Number of audio samples in each control cycle
  13. nchnls = 2 ;Number of channels (2=stereo)
  14. 0dbfs = 1 ;Maximum amplitude
  15. gkporttime = 0.3; portamento time
  16. ;FLTK GUI interface
  17. FLcolor 200, 200, 255, 0, 0, 0
  18. FLpanel "M I L C H L O D E", 500, 300, 0, 0, 0, 1
  19. gkOnOff,ihOnOff FLbutton "Input On/Off", 1, 0, 22, 180, 25, 5, 5, 0, 1, 0, -1
  20. ; Sliders
  21. gkdlt,ihdlt FLslider "Delay Time (sec)", .001, 5, 0, 23, -1, 490, 25, 5, 50
  22. gkmix,ihmix FLslider "Dry/Wet Mix", 0, 1, 0, 23, -1, 490, 25, 5, 100
  23. gkfeedamt,ihfeedamt FLslider "Feedback Ratio", -1, 1, 0, 23, -1, 490, 25, 5, 150
  24. gkamp,ihamp FLslider "Output Amplitude Rescaling", 0, 1, 0, 23, -1, 490, 25, 5, 200
  25. gkingain,ihingain FLslider "Input Gain", 0, 1, 0, 23, -1, 140, 20, 350, 5
  26. ih FLbox "Keys: ", 1, 5, 14, 490, 20, 0, 250
  27. ;Set defaults
  28. FLsetVal_i 1, ihOnOff
  29. FLsetVal_i .5, ihingain
  30. FLsetVal_i 4, ihdlt
  31. FLsetVal_i 0.5, ihmix
  32. FLsetVal_i 0.95, ihfeedamt
  33. FLsetVal_i .7, ihamp
  34. FLpanel_end ;End of GUI
  35. FLrun ;Run the FLTK thread
  36. ; Instr 1 is the source
  37. instr 1
  38. ; Turn off with the switch
  39. if gkOnOff=0 then
  40. turnoff
  41. endif
  42. ; Get input from mic/line
  43. asigL, asigR ins
  44. gasigL = asigL * gkingain
  45. gasigR = asigR * gkingain
  46. endin
  47. ; Instr 2 is the delay line
  48. instr 2
  49. ; Sense keyboard
  50. kKey FLkeyIn
  51. kChanged changed kKey
  52. printk2 kKey
  53. ;if kKey=112&&kChanged=1 then
  54. ;printf_i "awd"
  55. ;FLsetVal_i 0.0, gkfeedamt
  56. ;endif
  57. kporttime linseg 0, .001, 1, 1, 1 ;A short envelope
  58. kporttime = kporttime * gkporttime ;TODO: remove this
  59. kdlt portk gkdlt, kporttime ;Apply portamento
  60. adlt interp kdlt ;Interpolate
  61. ;Left channel
  62. abufferL delayr 5 ;Buffer
  63. adelsigL deltap3 adlt ;Tap
  64. delayw gasigL + (adelsigL * gkfeedamt) ;Feedback
  65. ;Right channel
  66. abufferR delayr 5 ;Buffer
  67. adelsigR deltap3 adlt ;Tap
  68. delayw gasigR + (adelsigR * gkfeedamt) ;Feedback
  69. aL ntrpol gasigL, adelsigL, gkmix
  70. aR ntrpol gasigR, adelsigR, gkmix
  71. outs aL * gkamp, aR * gkamp ;Mix wet/dry
  72. clear gasigL, gasigR ;Clear global audio sends
  73. endin
  74. </CsInstruments>
  75. <CsScore>
  76. i 2 0 -1 ;Instrument 2 plays a held note
  77. f 0 3600 ;Keep performance going
  78. </CsScore>
  79. </CsoundSynthesizer>