/
Untitled.py
134 lines (77 loc) · 2.3 KB
/
Untitled.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env python
# coding: utf-8
# In[5]:
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
yt.title
yt.thumbnail_url
yt.streams.all()
# In[6]:
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
yt.title
yt.thumbnail_url
yt.streams.all()
stream = yt.streams.first()
stream
#
# In[11]:
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
yt.title
yt.thumbnail_url
yt.streams.all()
stream = yt.streams.first()
stream
stream.download()
# In[24]:
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
yt.title
yt.thumbnail_url
yt.streams.all()
stream = yt.streams.filter(file_extension='wav').all()
stream
# In[8]:
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
stream = yt.streams.get_by_itag('251')
stream
stream.download()
# In[12]:
#####################################################descarga video de youtube
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=vPaBI_IQoJk&ab_channel=FuerzaPopular')
stream = yt.streams.get_by_itag('251')
stream.download()
# In[10]:
import librosa
data, fs = librosa.load('pasos/keiko.wav')
print(data)
print("####################################################")
print(fs)
# In[2]:
##########################################################segmentar audio
from pydub import AudioSegment
t1 = 3 * 1000 #Works in milliseconds
t2 = 6 * 1000
newAudio = AudioSegment.from_wav("pasos/keiko.wav")
newAudio = newAudio[t1:t2]
newAudio.export('pasos/newSong.wav', format="wav") #Exports to a wav file in the current path.
# In[3]:
pip install pydub
# In[2]:
from pytube import YouTube
link = 'https://www.youtube.com/watch?v=1I-3vJSC-Vo&ab_channel=OneminuteSatisfaction'
youtube = YouTube(link)
stream = youtube.streams.filter(only_audio=True).all()
stream.download('descarga')
# In[15]:
#######################################intensidad de sonido
import soundfile as sf
import pyloudnorm as pyln
data, rate = sf.read("newsong.wav")
meter = pyln.Meter(rate) #
loudness = meter.integrated_loudness(data)
print(loudness)
# In[14]:
pip install pyloudnorm