Beispiel #1
0
from time import sleep
import pyo
import json
import redis


with open('config.json', 'r') as fp:
    config = json.load(fp)

r = redis.Redis(host='localhost', port=6379, db=0)

server = pyo.Server().boot()

sf = pyo.SfPlayer("zoomsamples/lastdrop.wav", loop=True)  
ch = pyo.Chorus(sf).out()
hr = pyo.Harmonizer(sf).out()

server.start()


room_temp = None
temp = None

while True:
    temp = r.rpop('temp')
    if temp is None:
        #print("Queue is empty")
        sleep(1)

    else:
        print(f'got {temp} on a worker')
Beispiel #2
0
 def __init__(self):
     super().__init__()
     self.son = pyo.Input(1)
     self.synth = pyo.Harmonizer(self.son, 1)
     self.filter = pyo.Biquad(self.synth)
     self.verb = pyo.WGVerb(self.filter).mix(2)
Beispiel #3
0
from time import sleep
import pyo
import json


with open('config.json', 'r') as fp:
    config = json.load(fp)

# r = redis.Redis(host='localhost', port=6379, db=0)

server = pyo.Server().boot()
sf = pyo.SfPlayer(<"filename.wav">, loop=True)  # replace <filename>
sh = pyo.FreqShift(sf)
sh.ctrl()
hr = pyo.Harmonizer(sh).out()
hr.ctrl()
ch = pyo.Chorus(sh).out()
ch.ctrl()
dly = pyo.Delay(sh).out()
dly.ctrl()
server.gui(locals())
'''
while True:
    temp = r.rpop('temp')
    if temp is None:
        print("Queue is empty")
        sleep(1)
    else:
        print(f'got {temp} on a worker')
        mod = (int(temp) - 19000) / 1000  # range between -14 and 14
        print(f'using mod {mod}')
Beispiel #4
0
def chain_effects( initial_source, config_effects_dict ):
    '''
    Loop through the effects and assembles their configuration in order according to their keys.
    
    initial_source - the medium by which the audio stream is read (i.e through the input port)
    config_effects_dict - the list of effects to enable on top of the audio stream.
    '''
    vol = 1 #default volume
    enabled_effects = [initial_source]

    # Make the source of the next effect the previously applied effect.
    source = enabled_effects[len(enabled_effects) - 1]

    # If the volume was set, change the default value to the requested volume.
    if "volume" in config_effects_dict:
        vol = config_effects_dict.pop("volume")
        enabled_effects.append(pyo.Tone(
                source,
                freq = 20000,
                mul = vol
                )
        )
    
    # Run through all the effects in our configuration file and apply
    # them to the previously used stream (i.e source)
    for effect in sorted(config_effects_dict.keys()):
	source = enabled_effects[len(enabled_effects) - 1]
        # print("Effect: " + effect + ", Params: " + str(effects_dict[effect]))
        params = config_effects_dict[effect]

        if params['name'] == 'distortion':
            # distortion stuff
            print("Enable distortion effect")
            enabled_effects.append(pyo.Disto(
                source,
                drive=float(params['drive']),
                slope=float(params['slope']),
                mul = vol
                )
            )

        elif params['name'] == 'delay':
            # delay stuff
            print("Enable delay effect")
            enabled_effects.append(pyo.Delay(
                source,
                delay=[0, float(params['delay'])],
                feedback=float(params['feedback']),
                maxdelay=5,
                mul = vol
                )
            )

        elif params['name'] == 'reverb':
            # reverb stuff
            print("Enable reverb effect")
            enabled_effects.append(pyo.STRev(
                source,
                inpos=0.25,
                revtime=float(params['revtime']),
                cutoff=float(params['cutoff']),
                bal=float(params['balance']),
                roomSize=float(params['roomsize']),
                mul = vol
                )
            )

        elif params['name'] == 'chorus':
            # chorus stuff
            print("Enable chorus effect")
            enabled_effects.append(pyo.Chorus(
                source,
                depth=[(params['depth_min']), (params['depth_max'])],
                feedback=float(params['feedback']),
                bal=float(params['balance']),
                mul = vol
                )
            )

        elif params['name'] == 'flanger':
            # flanger stuff
            print("Enable flanger effect")
            enabled_effects.append(flanger.Flanger(
                source,
                depth=float(params['depth']),
                freq=float(params['freq']),
                feedback=float(params['feedback']),
                mul = vol
                )
            )

        elif params['name'] == 'freqshift':
            # frequency shift stuff
            print("Enable frequency shift effect")
            enabled_effects.append(pyo.FreqShift(
                source,
                shift=params['shift'],
                mul = vol
                )
            )

        elif params['name'] == 'harmonizer':
            # harmonizer stuff
            print("Enable harmonizer effect")
            enabled_effects.append(pyo.Harmonizer(
                source,
                transpo=params['transpose'],
                feedback=float(params['feedback']),
                winsize=0.1,
                mul = vol
                )
            )

        elif params['name'] == 'phaser':
            # phaser stuff
            print("Enable phaser effect")
            enabled_effects.append(pyo.Phaser(
                source,
                freq=float(params['frequency']),
                spread=float(params['spread']),
                q=float(params['q']),
                feedback=float(params['feedback']),
                num=int(params['num']),
                mul = vol
                )
            )

    return enabled_effects