-
Notifications
You must be signed in to change notification settings - Fork 0
/
mupy.audiofiles.py
93 lines (35 loc) · 1.02 KB
/
mupy.audiofiles.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# coding: utf-8
# In[34]:
from scipy.io import wavfile
from IPython.display import Audio
from matplotlib import pyplot as plt
import numpy as np
# In[35]:
import os.path #use os.path to import a wavfile when you use mac
sample = os.path.expanduser('/Users/benutzer/Desktop/audiobeispiel.wav')
samplerate, data = wavfile.read(sample)
# In[36]:
plt.xlabel('samples') #use plt.label to label the x or y axes
plt.ylabel('Amplitude')
plt.xlim #use lim to zoom
plt.plot(data)
# In[37]:
Audio(sample)
# In[21]:
print(samplerate)
# In[26]:
samplerate, data = wavfile.read(sample)
print(f'number of samples :{data.shape[0]}' )
print(f'number of channels : {data.shape[1]}')
length = data.shape[0] / samplerate
print(f'length = {length}s')
# <h2> sample rate </h2>
# In[84]:
import matplotlib.image as mpimg
# In[85]:
img = mpimg.imread('/Users/benutzer/Downloads/80ffde40a1da-Increasing-bit-depth-resolution.png')
imgplot = plt.imshow(img)
plt.show()
# In[8]:
# In[12]: