Sampler in ChucK
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

111 Zeilen
5.4KB

  1. delayfeedback.csd
  2. Written by Iain McCurdy, 2006
  3. THE delay OPCODE IS PLACED IN A SEPARATE, ALWAYS ON, INSTRUMENT FROM THE SOURCE SOUND PRODUCING INSTRUMENT.
  4. THE IS A COMMONLY USED TECHNIQUE WITH TIME SMEARING OPCODES AND EFFECTS LIKE REVERBS AND DELAYS.
  5. ksmps MAY NEED TO BE LOW (AND kr THEREFORE HIGH) WHEN WORKING WITH SHORT DELAY TIMES DEFINED INITIALLY AT KRATE
  6. <CsoundSynthesizer>
  7. <CsOptions>
  8. -iadc -odac -dm0
  9. </CsOptions>
  10. <CsInstruments>
  11. sr = 44100 ;SAMPLE RATE
  12. ksmps = 4 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE (MAY NEED TO BE LOW WHEN WORKING WITH SHORT DELAY TIMES DEFINED INITIALLY AT KRATE)
  13. nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
  14. 0dbfs = 1 ;MAXIMUM AMPLITUDE
  15. ;FLTK INTERFACE CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. FLcolor 255, 255, 255, 0, 0, 0
  17. ; LABEL | WIDTH | HEIGHT | X | Y
  18. FLpanel "delay with feedback", 500, 300, 0, 0
  19. ; ON | OFF | TYPE | WIDTH | HEIGHT | X | Y | OPCODE | INS | STARTTIM | DUR
  20. gkOnOff,ihOnOff FLbutton "Input On/Off", 1, 0, 22, 180, 25, 5, 5, 0, 1, 0, -1
  21. FLsetColor2 255, 255, 50, ihOnOff ;SET SECONDARY COLOUR TO YELLOW
  22. ;GENERAL_TEXT_SETTINGS SIZE | FONT | ALIGN | RED | GREEN | BLUE
  23. FLlabel 13, 1, 3, 255, 255, 255 ;LABELS MADE INVISIBLE (I.E. SAME COLOR AS PANEL)
  24. ;BUTTON BANKS TYPE | NUMX | NUMY | WIDTH | HEIGHT | X | Y | OPCODE | INS | STARTTIM | DUR
  25. ;gkinput, ihinput FLbutBank 14, 1, 2, 18, 40, 250, 0, -1
  26. ;GENERAL_TEXT_SETTINGS SIZE | FONT | ALIGN | RED | GREEN | BLUE
  27. FLlabel 13, 1, 3, 0, 0, 0 ;LABELS MADE VISIBLE AGAIN
  28. ;VALUE_DISPLAY_BOXES WIDTH | HEIGHT | X | Y
  29. iddlt FLvalue " ", 80, 20, 5, 75
  30. idmix FLvalue " ", 80, 20, 5, 125
  31. idfeedbackamt FLvalue " ", 80, 20, 5, 175
  32. idamp FLvalue " ", 80, 20, 5, 225
  33. idporttime FLvalue " ", 80, 20, 5, 275
  34. ;SLIDERS MIN | MAX | EXP | TYPE | DISP | WIDTH | HEIGHT | X | Y
  35. gkdlt,ihdlt FLslider "Delay Time (sec)", .001, 5, -1, 23, iddlt, 490, 25, 5, 50
  36. gkmix,ihmix FLslider "Dry/Wet Mix", 0, 1, 0, 23, idmix, 490, 25, 5, 100
  37. gkfeedamt,ihfeedamt FLslider "Feedback Ratio", -1, 1, 0, 23, idfeedbackamt, 490, 25, 5, 150
  38. gkamp,ihamp FLslider "Output Amplitude Rescaling", 0, 1, 0, 23, idamp, 490, 25, 5, 200
  39. gkporttime,ihporttime FLslider "Portamento Time", 0, 2, 0, 23, idporttime, 490, 25, 5, 250
  40. gkingain,ihingain FLslider "Live Input Gain", 0, 1, 0, 23, -1, 140, 20, 350, 5
  41. ;SET_INITIAL_VALUES VALUE | HANDLE
  42. FLsetVal_i .5, ihdlt
  43. FLsetVal_i 0.5, ihmix
  44. FLsetVal_i 0.7, ihfeedamt
  45. FLsetVal_i .7, ihamp
  46. FLsetVal_i 0.3, ihporttime
  47. FLpanel_end ;END OF PANEL CONTENTS
  48. FLrun ;RUN THE FLTK WIDGET THREAD
  49. ;END OF FLTK INTERFACE CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  50. instr 1 ;PLAYS FILE
  51. if gkOnOff=0 then ;SENSE FLTK ON/OFF SWITCH
  52. turnoff ;TURN THIS INSTRUMENT OFF IMMEDIATELY
  53. endif
  54. asigL, asigR ins ;TAKE INPUT FROM COMPUTER'S AUDIO INPUT
  55. gasigL = asigL * gkingain ;SCALE USING 'Input Gain' SLIDER
  56. gasigR = asigR * gkingain ;SCALE USING 'Input Gain' SLIDER
  57. endin
  58. instr 2 ;DELAY INSTRUMENT
  59. kporttime linseg 0, .001, 1, 1, 1 ;USE OF AN ENVELOPE VALUE THAT QUICKLY RAMPS UP FROM ZERO TO 1. THIS PREVENTS VARIABLES GLIDING TO THEIR REQUIRED VALUES EACH TIME THE INSTRUMENT IS STARTED.
  60. kporttime = kporttime * gkporttime ;SCALE PORTAMENTO FUNCTION WITH FLTK SLIDER VALUE
  61. kdlt portk gkdlt, kporttime ;PORTAMENTO IS APPLIED TO THE VARIABLE 'gkdlt'. A NEW VARIABLE 'kdlt' IS CREATED.
  62. adlt interp kdlt ;A NEW A-RATE VARIABLE 'adlt' IS CREATED BY INTERPOLATING THE K-RATE VARIABLE 'kdlt'
  63. ;;;LEFT CHANNEL DELAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  64. abufferL delayr 5 ;CREATE A DELAY BUFFER OF 5 SECONDS DURATION (EQUIVALENT TO THE MAXIMUM DELAY TIME POSSIBLE USING THIS EXAMPLE)
  65. adelsigL deltap3 adlt ;TAP THE DELAY LINE AT gkdlt SECONDS
  66. delayw gasigL + (adelsigL * gkfeedamt) ;WRITE AUDIO SOURCE AND FEEDBACK SIGNAL INTO THE BEGINNING OF THE BUFFER
  67. ;;;RIGHT CHANNEL DELAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  68. abufferR delayr 5 ;CREATE A DELAY BUFFER OF 5 SECONDS DURATION (EQUIVALENT TO THE MAXIMUM DELAY TIME POSSIBLE USING THIS EXAMPLE)
  69. adelsigR deltap3 adlt ;TAP THE DELAY LINE AT gkdlt SECONDS
  70. delayw gasigR + (adelsigR * gkfeedamt) ;WRITE AUDIO SOURCE AND FEEDBACK SIGNAL INTO THE BEGINNING OF THE BUFFER
  71. aL ntrpol gasigL, adelsigL, gkmix
  72. aR ntrpol gasigR, adelsigR, gkmix
  73. outs aL * gkamp, aR * gkamp ;CREATE A MIX BETWEEN THE WET AND THE DRY SIGNALS AT THE OUTPUT
  74. clear gasigL, gasigR ;CLEAR THE GLOBAL AUDIO SEND VARIABLES
  75. endin
  76. </CsInstruments>
  77. <CsScore>
  78. ;INSTR | START | DURATION
  79. i 2 0 -1 ;INSTRUMENT 2 (DELAY INSTRUMENT) PLAYS A HELD NOTE
  80. f 0 3600 ;'DUMMY' SCORE EVENT KEEPS REALTIME PERFORMANCE GOING FOR 1 HOUR
  81. </CsScore>
  82. </CsoundSynthesizer>