コード例 #1
0
def main():
    '''Driver code'''

    app = S3App()
    app.load_file(input('Enter filename: '))
    app.load_trainedsynth()
    s = Server()
    s.setMidiInputDevice(99)  # Open all input devices.
    s.boot()

    def play_midi(filename: str):
        mid = MidiFile(filename)

        # ... and reading its content.
        for message in mid.play():
            # For each message, we convert it to integer data with the bytes()
            # method and send the values to pyo's Server with the addMidiEvent()
            # method. This method programmatically adds a MIDI message to the
            # server's internal MIDI event buffer.
            s.addMidiEvent(*message.bytes())

    Synthesiser = S3Synth(app.reg.coef_)
    a = Synthesiser.out()
    s.gui(locals())
        self._metro.play()
        self._table_rec.play()
        self._trig_dump.play()
        return self
        
    def stop(self):
        self._metro.stop()
        self._table_rec.stop()
        self._trig_dump.stop()
        
    def print_data(self, num, step=1):
        self.cpt = 0
        self.num = num
        print "\n>>>class AccDataAnalyser"
        if step > 1:
            print "[[X list], [Y list], [Z list]] Data for %d buffers in steps of %d." % (num, step)
            self.percent = Percent(self._table_rec['trig'], percent=100./step)
            self.trig_print = TrigFunc(self.percent, self._print_data)
        else:
            print "[[X list], [Y list], [Z list]] Data for %d buffer(s)." % num
            self.trig_print = TrigFunc(self._table_rec['trig'], self._print_data)
        
        
if __name__ == "__main__":
    from pyo import Server
    s = Server(sr=SAMP_RATE, buffersize=BUFFER_SIZE).boot()
    
    acc = AccDataAnalyser(12000, "/accxyz").play()
    #acc.print_data(4,10)
    s.gui(locals())
コード例 #3
0
ファイル: aqueous.py プロジェクト: tildebyte/pyo_work
# Run this script to test the Aqueous class.
if __name__ == "__main__":
    from pyo import Delay, Metro, Server, Snap, TrigXnoiseMidi, WGVerb, Pattern

    s = Server(duplex=0).boot()
    s.setAmp(1.0)
    s.start()
    t = 3.776
    metroAqueous = Metro(time=t * 2).play()
    noteAqeous = TrigXnoiseMidi(metroAqueous, dist=0, mrange=(42, 83))
    snapAqueous = Snap(noteAqeous, choice=[0, 2, 4, 5, 7, 9, 11], scale=1)
    a = Aqueous(snapAqueous, dur=t * 0.75, mul=0.9)

    def noteOn():
        a.play()

    playAqueous = Pattern(function=noteOn, time=t * 2).play()
    delay = Delay(a,
                  delay=t * 0.75,
                  feedback=0.6,
                  maxdelay=t * 0.75,
                  mul=0.445)
    wetdry = delay + a
    d = WGVerb(wetdry,
               feedback=[0.73, 0.76],
               cutoff=5000,
               bal=0.25,
               mul=0.2985).out()
    s.gui(locals())
コード例 #4
0
            Table containing the waveform samples.
        freq: float or PyoObject, optional
            Frequency in cycles per second. Defaults to 1.
        loop: int {0, 1}, optional
            Looping mode, 0 means off, 1 means on. Defaults to 0.
        interp: int, optional
            Choice of the interpolation method. Defaults to 2.
        """
        super().__init__(table,
                         freq=freq,
                         loop=loop,
                         interp=interp,
                         mul=mul,
                         add=add)
        TrigFunc(self["trig"], lambda: print("LOOP\n\n\n\n\n\n\n"))


if __name__ == "__main__":
    from pyo import Server, TableRead

    def close():
        server.closeGui()
        inst.close()

    server = Server().boot()
    inst = AudioTable(r"D:\music\mosesdt.mp3", 0)
    inst.decode()
    inst.view()
    reader = AudioReader(inst, inst.getRate(), loop=1).out()
    server.gui(locals())