Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds whitenoise synth #216

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FoxDot/lib/Effects/NewEffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from ..SCLang.SCLang import *

# To be moved to SCLang later
# To be added to SCLang later

EnvGen = cls("EnvGen")
Env = cls("Env")
Expand Down Expand Up @@ -31,7 +31,7 @@ def In(self):
""" Returns 'osc', which is where In.ar() is stored """
return self._in

def Out(self, output):
def Out(self, output=None):
""" Writes to file and loads synthdef """
print(";\n".join(self.lines))
self.lines = []
Expand Down
7 changes: 7 additions & 0 deletions FoxDot/lib/SCLang/Env.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ def __init__(self, sus=None, amp=None, curve="'lin'", doneAction=0):
self.attr['curve'] = curve
self.doneAction = doneAction

class hold(EnvGen):
def __init__(self, duration, doneAction=0):
self.duration = duration
self.doneAction = doneAction
def __str__(self):
return "EnvGen.kr(Env.new([1, 0], [{}], \\hold), doneAction={})".format(self.duration, self.doneAction)

class perc(EnvGen):
value = "Env.perc"
def __init__(self, atk=0.01, sus=None, amp=None, curve=0, doneAction=0):
Expand Down
56 changes: 29 additions & 27 deletions FoxDot/lib/SCLang/SCLang.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,35 +111,37 @@ def __call__(self, *args, **kwargs):
return self.__class__(value)



# UGens

SinOsc = cls("SinOsc")
SinOscFB = cls("SinOscFB")
Saw = cls("Saw")
LFSaw = cls("LFSaw")
VarSaw = cls("VarSaw")
LFTri = cls("LFTri")
LFPar = cls("LFPar")
PlayBuf = cls("PlayBuf")
LFNoise0 = cls("LFNoise0")
LFNoise1 = cls("LFNoise1")
LFNoise2 = cls("LFNoise2")
Gendy1 = cls("Gendy1")
Gendy2 = cls("Gendy2")
Gendy3 = cls("Gendy3")
Gendy4 = cls("Gendy4")
Gendy5 = cls("Gendy5")
Formant = cls("Formant")
Pulse = cls("Pulse")
LFPulse = cls("LFPulse")
PMOsc = cls("PMOsc")
Crackle = cls("Crackle")
LFCub = cls("LFCub")
PinkNoise = cls("PinkNoise")
Impulse = cls("Impulse")
Blip = cls("Blip")
Klank = cls("Klank", ref="`")
Resonz = cls("Resonz")
SinOsc = cls("SinOsc")
SinOscFB = cls("SinOscFB")
Saw = cls("Saw")
LFSaw = cls("LFSaw")
VarSaw = cls("VarSaw")
LFTri = cls("LFTri")
LFPar = cls("LFPar")
PlayBuf = cls("PlayBuf")
LFNoise0 = cls("LFNoise0")
LFNoise1 = cls("LFNoise1")
LFNoise2 = cls("LFNoise2")
Gendy1 = cls("Gendy1")
Gendy2 = cls("Gendy2")
Gendy3 = cls("Gendy3")
Gendy4 = cls("Gendy4")
Gendy5 = cls("Gendy5")
Formant = cls("Formant")
Pulse = cls("Pulse")
LFPulse = cls("LFPulse")
PMOsc = cls("PMOsc")
Crackle = cls("Crackle")
LFCub = cls("LFCub")
PinkNoise = cls("PinkNoise")
WhiteNoise = cls("WhiteNoise")
Impulse = cls("Impulse")
Blip = cls("Blip")
Klank = cls("Klank", ref="`")
Resonz = cls("Resonz")

# Other

Expand Down
15 changes: 9 additions & 6 deletions FoxDot/lib/SCLang/SynthDef.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ class SynthDict(dict):
module = None
server = None
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
super().__init__(kwargs)

def __str__(self):
return str(list(self.keys()))

def __repr__(self):
return str(list(self.keys()))

def __call__(self, name):
return self[name]

def reload(self):
for key, item in self.items():
for item in self.values():
item.load()
return

def set_server(self, serv):
self.server = serv
self.server.synthdefs = self
return

# Create container for SynthDefs

Expand Down Expand Up @@ -299,7 +302,7 @@ def preprocess_osc(self, osc_message):

class SynthDef(SynthDefBaseClass):
def __init__(self, *args, **kwargs):
SynthDefBaseClass.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
# add vib depth?

def add_base_class_behaviour(self):
Expand All @@ -311,7 +314,7 @@ def add_base_class_behaviour(self):

class SampleSynthDef(SynthDefBaseClass):
def __init__(self, *args, **kwargs):
SynthDefBaseClass.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.buf = self.new_attr_instance("buf")
self.pos = self.new_attr_instance("pos")
self.defaults['buf'] = 0
Expand Down
Loading