How to use pyo - 10 common examples

To help you get started, we’ve selected a few pyo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github belangeo / pyo / pyodemos / BandSplit_demo.py View on Github external
def ex3():
    from pyo import Disto, SfPlayer, Clean_objects, DEMOS_PATH
    print """
Multiband distortion:

o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True, mul=.5)
o_ex2 = BandSplit(o_ex1, num=4, min=250, max=5000, q=2)
o_ex3 = Disto(o_ex2, drive=[0.98, 0, 0, 0.99], mul=.06125).out()
"""
    o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True, mul=.5)
    o_ex2 = BandSplit(o_ex1, num=4, min=250, max=5000, q=2)
    o_ex3 = Disto(o_ex2, drive=[0.98, 0, 0, 0.99], mul=.06125).out()

    c = Clean_objects(4, o_ex1, o_ex2, o_ex3)
    c.start()
github psychopy / psychopy / psychopy / sound / backend_pyo.py View on Github external
"""
    global pyoSndServer, Sound, audioDriver, duplex, maxChnls
    Sound = SoundPyo
    global pyo
    try:
        assert pyo
    except NameError:  # pragma: no cover
        import pyo
        # can be needed for microphone.switchOn(), which calls init even
        # if audioLib is something else

    # subclass the pyo.Server so that we can insert a __del__ function that
    # shuts it down skip coverage since the class is never used if we have
    # a recent version of pyo

    class _Server(pyo.Server):  # pragma: no cover
        # make libs class variables so they don't get deleted first
        core = core
        logging = logging

        def __del__(self):
            self.stop()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            self.shutdown()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            # this may never get printed
            self.logging.debug('pyo sound server shutdown')
    if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
        Server = _Server
    else:
github belangeo / soundgrain / Resources / ControlPanel.py View on Github external
self.startSlider = ControlSlider(self, 0, snd_dur, 0, outFunction=self.handleStart)
        vbox.Add(self.startSlider, 0, wx.ALL, 5)

        stline = wx.StaticText(self, -1, 'Ending point in seconds:')
        vbox.Add(stline, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.TOP, 10)
        self.endSlider = ControlSlider(self, 0, snd_dur, snd_dur, outFunction=self.handleEnd)
        vbox.Add(self.endSlider, 0, wx.ALL, 5)

        stline = wx.StaticText(self, -1, 'Insertion point in seconds:')
        vbox.Add(stline, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.TOP, 10)
        self.insertSlider = ControlSlider(self, 0, actual_dur, 0)
        vbox.Add(self.insertSlider, 0, wx.ALL, 5)

        stline = wx.StaticText(self, -1, 'Crossfade time in seconds:')
        vbox.Add(stline, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.TOP, 10)
        self.crossfadeSlider = ControlSlider(self, 0.001, snd_dur*0.5, 0, outFunction=self.handleCross)
        vbox.Add(self.crossfadeSlider, 0, wx.ALL, 5)

        sizer =  self.CreateButtonSizer(wx.CANCEL|wx.OK)
        vbox.Add(sizer, 0, wx.ALL, 10)
        self.SetSizerAndFit(vbox)
github belangeo / soundgrain / Resources / FxBall.py View on Github external
self.box.AddSpacer(2)
        self.slider2 = ControlSlider(self.panel, sl2values[1], sl2values[2], sl2values[3], log=sl2values[4], size=(250,16), outFunction=self.handleSlider2)
        self.box.Add(self.slider2, 0, wx.LEFT|wx.RIGHT, 10)

        text = wx.StaticText(self.panel, -1, "Amplitude")
        text.SetFont(font)
        self.box.Add(text, 0, wx.LEFT|wx.RIGHT|wx.TOP, 10)
        self.box.AddSpacer(2)
        self.slider3 = ControlSlider(self.panel, 0, 2, 1, size=(250,16), outFunction=self.handleMul)
        self.box.Add(self.slider3, 0, wx.LEFT|wx.RIGHT, 10)

        text = wx.StaticText(self.panel, -1, "Pan")
        text.SetFont(font)
        self.box.Add(text, 0, wx.LEFT|wx.RIGHT|wx.TOP, 10)
        self.box.AddSpacer(2)
        self.slider4 = ControlSlider(self.panel, 0, 1, 0.5, size=(250,16), outFunction=self.handlePan)
        self.box.Add(self.slider4, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 10)

        self.panel.SetSizerAndFit(self.box)

        if PLATFORM == "win32":
            X, Y = self.GetSize()[0], self.GetSize()[1] + 50
        elif PLATFORM.startswith("linux"):
            X, Y = self.GetSize()[0], self.GetSize()[1] + 40
        else:
            X, Y = self.GetSize()[0], self.GetSize()[1] + 20
        self.SetMinSize((X, Y))
        self.SetMaxSize((X, Y))
        wx.CallAfter(self.SetSize, (X, Y))
github belangeo / soundgrain / Resources / MidiSettings.py View on Github external
box.Add(wx.StaticLine(self.panel, size=(240, 1)), 0, wx.ALL, 5)

        box.Add(wx.StaticText(self.panel, id=-1, label="Pitch Mapping"), 0, wx.LEFT|wx.TOP|wx.RIGHT, 5)

        self.xTranspo = wx.CheckBox(self.panel, label="Transposition")
        self.xTranspo.SetValue(True)
        self.xTranspo.Bind(wx.EVT_CHECKBOX, self.handleTranspo)
        box.Add(self.xTranspo, 0, wx.ALL, 5)

        self.xPosition = wx.CheckBox(self.panel, label="X Axis Position")
        self.xPosition.Bind(wx.EVT_CHECKBOX, self.handlePosition)
        box.Add(self.xPosition, 0, wx.ALL, 5)

        box.Add(wx.StaticText(self.panel, id=-1, label="X Pos Octave Spread"), 0, wx.LEFT|wx.TOP|wx.RIGHT, 5)
        self.octaveSpread = ControlSlider(self.panel, 1, 4, 2, size=(250, 16), outFunction=self.handleSpread)
        self.enableOctaveSpread(self.xPosition.GetValue())
        box.Add(self.octaveSpread, 0, wx.ALL|wx.EXPAND, 3)

        box.Add(wx.StaticLine(self.panel, size=(240, 1)), 0, wx.ALL, 5)

        self.panel.SetSizerAndFit(box)

        size = self.GetBestSize()
        size = (size[0], size[1]+30)
        self.SetMinSize(size)
        self.SetMaxSize(size)
        self.SetPosition((self.parent.GetPosition()[0] + self.parent.GetSize()[0], self.parent.GetPosition()[1]))
        self.Show(False)
        wx.CallAfter(self.SetSize, size)
github alexandrepoirier / PyoSynth / Pyo Synth 0.1.0b / resources / __future__ / tools.py View on Github external
def reinit(self, signal, rate=1/25.):
        self._tablerec.stop()
        self._sig = signal
        self._chnls = len(signal)
        self._calcChnlHeight()
        self._table = NewTable(rate, self._chnls)
        self._tablerec = TableRec(self._sig*self._vzoom, self._table)
        self._trigDraw = TrigFunc(self._tablerec['trig'], self._processBuffer)
        self._drawBackground()
        self.start()
github alexandrepoirier / PyoSynth / Pyo Synth 0.1.0b / resources / __future__ / tools.py View on Github external
def reinit(self, signal, rate=1/25.):
        self._tablerec.stop()
        self._sig = signal
        self._chnls = len(signal)
        self._calcChnlHeight()
        self._table = NewTable(rate, self._chnls)
        self._tablerec = TableRec(self._sig*self._vzoom, self._table)
        self._trigDraw = TrigFunc(self._tablerec['trig'], self._processBuffer)
        self._drawBackground()
        self.start()
github alexandrepoirier / PyoSynth / Pyo Synth 0.1.0b / resources / __future__ / tools.py View on Github external
def reinit(self, signal, rate=1/25.):
        self._tablerec.stop()
        self._sig = signal
        self._chnls = len(signal)
        self._calcChnlHeight()
        self._table = NewTable(rate, self._chnls)
        self._tablerec = TableRec(self._sig*self._vzoom, self._table)
        self._trigDraw = TrigFunc(self._tablerec['trig'], self._processBuffer)
        self._drawBackground()
        self.start()
github psychopy / psychopy / psychopy / sound.py View on Github external
class _Server(pyo.Server):  # pragma: no cover
        # make libs class variables so they don't get deleted first
        core = core
        logging = logging

        def __del__(self):
            self.stop()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            self.shutdown()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            # this may never get printed
            self.logging.debug('pyo sound server shutdown')
    if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
        Server = _Server
    else:
        Server = pyo.Server

    # if we already have a server, just re-initialize it
    if 'pyoSndServer' in globals() and hasattr(pyoSndServer, 'shutdown'):
        pyoSndServer.stop()
        # make sure enough time passes for the server to shutdown
        core.wait(0.5)
        pyoSndServer.shutdown()
        core.wait(0.5)
        pyoSndServer.reinit(sr=rate, nchnls=maxChnls,
                            buffersize=buffer, audio=audioDriver)
        pyoSndServer.boot()
    else:
        if platform == 'win32':
github psychopy / psychopy / psychopy / sound / backend_pyo.py View on Github external
class _Server(pyo.Server):  # pragma: no cover
        # make libs class variables so they don't get deleted first
        core = core
        logging = logging

        def __del__(self):
            self.stop()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            self.shutdown()
            # make sure enough time passes for the server to shutdown
            self.core.wait(0.5)
            # this may never get printed
            self.logging.debug('pyo sound server shutdown')
    if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
        Server = _Server
    else:
        Server = pyo.Server

    # if we already have a server, just re-initialize it
    if 'pyoSndServer' in globals() and hasattr(pyoSndServer, 'shutdown'):
        pyoSndServer.stop()
        # make sure enough time passes for the server to shutdown
        core.wait(0.5)
        pyoSndServer.shutdown()
        core.wait(0.5)
        pyoSndServer.reinit(sr=rate, nchnls=maxChnls,
                            buffersize=buffer, audio=audioDriver)
        pyoSndServer.boot()
    else:
        if sys.platform == 'win32':