From a952d38e891f2b0e452a3f83686482705524de7c Mon Sep 17 00:00:00 2001 From: spoonietunes Date: Wed, 6 Oct 2021 15:21:05 -0400 Subject: [PATCH] added 'degradeBy 0.XX' to funStuff() --- auto-techno.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/auto-techno.py b/auto-techno.py index 196946a..bf7d471 100644 --- a/auto-techno.py +++ b/auto-techno.py @@ -82,6 +82,8 @@ import random import math import re import time +import decimal +from decimal import Decimal ################################################## @@ -263,6 +265,13 @@ def every(): bars = random.randint(2,16) return (indent+indent+"$ every "+str(bars)+" ") + +def within(): + firstnum = random.choice([0,0.25,0.5,0.75]) + secondnum = random.choice([0.25,0.5,0.75,1]) + return (indent+indent+"within ("+str(firstnum)+","+str(secondnum)+" ") + + def scramble(): divisions = [4,8,16] return ("scramble "+str(random.choice(divisions))) @@ -307,6 +316,9 @@ def offset(): offsetChoices = [0.125,0.125,0.125,0.125,0.1875,0.1875,0.1875] return ("("+str(random.choice(offsetChoices))+" ~>)") +def degrade(): + degradeAmt = (decimal.Decimal(random.random())).quantize(Decimal('.01')) + return "degradeBy "+str(degradeAmt) def fills(): """ @@ -385,7 +397,7 @@ for i in range(1,8): # a list of things to do to patterns to make them more interesting # these happen BEFORE struct, note, etc. #interestingThings = [stut(),bite(),"rev",scramble(),offset()] -interestingThings = [stut(),"rev",scramble(),offset()] +interestingThings = [stut(),"rev",scramble(),offset(),degrade()] def funThings(): wholeEnchilada = "" # add between 1 and 4 "fun" things @@ -433,6 +445,7 @@ for i in percNames: if (random.randint(0,10) > 3): print(funThings()) + #### OFFSET ### # offset the pattern by a certain amount # this can make things much funkier