~ubuntu-branches/ubuntu/vivid/python-pyo/vivid-proposed

« back to all changes in this revision

Viewing changes to pyolib/analysis.py

  • Committer: Package Import Robot
  • Author(s): Tiago Bortoletto Vaz
  • Date: 2013-05-28 14:27:12 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20130528142712-5ycu7udwjc4udkud
Tags: 0.6.6+svn1108-1
New upstream commits adding 6 new filters and a couple of bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    Envelope follower.
36
36
    
37
37
    Output signal is the continuous mean amplitude of an input signal.
38
 
 
39
 
    Parentclass: PyoObject
40
 
   
41
 
    Parameters:
42
 
    
43
 
    input : PyoObject
44
 
        Input signal to process.
45
 
    freq : float or PyoObject, optional
46
 
        Cutoff frequency of the filter in hertz. Default to 20.
47
 
 
48
 
    Methods:
49
 
 
50
 
    setInput(x, fadetime) : Replace the `input` attribute.
51
 
    setFreq(x) : Replace the `freq` attribute.
52
 
 
53
 
    Attributes:
54
 
 
55
 
    input : PyoObject. Input signal to process.
56
 
    freq : float or PyoObject. Cutoff frequency of the filter.
57
 
 
58
 
    Notes:
59
 
 
60
 
    The out() method is bypassed. Follower's signal can not be sent to 
61
 
    audio outs.
62
 
    
63
 
    Examples:
 
38
 
 
39
    :Parent: :py:class:`PyoObject`
 
40
 
 
41
    :Args:
 
42
    
 
43
        input : PyoObject
 
44
            Input signal to process.
 
45
        freq : float or PyoObject, optional
 
46
            Cutoff frequency of the filter in hertz. Default to 20.
 
47
 
 
48
    .. note::
 
49
 
 
50
        The out() method is bypassed. Follower's signal can not be sent to 
 
51
        audio outs.
64
52
    
65
53
    >>> s = Server().boot()
66
54
    >>> s.start()
81
69
        """
82
70
        Replace the `input` attribute.
83
71
        
84
 
        Parameters:
 
72
        :Args:
85
73
 
86
 
        x : PyoObject
87
 
            New signal to process.
88
 
        fadetime : float, optional
89
 
            Crossfade time between old and new input. Default to 0.05.
 
74
            x : PyoObject
 
75
                New signal to process.
 
76
            fadetime : float, optional
 
77
                Crossfade time between old and new input. Default to 0.05.
90
78
 
91
79
        """
92
80
        self._input = x
96
84
        """
97
85
        Replace the `freq` attribute.
98
86
        
99
 
        Parameters:
 
87
        :Args:
100
88
 
101
 
        x : float or PyoObject
102
 
            New `freq` attribute.
 
89
            x : float or PyoObject
 
90
                New `freq` attribute.
103
91
 
104
92
        """
105
93
        self._freq = x
115
103
      
116
104
    @property
117
105
    def input(self):
118
 
        """PyoObject. Input signal to process.""" 
 
106
        """PyoObject. Input signal to process."""
119
107
        return self._input
120
108
    @input.setter
121
109
    def input(self, x): self.setInput(x)
122
110
 
123
111
    @property
124
112
    def freq(self):
125
 
        """float or PyoObject. Cutoff frequency of the filter.""" 
 
113
        """float or PyoObject. Cutoff frequency of the filter."""
126
114
        return self._freq
127
115
    @freq.setter
128
116
    def freq(self, x): self.setFreq(x)
133
121
 
134
122
    Output signal is the continuous mean amplitude of an input signal.
135
123
 
136
 
    Parentclass: PyoObject
137
 
 
138
 
    Parameters:
139
 
 
140
 
    input : PyoObject
141
 
        Input signal to process.
142
 
    risetime : float or PyoObject, optional
143
 
        Time to reach upward value in seconds. Default to 0.01.
144
 
    falltime : float or PyoObject, optional
145
 
        Time to reach downward value in seconds. Default to 0.1.
146
 
 
147
 
    Methods:
148
 
 
149
 
    setInput(x, fadetime) : Replace the `input` attribute.
150
 
    setRisetime(x) : Replace the `risetime` attribute.
151
 
    setFalltime(x) : Replace the `falltime` attribute.
152
 
 
153
 
    Attributes:
154
 
 
155
 
    input : PyoObject. Input signal to process.
156
 
    risetime : float or PyoObject. Time to reach upward value in seconds.
157
 
    falltime : float or PyoObject. Time to reach downward value in seconds.
158
 
 
159
 
    Notes:
160
 
 
161
 
    The out() method is bypassed. Follower's signal can not be sent to 
162
 
    audio outs.
163
 
 
164
 
    Examples:
 
124
    :Parent: :py:class:`PyoObject`
 
125
 
 
126
    :Args:
 
127
 
 
128
        input : PyoObject
 
129
            Input signal to process.
 
130
        risetime : float or PyoObject, optional
 
131
            Time to reach upward value in seconds. Default to 0.01.
 
132
        falltime : float or PyoObject, optional
 
133
            Time to reach downward value in seconds. Default to 0.1.
 
134
 
 
135
    .. note::
 
136
 
 
137
        The out() method is bypassed. Follower's signal can not be sent to 
 
138
        audio outs.
165
139
 
166
140
    >>> s = Server().boot()
167
141
    >>> s.start()
183
157
        """
184
158
        Replace the `input` attribute.
185
159
 
186
 
        Parameters:
 
160
        :Args:
187
161
 
188
 
        x : PyoObject
189
 
            New signal to process.
190
 
        fadetime : float, optional
191
 
            Crossfade time between old and new input. Default to 0.05.
 
162
            x : PyoObject
 
163
                New signal to process.
 
164
            fadetime : float, optional
 
165
                Crossfade time between old and new input. Default to 0.05.
192
166
 
193
167
        """
194
168
        self._input = x
198
172
        """
199
173
        Replace the `risetime` attribute.
200
174
 
201
 
        Parameters:
 
175
        :Args:
202
176
 
203
 
        x : float or PyoObject
204
 
            New `risetime` attribute.
 
177
            x : float or PyoObject
 
178
                New `risetime` attribute.
205
179
 
206
180
        """
207
181
        self._risetime = x
212
186
        """
213
187
        Replace the `falltime` attribute.
214
188
 
215
 
        Parameters:
 
189
        :Args:
216
190
 
217
 
        x : float or PyoObject
218
 
            New `falltime` attribute.
 
191
            x : float or PyoObject
 
192
                New `falltime` attribute.
219
193
 
220
194
        """
221
195
        self._falltime = x
257
231
    Output signal is the number of zero-crossing occured during each 
258
232
    buffer size, normalized between 0 and 1.
259
233
 
260
 
    Parentclass: PyoObject
 
234
    :Parent: :py:class:`PyoObject`
261
235
   
262
 
    Parameters:
263
 
    
264
 
    input : PyoObject
265
 
        Input signal to process.
266
 
    thresh : float, optional
267
 
        Minimum amplitude difference allowed between adjacent samples 
268
 
        to be included in the zeros count.
269
 
         
270
 
 
271
 
    Methods:
272
 
 
273
 
    setInput(x, fadetime) : Replace the `input` attribute.
274
 
    setThresh(x) : Replace the `thresh` attribute.
275
 
 
276
 
    Attributes:
277
 
 
278
 
    input : PyoObject. Input signal to process.
279
 
    thresh : float. Amplitude difference threshold.
280
 
 
281
 
    Notes:
282
 
 
283
 
    The out() method is bypassed. ZCross's signal can not be sent to 
284
 
    audio outs.
285
 
    
286
 
    Examples:
 
236
    :Args:
 
237
    
 
238
        input : PyoObject
 
239
            Input signal to process.
 
240
        thresh : float, optional
 
241
            Minimum amplitude difference allowed between adjacent samples 
 
242
            to be included in the zeros count.
 
243
 
 
244
    .. note::
 
245
 
 
246
        The out() method is bypassed. ZCross's signal can not be sent to 
 
247
        audio outs.
287
248
    
288
249
    >>> s = Server(duplex=1).boot()
289
250
    >>> s.start()
304
265
        """
305
266
        Replace the `input` attribute.
306
267
        
307
 
        Parameters:
 
268
        :Args:
308
269
 
309
 
        x : PyoObject
310
 
            New signal to process.
311
 
        fadetime : float, optional
312
 
            Crossfade time between old and new input. Default to 0.05.
 
270
            x : PyoObject
 
271
                New signal to process.
 
272
            fadetime : float, optional
 
273
                Crossfade time between old and new input. Default to 0.05.
313
274
 
314
275
        """
315
276
        self._input = x
319
280
        """
320
281
        Replace the `thresh` attribute.
321
282
        
322
 
        Parameters:
 
283
        :Args:
323
284
 
324
 
        x : float
325
 
            New amplitude difference threshold.
 
285
            x : float
 
286
                New amplitude difference threshold.
326
287
 
327
288
        """
328
289
        self._thresh = x
358
319
    
359
320
    The audio output of the object is the estimated frequency, in Hz, of the input sound.
360
321
 
361
 
    Parentclass: PyoObject
 
322
    :Parent: :py:class:`PyoObject`
362
323
   
363
 
    Parameters:
364
 
    
365
 
    input : PyoObject
366
 
        Input signal to process.
367
 
    tolerance : float, optional
368
 
        Parameter for minima selection, between 0 and 1. Defaults to 0.2.
369
 
    minfreq : float, optional
370
 
        Minimum estimated frequency in Hz. Frequency below this threshold will 
371
 
        be ignored. Defaults to 40.
372
 
    maxfreq : float, optional
373
 
        Maximum estimated frequency in Hz. Frequency above this threshold will 
374
 
        be ignored. Defaults to 1000.
375
 
    cutoff : float, optional
376
 
        Cutoff frequency, in Hz, of the lowpass filter applied on the input sound. 
377
 
        This helps the detector to detect the fundamental frequency by filtering
378
 
        higher harmonics. Defaults to 1000.
379
 
    winsize : int, optional
380
 
        Size, in samples, of the analysis window. Must be higher that two period
381
 
        of the lowest desired frequency. Available at initialization time only.
382
 
        Defaults to 1024.
383
 
 
384
 
    Methods:
385
 
 
386
 
    setInput(x, fadetime) : Replace the `input` attribute.
387
 
    setTolerance(x) : Replace the `tolerance` attribute.
388
 
    setMinfreq(x) : Replace the `minfreq` attribute.
389
 
    setMaxfreq(x) : Replace the `maxfreq` attribute.
390
 
    setCutoff(x) : Replace the `cutoff` attribute.
391
 
 
392
 
    Attributes:
393
 
 
394
 
    input : PyoObject. Input signal to process.
395
 
    tolerance : float. Parameter for minima selection, between 0 and 1.
396
 
    minfreq : float. Minimum estimated frequency in Hz.
397
 
    maxfreq : float. Maximum estimated frequency in Hz.
398
 
    cutoff : float. Cutoff frequency of the lowpass filter.
399
 
    
400
 
    Examples:
401
 
    
 
324
    :Args:
 
325
    
 
326
        input : PyoObject
 
327
            Input signal to process.
 
328
        tolerance : float, optional
 
329
            Parameter for minima selection, between 0 and 1. Defaults to 0.2.
 
330
        minfreq : float, optional
 
331
            Minimum estimated frequency in Hz. Frequency below this threshold will 
 
332
            be ignored. Defaults to 40.
 
333
        maxfreq : float, optional
 
334
            Maximum estimated frequency in Hz. Frequency above this threshold will 
 
335
            be ignored. Defaults to 1000.
 
336
        cutoff : float, optional
 
337
            Cutoff frequency, in Hz, of the lowpass filter applied on the input sound.
 
338
            Defaults to 1000.
 
339
            
 
340
            The lowpass filter helps the algorithm to detect the fundamental frequency by filtering
 
341
            higher harmonics. 
 
342
        winsize : int, optional
 
343
            Size, in samples, of the analysis window. Must be higher that two period
 
344
            of the lowest desired frequency.
 
345
            
 
346
            Available at initialization time only.  Defaults to 1024.
 
347
            
 
348
 
402
349
    >>> s = Server(duplex=1).boot()
403
350
    >>> s.start()
404
351
    >>> lfo = Randh(min=100, max=500, freq=3)
424
371
        """
425
372
        Replace the `input` attribute.
426
373
        
427
 
        Parameters:
 
374
        :Args:
428
375
 
429
 
        x : PyoObject
430
 
            New signal to process.
431
 
        fadetime : float, optional
432
 
            Crossfade time between old and new input. Default to 0.05.
 
376
            x : PyoObject
 
377
                New signal to process.
 
378
            fadetime : float, optional
 
379
                Crossfade time between old and new input. Default to 0.05.
433
380
 
434
381
        """
435
382
        self._input = x
439
386
        """
440
387
        Replace the `tolerance` attribute.
441
388
        
442
 
        Parameters:
 
389
        :Args:
443
390
 
444
 
        x : float
445
 
            New parameter for minima selection, between 0 and 1.
 
391
            x : float
 
392
                New parameter for minima selection, between 0 and 1.
446
393
 
447
394
        """
448
395
        self._tolerance = x
453
400
        """
454
401
        Replace the `minfreq` attribute.
455
402
        
456
 
        Parameters:
 
403
        :Args:
457
404
 
458
 
        x : float
459
 
            New minimum frequency detected.
 
405
            x : float
 
406
                New minimum frequency detected.
460
407
 
461
408
        """
462
409
        self._minfreq = x
467
414
        """
468
415
        Replace the `maxfreq` attribute.
469
416
        
470
 
        Parameters:
 
417
        :Args:
471
418
 
472
 
        x : float
473
 
            New maximum frequency detected.
 
419
            x : float
 
420
                New maximum frequency detected.
474
421
 
475
422
        """
476
423
        self._maxfreq = x
481
428
        """
482
429
        Replace the `cutoff` attribute.
483
430
        
484
 
        Parameters: 
 
431
        :Args: 
485
432
 
486
 
        x : float
487
 
            New input lowpass filter cutoff frequency.
 
433
            x : float
 
434
                New input lowpass filter cutoff frequency.
488
435
 
489
436
        """
490
437
        self._cutoff = x
528
475
        return self._cutoff
529
476
    @cutoff.setter
530
477
    def cutoff(self, x): self.setCutoff(x)
531