-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEnAudio.py
More file actions
51 lines (42 loc) · 1021 Bytes
/
EnAudio.py
File metadata and controls
51 lines (42 loc) · 1021 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import scipy.io.wavfile
import numpy
import time
import matplotlib.pyplot as plt
import sys
start = time.time()
#Encryption
fs, data = scipy.io.wavfile.read('8bitaudio.wav')
print(data)
print(fs)
print(type(data))
dataarray = data
print(type(dataarray))
a, b = dataarray.shape
tup = (a, b)
data = data.astype(numpy.int16)
#data = numpy.asarray(data, dtype=numpy.int16)
#print(data.flags)
data.setflags(write=1)
#print(data.flags)
print((a,b))
Time= numpy.linspace(0, len(data)/fs, num=len(data))
plt.figure(1)
plt.title('Signal Wave')
plt.plot(Time, data)
plt.show()
for i in range(0, tup[0]):
for j in range(0, tup[1]):
x = data[i][j]
x = ((pow(x,3)) % 25777)
data[i][j] = x
print(data)
data = data.astype(numpy.int16)
scipy.io.wavfile.write('EN.wav', fs, data)
Time= numpy.linspace(0, len(data)/fs, num=len(data))
plt.figure(2)
plt.title('Encrypted Signal Wave')
plt.plot(Time, data)
plt.show()
end = time.time()
ElspTime = (end-start)
print('\n Total time taken from your life: ', +ElspTime, 'sec')