~ubuntu-branches/ubuntu/saucy/faust/saucy

« back to all changes in this revision

Viewing changes to architecture/maxmsp.lib

  • Committer: Package Import Robot
  • Author(s): Mario Lang
  • Date: 2012-04-04 13:52:01 UTC
  • mfrom: (1.1.6) (3.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120404135201-hpsrk87x3hga94tc
Tags: 0.9.46-2
* Fix "ftbfs with GCC-4.7":
  - debian/patches/unistd: Include <unistd.h> where necessary.
    (Closes: #667163)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************
 
2
 ************************************************************************
 
3
        FAUST library file
 
4
        Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
 
5
    ---------------------------------------------------------------------
 
6
    This program is free software; you can redistribute it and/or modify
 
7
    it under the terms of the GNU Lesser General Public License as 
 
8
        published by the Free Software Foundation; either version 2.1 of the 
 
9
        License, or (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU Lesser General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU Lesser General Public
 
17
        License along with the GNU C Library; if not, write to the Free
 
18
        Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
19
        02111-1307 USA. 
 
20
 ************************************************************************
 
21
 ************************************************************************/
 
22
 
 
23
declare name "MaxMSP compatibility Library";
 
24
declare author "GRAME";
 
25
declare copyright "GRAME";
 
26
declare version "1.0";
 
27
declare license "LGPL"; 
 
28
 
1
29
import("music.lib");
2
30
 
3
31
 
33
61
                HPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) 
34
62
                                with {
35
63
                                    b0 =  (1 + cos(w0))/2;
36
 
                                    b1 = -(1 + cos(w0));
 
64
                                    b1 = -1 - cos(w0);
37
65
                                    b2 =  (1 + cos(w0))/2;
38
66
                                    a0 =   1 + alpha;
39
67
                                    a1 =  -2*cos(w0);
173
201
highShelf(x, f0, gain, Q)       = x , filtercoeff(f0,gain,Q).highShelf : biquad;
174
202
 
175
203
 
 
204
 
 
205
 
 
206
//-------------------------------------------------------------------------
 
207
// Implementation of Max/MSP line~. Generate signal ramp or envelope 
 
208
// 
 
209
// USAGE : line(value, time)
 
210
//      value : the desired output value
 
211
//      time  : the interpolation time to reach this value (in milliseconds)
 
212
//
 
213
// NOTE : the interpolation process is restarted every time the desired
 
214
// output value changes. The interpolation time is sampled only then.
 
215
//-------------------------------------------------------------------------
 
216
 
 
217
line (value, time) = state ~ ( _ , _ ) : ! , _ 
 
218
        with {
 
219
                state (t , c) = nt , if( nt <= 0 , value , c + (value - c) / nt)
 
220
                with {
 
221
                        nt = if( value != value' , samples, t - 1) ;
 
222
                        samples = time * SR / 1000.0 ;
 
223
                } ;
 
224
        } ;
 
225
 
 
226