-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortingDemo.py
More file actions
28 lines (20 loc) · 765 Bytes
/
Copy pathsortingDemo.py
File metadata and controls
28 lines (20 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from audio_processing import *
import numpy as np
import random
import time
def main():
# Create The architecture of the generator
noiseGen = SinGen("sin generator")
noiseGen.setArgument("amp", ADEnvelope())
# Create random inputs for the generator
inputArrays = [[random.uniform(100, 5000), random.random(), random.random()/12, random.random()*6]
for i in range(15)]
# Sort the inputs by frequency
inputArrays.sort(key=lambda a: a[0])
# play the sounds generated by putting the sorted inputs through the generator.
for inputArray in inputArrays:
audio = noiseGen.arrayToAudio(44000, 0.25, inputArray)
audio.play()
time.sleep(0.25)
if __name__ == "__main__":
main()