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

Merging dev branch with new features #225

Merged
merged 22 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b169547
Fixing a few inconsistencies with SPL
Bubobubobubobubo Jun 8, 2023
3956c7d
Limiting octave up and octave down operators
Bubobubobubobubo Jun 8, 2023
f144396
Adding internal variables to the Sardine Pattern Language
Bubobubobubobubo Jun 8, 2023
3fde803
Inverting . and _
Bubobubobubobubo Jun 8, 2023
647001e
Moving content in the documentation
Bubobubobubobubo Jun 8, 2023
c73dbcb
Global Scale + Scale Function
Bubobubobubobubo Jun 9, 2023
db72276
Without bugfixes
Bubobubobubobubo Jun 9, 2023
415ad2c
Scale patterning ?
Bubobubobubobubo Jun 9, 2023
f4dff06
Adding real euclidian rhythms
Bubobubobubobubo Jun 9, 2023
f4d9b88
Fixing composition bug with ultri, ulsaw and ulrect
Bubobubobubobubo Jun 10, 2023
03dfc4b
Adding a binary shift rhythm generator
Bubobubobubobubo Jun 11, 2023
baf3f9e
fix bug with unit conversion on the br algorithm
Bubobubobubobubo Jun 11, 2023
041851f
Adding the variant bl function
Bubobubobubobubo Jun 11, 2023
58fd86f
Remove "Editor" option in Sardine Config (unused)
Bubobubobubobubo Jun 11, 2023
d0d9984
Add some conditionals for color display and more
Bubobubobubobubo Jun 11, 2023
d8be7db
Refactor documentation
Bubobubobubobubo Jun 11, 2023
0fb459c
Reworking Function Library Section
Bubobubobubobubo Jun 11, 2023
3d84e07
Fixing some forgotten things with Math Functions
Bubobubobubobubo Jun 11, 2023
321d33e
The gigantic cleanup continues
Bubobubobubobubo Jun 11, 2023
88a9e81
Documentation falling from the sky
Bubobubobubobubo Jun 11, 2023
1405a13
Trying to do something with combinatorics functions
Bubobubobubobubo Jun 11, 2023
49742e1
fix rogue space
Bubobubobubobubo Jun 11, 2023
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
Prev Previous commit
Next Next commit
Fixing composition bug with ultri, ulsaw and ulrect
  • Loading branch information
Bubobubobubobubo committed Jun 10, 2023
commit f4d9b889279e806e8535b02bc0a0cea969bd1135
52 changes: 26 additions & 26 deletions sardine_core/sequences/sardine_parser/funclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,57 +934,57 @@ def inner_func():
return -4 * t / period + 2
return [inner_func()]

def alsin(self, period: int|float, **kwargs) -> list:
"""Basic unipolar sinusoïdal low frequency oscillator
def lsaw(self, period: int|float, **kwargs) -> list:
"""Basic sawtooth low frequency oscillator
Args:
period (int|float): LFO period (duration in beats)
Returns:
list: lfo value (0 -> 1)
list: lfo value (-1 -> 1)
"""
# period = float(period[0])
return self.absolute(*[self.lsin(period)])
period = float(period[0])
t = self.clock.time % period
return [((2 * t if t < period / 2 else (2 * t)) / 2) - 1]

def altri(self, period: int|float, **kwargs) -> list:
"""Basic unipolar triangular low frequency oscillator
def lrect(self, period: int|float, pwm: int|float=0.5, **kwargs) -> list:
"""Basic square low frequency oscillator
Args:
period (int|float): LFO period (duration in beats)
Returns:
list: lfo value (0 -> 1)
list: lfo value (-1 -> 1)
"""
return [self.absolute(*[self.ltri(period=period)])]
period, pwm = float(period[0]), float(pwm[0]) * 100
t = self.clock.time % period
return [1 if t < (period * (pwm / 100)) else -1]

def alsaw(self, period: int|float, **kwargs) -> list:
"""Basic unipolar sawtooth low frequency oscillator
def ulsin(self, period: int|float, **kwargs) -> list:
"""Basic unipolar sinusoïdal low frequency oscillator
Args:
period (int|float): LFO period (duration in beats)
Returns:
list: lfo value (0 -> 1)
"""
return [self.absolute(*[self.lsaw(period=period)])]

# period = float(period[0])
return self.absolute(*[self.lsin(period)])

def lsaw(self, period: int|float, **kwargs) -> list:
"""Basic sawtooth low frequency oscillator
def ultri(self, period: int|float, **kwargs) -> list:
"""Basic unipolar triangular low frequency oscillator
Args:
period (int|float): LFO period (duration in beats)
Returns:
list: lfo value (-1 -> 1)
list: lfo value (0 -> 1)
"""
period = float(period[0])
t = self.clock.time % period
return [((2 * t if t < period / 2 else (2 * t)) / 2) - 1]

return self.absolute(*[self.ltri(period=period)])

def lrect(self, period: int|float, pwm: int|float=0.5, **kwargs) -> list:
"""Basic square low frequency oscillator
def ulsaw(self, period: int|float, **kwargs) -> list:
"""Basic unipolar sawtooth low frequency oscillator
Args:
period (int|float): LFO period (duration in beats)
Returns:
list: lfo value (-1 -> 1)
list: lfo value (0 -> 1)
"""
period, pwm = float(period[0]), float(pwm[0]) * 100
t = self.clock.time % period
return [1 if t < (period * (pwm / 100)) else -1]
return self.absolute(*[self.lsaw(period=period)])




def get_time(self, *args, **kwargs):
Expand Down
12 changes: 6 additions & 6 deletions sardine_core/sequences/sardine_parser/tree_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,17 +506,17 @@ def function_call(self, func_name, *args):
"ltri": self.library.ltri,
"lsaw": self.library.lsaw,
"lrect": self.library.lrect,
"ulsin": self.library.alsin,
"ultri": self.library.altri,
"ulsaw": self.library.alsaw,
"ulsin": self.library.ulsin,
"ultri": self.library.ultri,
"ulsaw": self.library.ulsaw,
# Time information
"time": self.library.get_time,
"t": self.library.get_time,
"bar": self.library.get_bar,
"b": self.library.get_bar,
"phase": self.library.get_phase,
"p": self.library.get_phase,
"unix": self.library.get_unix_time,
"t": self.library.get_time,
"b": self.library.get_bar,
"p": self.library.get_phase,
"u": self.library.get_unix_time,
# global scale support
"scl": self.library.get_scale_note,
Expand Down