The Guts Of The Machine
By Thomas Park
Here is the most essential part of the Python code used to create mystified’ s “Yenisei Crossing”, and
many of my early- to mid- Generative/Iterative tracks. It changes a static sound into a loopable wav
sample with any of various possible characteristics. These traits further define any composition made
using the processed sound. This code was created by myself Thomas Park.
newAudio = AudioSegment.from_wav(atrack)
solonum = random. randrange(1 3)
if solonum < 4:
long = len(newAudio)
if long > 10000:
samplen = random. randrange(200, 800)
sampst = int(leng - samplen)
t1 = random. randrange(sampst)
t2 = (t1 + samplen)
newAudio = newAudio[t1 :t2]
newvol = random. randrange(14, 18)
newAudio = newAudio - newvol
newAudio = newAudio.fadeJn(IO)
newAudio = newAudio.fade_out(10)
if solonum > 3 and solonum < 8:
leng = len(newAudio)
if leng > 60000:
samplen = random. randrange(8000, 24000)
sampst = int(leng - samplen)
t1 = random. randrange(sampst)
t2 = (t1 + samplen)
newAudio = newAudio[t1 :t2]
newvol = random. randrange(14, 18)
newAudio = newAudio - newvol
newAudio = newAudio.fadeJn(3000)
newAudio = newAudio.fade_out(3000)
sill = random. randrange(20000)
sil2 = random. randrange(40000)
front = AudioSegment.silent(duration = sill)
back = AudioSegment.silent(duration = sil2)
newAudio = front + newAudio + back
if solonum > 7 and solonum <11:
leng = len(newAudio)
if leng > 60000:
sampler! = random. randrange(20000, 36000)
sampst = int(leng - samplen)
t1 = random. randrange(sampst)
t2 = (t1 + samplen)
newAudio = newAudio[t1 :t2]
newvol = random. randrange(1 0,14)
newAudio = newAudio - newvol
newAudio = newAudio.fadeJn(3000)
newAudio = newAudio.fade_out(3000)
sill = random. randrange(60000)
sil2 = random. randrange(40000)
front = AudioSegment.silent(duration = sill)
back = AudioSegment.silent(duration = sil2)
newAudio = front + newAudio + back
if solonum > 10:
leng = len(newAudio)
if leng > 10000:
samplen = random. randrange(200, 800)
sampst = int(leng - samplen)
t1 = random. randrange(sampst)
t2 = (t1 + samplen)
newAudio = newAudio[t1 :t2]
newvol = random. randrange(14, 18)
newAudio = newAudio - newvol
newAudio = newAudio.fadeJn(IO)
newAudio = newAudio.fade_out(10)
addAudio = newAudio
ctr = random. randrange(5, 30)
for sam in range(ctr):
newAudio += addAudio
newAudio = newAudio.fadeJn(3000)
newAudio = newAudio.fade_out(3000)
sill = random. randrange(60000)
sil2 = random. randrange(40000)
front = AudioSegment.silent(duration = sill)
back = AudioSegment.silent(duration = sil2)
newAudio = front + newAudio + back
die = random. randrange(IO)
if die == 7:
sill = random. randrange(90000)
sil2 = random. randrange(90000)
front = AudioSegment.silent(duration = sill)
back = AudioSegment.silent(duration = sil2)
newAudio = front + newAudio + back
oufil = "C:\\Users\\mysti\\thomasoriginalcode\\Git\\AlphaOmegatron\\static\\newsample"
tracknam + str(ctr) + ".wav"
newAudio. export(oufil, format="wav")
## THE GHOST OF THE SHADOW ##