21 lines
533 B
Python
21 lines
533 B
Python
from os.path import dirname, join as pjoin
|
|
from scipy.io import wavfile as wav
|
|
import numpy as np
|
|
import scipy.io
|
|
import sounddevice
|
|
import math
|
|
|
|
print("Portfolio assignment 1: Clipped")
|
|
|
|
# part 1: building and writing the sine wave
|
|
# starting example: https://www.geeksforgeeks.org/numpy-sin-python/
|
|
|
|
in_array = [0, math.pi / 2, np.pi / 3, np.pi]
|
|
print ("Input array : \n", in_array)
|
|
|
|
Sin_Values = np.sin(in_array)
|
|
print ("\nSine values : \n", Sin_Values)
|
|
|
|
# part 2: building and writing clipped wave
|
|
|
|
# part 3: playing audio |