~ubuntu-branches/ubuntu/trusty/python-pyo/trusty

« back to all changes in this revision

Viewing changes to pyolib/arithmetic.py

  • Committer: Package Import Robot
  • Author(s): Tiago Bortoletto Vaz
  • Date: 2013-01-30 00:41:56 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130130004156-t2iv3q5zsh8oe66a
Tags: 0.6.3+svn1068-1
* New upstream release.
* Start tracking upstream svn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    """
58
58
 
59
59
    def __init__(self, input, mul=1, add=0):
60
 
        PyoObject.__init__(self)
 
60
        PyoObject.__init__(self, mul, add)
61
61
        self._input = input
62
 
        self._mul = mul
63
 
        self._add = add
64
62
        self._in_fader = InputFader(input)
65
63
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
66
64
        self._base_objs = [M_Sin_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
67
65
 
68
 
    def __dir__(self):
69
 
        return ['input', 'mul', 'add']
70
 
 
71
66
    def setInput(self, x, fadetime=0.05):
72
67
        """
73
68
        Replace the `input` attribute.
83
78
        self._input = x
84
79
        self._in_fader.setInput(x, fadetime)
85
80
 
86
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
87
 
        self._map_list = []
88
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
89
 
      
90
81
    @property
91
82
    def input(self):
92
83
        """PyoObject. Input signal to filter.""" 
125
116
 
126
117
    """
127
118
    def __init__(self, input, mul=1, add=0):
128
 
        PyoObject.__init__(self)
 
119
        PyoObject.__init__(self, mul, add)
129
120
        self._input = input
130
 
        self._mul = mul
131
 
        self._add = add
132
121
        self._in_fader = InputFader(input)
133
122
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
134
123
        self._base_objs = [M_Cos_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
135
124
 
136
 
    def __dir__(self):
137
 
        return ['input', 'mul', 'add']
138
 
 
139
125
    def setInput(self, x, fadetime=0.05):
140
126
        """
141
127
        Replace the `input` attribute.
151
137
        self._input = x
152
138
        self._in_fader.setInput(x, fadetime)
153
139
 
154
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
155
 
        self._map_list = []
156
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
157
 
 
158
140
    @property
159
141
    def input(self):
160
142
        """PyoObject. Input signal to filter.""" 
200
182
 
201
183
    """
202
184
    def __init__(self, input, mul=1, add=0):
203
 
        PyoObject.__init__(self)
 
185
        PyoObject.__init__(self, mul, add)
204
186
        self._input = input
205
 
        self._mul = mul
206
 
        self._add = add
207
187
        self._in_fader = InputFader(input)
208
188
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
209
189
        self._base_objs = [M_Tan_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
210
190
 
211
 
    def __dir__(self):
212
 
        return ['input', 'mul', 'add']
213
 
 
214
191
    def setInput(self, x, fadetime=0.05):
215
192
        """
216
193
        Replace the `input` attribute.
226
203
        self._input = x
227
204
        self._in_fader.setInput(x, fadetime)
228
205
 
229
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
230
 
        self._map_list = []
231
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
232
 
 
233
206
    @property
234
207
    def input(self):
235
208
        """PyoObject. Input signal to filter.""" 
270
243
    """
271
244
 
272
245
    def __init__(self, input, mul=1, add=0):
273
 
        PyoObject.__init__(self)
 
246
        PyoObject.__init__(self, mul, add)
274
247
        self._input = input
275
 
        self._mul = mul
276
 
        self._add = add
277
248
        self._in_fader = InputFader(input)
278
249
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
279
250
        self._base_objs = [M_Abs_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
280
251
 
281
 
    def __dir__(self):
282
 
        return ['input', 'mul', 'add']
283
 
 
284
252
    def setInput(self, x, fadetime=0.05):
285
253
        """
286
254
        Replace the `input` attribute.
296
264
        self._input = x
297
265
        self._in_fader.setInput(x, fadetime)
298
266
 
299
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
300
 
        self._map_list = []
301
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
302
 
 
303
267
    @property
304
268
    def input(self):
305
269
        """PyoObject. Input signal to process.""" 
345
309
    """
346
310
 
347
311
    def __init__(self, input, mul=1, add=0):
348
 
        PyoObject.__init__(self)
 
312
        PyoObject.__init__(self, mul, add)
349
313
        self._input = input
350
 
        self._mul = mul
351
 
        self._add = add
352
314
        self._in_fader = InputFader(input)
353
315
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
354
316
        self._base_objs = [M_Sqrt_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
355
317
 
356
 
    def __dir__(self):
357
 
        return ['input', 'mul', 'add']
358
 
 
359
318
    def setInput(self, x, fadetime=0.05):
360
319
        """
361
320
        Replace the `input` attribute.
371
330
        self._input = x
372
331
        self._in_fader.setInput(x, fadetime)
373
332
 
374
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
375
 
        self._map_list = []
376
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
377
 
 
378
333
    @property
379
334
    def input(self):
380
335
        """PyoObject. Input signal to process.""" 
416
371
    """
417
372
 
418
373
    def __init__(self, input, mul=1, add=0):
419
 
        PyoObject.__init__(self)
 
374
        PyoObject.__init__(self, mul, add)
420
375
        self._input = input
421
 
        self._mul = mul
422
 
        self._add = add
423
376
        self._in_fader = InputFader(input)
424
377
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
425
378
        self._base_objs = [M_Log_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
426
379
 
427
 
    def __dir__(self):
428
 
        return ['input', 'mul', 'add']
429
 
 
430
380
    def setInput(self, x, fadetime=0.05):
431
381
        """
432
382
        Replace the `input` attribute.
442
392
        self._input = x
443
393
        self._in_fader.setInput(x, fadetime)
444
394
 
445
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
446
 
        self._map_list = []
447
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
448
 
 
449
395
    @property
450
396
    def input(self):
451
397
        """PyoObject. Input signal to process.""" 
487
433
    """
488
434
 
489
435
    def __init__(self, input, mul=1, add=0):
490
 
        PyoObject.__init__(self)
 
436
        PyoObject.__init__(self, mul, add)
491
437
        self._input = input
492
 
        self._mul = mul
493
 
        self._add = add
494
438
        self._in_fader = InputFader(input)
495
439
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
496
440
        self._base_objs = [M_Log2_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
497
441
 
498
 
    def __dir__(self):
499
 
        return ['input', 'mul', 'add']
500
 
 
501
442
    def setInput(self, x, fadetime=0.05):
502
443
        """
503
444
        Replace the `input` attribute.
513
454
        self._input = x
514
455
        self._in_fader.setInput(x, fadetime)
515
456
 
516
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
517
 
        self._map_list = []
518
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
519
 
 
520
457
    @property
521
458
    def input(self):
522
459
        """PyoObject. Input signal to process.""" 
558
495
    """
559
496
 
560
497
    def __init__(self, input, mul=1, add=0):
561
 
        PyoObject.__init__(self)
 
498
        PyoObject.__init__(self, mul, add)
562
499
        self._input = input
563
 
        self._mul = mul
564
 
        self._add = add
565
500
        self._in_fader = InputFader(input)
566
501
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
567
502
        self._base_objs = [M_Log10_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
568
503
 
569
 
    def __dir__(self):
570
 
        return ['input', 'mul', 'add']
571
 
 
572
504
    def setInput(self, x, fadetime=0.05):
573
505
        """
574
506
        Replace the `input` attribute.
584
516
        self._input = x
585
517
        self._in_fader.setInput(x, fadetime)
586
518
 
587
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
588
 
        self._map_list = []
589
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
590
 
 
591
519
    @property
592
520
    def input(self):
593
521
        """PyoObject. Input signal to process.""" 
595
523
    @input.setter
596
524
    def input(self, x): self.setInput(x)
597
525
 
598
 
class Pow(PyoObject):
599
 
    """
600
 
    Performs a power function on audio signal.
601
 
 
602
 
    Parentclass: PyoObject
603
 
 
604
 
    Parameters:
605
 
 
606
 
    base : float or PyoObject, optional
607
 
        Base composant. Defaults to 10.
608
 
    exponent : float or PyoObject, optional
609
 
        Exponent composant. Defaults to 1.
610
 
 
611
 
    Methods:
612
 
 
613
 
    setBase(x) : Replace the `base` attribute.
614
 
    setExponent(x) : Replace the `exponent` attribute.
615
 
 
616
 
    Attributes:
617
 
 
618
 
    base : float or PyoObject, Base composant.
619
 
    exponent : float or PyoObject, Exponent composant.
620
 
 
621
 
    Examples:
622
 
 
623
 
    >>> s = Server().boot()
624
 
    >>> s.start()
625
 
    >>> # Exponential amplitude envelope
626
 
    >>> a = LFO(freq=1, type=3, mul=0.5, add=0.5)
627
 
    >>> b = Pow(Clip(a, 0, 1), 4, mul=.3)
628
 
    >>> c = SineLoop(freq=[300,301], feedback=0.05, mul=b).out()
629
 
 
630
 
    """
631
 
    def __init__(self, base=10, exponent=1, mul=1, add=0):
632
 
        PyoObject.__init__(self)
633
 
        self._base = base
634
 
        self._exponent = exponent
635
 
        self._mul = mul
636
 
        self._add = add
637
 
        base, exponent, mul, add, lmax = convertArgsToLists(base, exponent, mul, add)
638
 
        self._base_objs = [M_Pow_base(wrap(base,i), wrap(exponent,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
639
 
 
640
 
    def __dir__(self):
641
 
        return ['base', 'exponent', 'mul', 'add']
642
 
 
643
 
    def setBase(self, x):
644
 
        """
645
 
        Replace the `base` attribute.
646
 
 
647
 
        Parameters:
648
 
 
649
 
        x : float or PyoObject
650
 
            new `base` attribute.
651
 
 
652
 
        """
653
 
        self._base = x
654
 
        x, lmax = convertArgsToLists(x)
655
 
        [obj.setBase(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
656
 
 
657
 
    def setExponent(self, x):
658
 
        """
659
 
        Replace the `exponent` attribute.
660
 
 
661
 
        Parameters:
662
 
 
663
 
        x : float or PyoObject
664
 
            new `exponent` attribute.
665
 
 
666
 
        """
667
 
        self._exponent = x
668
 
        x, lmax = convertArgsToLists(x)
669
 
        [obj.setExponent(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
670
 
 
671
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
672
 
        self._map_list = []
673
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
674
 
 
675
 
    @property
676
 
    def base(self):
677
 
        """float or PyoObject. Base composant.""" 
678
 
        return self._base
679
 
    @base.setter
680
 
    def base(self, x): self.setBase(x)
681
 
 
682
 
    @property
683
 
    def exponent(self):
684
 
        """float or PyoObject. Exponent composant.""" 
685
 
        return self._exponent
686
 
    @exponent.setter
687
 
    def exponent(self, x): self.setExponent(x)
688
 
 
689
526
class Atan2(PyoObject):
690
527
    """
691
528
    Computes the principal value of the arc tangent of b/a.
725
562
 
726
563
    """
727
564
    def __init__(self, b=1, a=1, mul=1, add=0):
728
 
        PyoObject.__init__(self)
 
565
        PyoObject.__init__(self, mul, add)
729
566
        self._b = b
730
567
        self._a = a
731
 
        self._mul = mul
732
 
        self._add = add
733
568
        b, a, mul, add, lmax = convertArgsToLists(b, a, mul, add)
734
569
        self._base_objs = [M_Atan2_base(wrap(b,i), wrap(a,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
735
570
 
736
 
    def __dir__(self):
737
 
        return ['b', 'a', 'mul', 'add']
738
 
 
739
571
    def setB(self, x):
740
572
        """
741
573
        Replace the `b` attribute.
764
596
        x, lmax = convertArgsToLists(x)
765
597
        [obj.setA(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
766
598
 
767
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
768
 
        self._map_list = []
769
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
770
 
 
771
599
    @property
772
600
    def b(self):
773
601
        """float or PyoObject. Numerator.""" 
816
644
    """
817
645
 
818
646
    def __init__(self, input, mul=1, add=0):
819
 
        PyoObject.__init__(self)
 
647
        PyoObject.__init__(self, mul, add)
820
648
        self._input = input
821
 
        self._mul = mul
822
 
        self._add = add
823
649
        self._in_fader = InputFader(input)
824
650
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
825
651
        self._base_objs = [M_Floor_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
826
652
 
827
 
    def __dir__(self):
828
 
        return ['input', 'mul', 'add']
829
 
 
830
653
    def setInput(self, x, fadetime=0.05):
831
654
        """
832
655
        Replace the `input` attribute.
842
665
        self._input = x
843
666
        self._in_fader.setInput(x, fadetime)
844
667
 
845
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
846
 
        self._map_list = []
847
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
848
 
 
849
668
    @property
850
669
    def input(self):
851
670
        """PyoObject. Input signal to process.""" 
887
706
    """
888
707
 
889
708
    def __init__(self, input, mul=1, add=0):
890
 
        PyoObject.__init__(self)
 
709
        PyoObject.__init__(self, mul, add)
891
710
        self._input = input
892
 
        self._mul = mul
893
 
        self._add = add
894
711
        self._in_fader = InputFader(input)
895
712
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
896
713
        self._base_objs = [M_Ceil_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
897
714
 
898
 
    def __dir__(self):
899
 
        return ['input', 'mul', 'add']
900
 
 
901
715
    def setInput(self, x, fadetime=0.05):
902
716
        """
903
717
        Replace the `input` attribute.
913
727
        self._input = x
914
728
        self._in_fader.setInput(x, fadetime)
915
729
 
916
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
917
 
        self._map_list = []
918
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
919
 
 
920
730
    @property
921
731
    def input(self):
922
732
        """PyoObject. Input signal to process.""" 
958
768
    """
959
769
 
960
770
    def __init__(self, input, mul=1, add=0):
961
 
        PyoObject.__init__(self)
 
771
        PyoObject.__init__(self, mul, add)
962
772
        self._input = input
963
 
        self._mul = mul
964
 
        self._add = add
965
773
        self._in_fader = InputFader(input)
966
774
        in_fader, mul, add, lmax = convertArgsToLists(self._in_fader, mul, add)
967
775
        self._base_objs = [M_Round_base(wrap(in_fader,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
968
776
 
969
 
    def __dir__(self):
970
 
        return ['input', 'mul', 'add']
971
 
 
972
777
    def setInput(self, x, fadetime=0.05):
973
778
        """
974
779
        Replace the `input` attribute.
984
789
        self._input = x
985
790
        self._in_fader.setInput(x, fadetime)
986
791
 
987
 
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
988
 
        self._map_list = []
989
 
        PyoObject.ctrl(self, map_list, title, wxnoserver)
990
 
 
991
792
    @property
992
793
    def input(self):
993
794
        """PyoObject. Input signal to process."""