home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 February / MAC_easy_02_2010.iso / Software / Multimedia / audacity-macosx-ub-1.3.11.dmg / plug-ins / highpass.ny < prev    next >
Encoding:
Audacity Nyquits plug-in  |  2010-01-16  |  2.7 KB  |  96 lines

  1. ;nyquist plug-in
  2. ;version 3
  3. ;type process
  4. ;categories "http://lv2plug.in/ns/lv2core#HighpassPlugin"
  5. ;name "High Pass Filter..."
  6. ;action "Performing High Pass Filter..."
  7. ;info "by Dominic Mazzoni, modified by David R. Sky\nReleased under terms of the GNU General Public License Version 2\nAttenuates frequencies below your specified cutoff frequency.\nHigher rolloff values give a sharper attenuation of frequencies below\nthe cutoff frequency. If using a rolloff of 12 dB, a [q] value greater than\ndefault 0.7 increases resonance ['ringing'] of the cutoff frequency and\ncould result in clipping."
  8.  
  9. ;control rolloff-choice "     Rolloff [dB per octave]" choice "  6 dB,12 dB,24 dB,36 dB,48 dB" 0
  10. ;control q "     Filter quality [q] for 12 dB rolloff" real "" 0.7071 .1 20
  11. ;control f "     Cutoff frequency [Hz]" real "" 1000 1 20000
  12.  
  13. ; note that all Nyquist highpass functions 
  14. ; [hp, highpass2, highpass4, highpass6, highpass8]
  15. ; are defined below with -s suffix.
  16. ; This enables highpass functions other than hp 
  17. ; to deal with stereo selection,
  18. ; and dummy q arg for all but highpass2 
  19.  
  20. ; 6dB/octave
  21. (defun hp-s (s f q) ; dummy q arg
  22. (hp s f))
  23.  
  24. ; 12dB/octave
  25. (defun highpass2-s (s f q)
  26. (if (arrayp s)
  27. (vector (highpass2 (aref s 0) f q)
  28. (highpass2 (aref s 1) f q))
  29. (highpass2 s f q)))
  30.  
  31. ; 24dB/octave
  32. (defun highpass4-s (s f q) ; dummy q arg
  33. (if (arrayp s)
  34. (vector (highpass4 (aref s 0) f)
  35. (highpass4 (aref s 1) f))
  36. (highpass4 s f)))
  37.  
  38. ; 36dB/octave
  39. (defun highpass6-s (s f q) ; dummy q arg
  40. (if (arrayp s)
  41. (vector (highpass6 (aref s 0) f)
  42. (highpass6 (aref s 1) f))
  43. (highpass6 s f)))
  44.  
  45. ; 48dB/octave
  46. (defun highpass8-s (s f q) ; dummy q arg
  47. (if (arrayp s)
  48. (vector (highpass8 (aref s 0) f)
  49. (highpass8 (aref s 1) f))
  50. (highpass8 s f)))
  51.  
  52. ; check function: returns 1 on error
  53. (defun check (arg min max)
  54. (if (and (>= arg min) (<= arg max))
  55. 0 1))
  56.  
  57.  
  58. ; initialize blank error-msg
  59. (setf error-msg "")
  60.  
  61. ; check for erroneous q value
  62. (setf error-msg (if 
  63. (and (= rolloff-choice 1)
  64. (= (check q 0.1 20) 1))
  65. (strcat error-msg (format nil
  66. "q value ~a lies outside valid range 0.1 to 20     
  67. for your chosen rolloff of 12 dB per octave.
  68. " q))
  69. error-msg))
  70.  
  71. ; check for erroneous frequency cutoff value
  72. (setf error-msg (if 
  73. (= (check f 1 20000) 0)
  74. error-msg
  75. (strcat error-msg (format nil
  76. "Cutoff frequency ~a Hz lies outside valid range 1 to 20000.     
  77. " f))))
  78.  
  79.  
  80. (cond
  81. ((> (length error-msg) 0)
  82. (setf error-msg (strcat (format nil
  83. "Error - \n\nYou have entered at least one invalid value:
  84. ") error-msg))
  85. (format nil "~a" error-msg)) 
  86. ;
  87. (t ; perform highpass effect
  88. (funcall (nth rolloff-choice '(hp-s highpass2-s highpass4-s highpass6-s highpass8-s)) 
  89. s f q)))
  90.  
  91.  
  92.  
  93. ; from previous commit
  94. ; arch-tag: 49302eba-9945-43d7-aade-f1c7eded27af
  95.  
  96.