在我的应用程序中,我有从服务器返回的数据,如下所示。它有非常深的嵌套:
var data = [{
name: "root",
children: [{
name: "Parent1",
children: [{
name: "Parent1-child1",
children: [{
name: "Parent1-child1-grandchild1",
children: [{
name: "Parent1-child1-grandchild1-last",
children:[]
}]
},
{
name: "Parent1-child1-grandchild2",
children: []
},
{
name: "Parent1-child1-grandchild3",
children: []
}
]
},
{
name: "Paren1-child2",
children: [{
name: "Parent1-chil2-grandchild1",
children: []
},
{
name: "Parent1-child2-grandchild2",
children: [{
name: "Parent1-child2-grandchild2-last",
children: []
}]
},
{
name: "Parent1-child2-grandchild3",
children: []
}
]
},
{
name: "Parent1-child3",
children: []
}
]
},
{
name: "Parent2", …
Run Code Online (Sandbox Code Playgroud) 我正在使用beat_track
Librosa 的本机函数:
from librosa.beat import beat_track
tempo, beat_frames = beat_track(audio, sampling_rate)
Run Code Online (Sandbox Code Playgroud)
歌曲的原始节奏为 ,146 BPM
而函数近似为73.5 BPM
。虽然我明白73.5*2 ~ 148 BPM
,但我们如何才能实现以下目标:
我看过很多关于使用 JS 通过 API 链接嵌入 SoundCloud 曲目的帖子,但我想知道是否有任何可能的方法可以<audio>
在 HTML 中仅使用 SoundCloud 文件链接?
我需要这个的原因是因为我使用 Google Sheets 作为我的网站的小部件来显示来自不同来源的音频文件列表,并使用其他网站并获取 mp3 链接并将其放入模板列表中效果很好,但是我无法使用 SoundCloud 做到这一点。
我知道这是我需要的网址:
http://api.soundcloud.com/tracks/TRACKID/stream?client_id=CLIENTID
我已尝试检查网页以获取此信息,但未提供该信息。我只能获取曲目 ID。
我的谷歌表格模板连接到一个名为Awesome-table的应用程序,这样我就可以写下一长串数据,而无需每次手动编写 HTML,所以我需要使其成为一个统一的过程。
在以下示例中,每个单元格均称为 {{URL}}
<audio controls> <source src="{{URL}}" type="audio/mpeg"> </audio>
其他详细信息(例如第三方应用程序)只是为了解释我这样做的原因。问题只是如何以我可以直接应用的方式获取 Soundcloud 轨道的正确数据 <audio controls> <source src="(soundcloud track here)" type="audio/mpeg"> </audio>
我试图了解基本的 pytorch autograd 系统:
x = torch.tensor(10., requires_grad=True)
print('tensor:',x)
x.backward()
print('gradient:',x.grad)
Run Code Online (Sandbox Code Playgroud)
输出:
tensor: tensor(10., requires_grad=True)
gradient: tensor(1.)
Run Code Online (Sandbox Code Playgroud)
由于x
是一个标量常量并且没有函数应用于它,所以我期望0.
作为梯度输出。为什么是渐变1.
呢?
给定这样一个二进制数,我想访问该数字中的每个元素。例如,我使用以下代码来访问第三个元素:
bin(125) # '0b1111101'
bin(125)[::-1][3]
Run Code Online (Sandbox Code Playgroud)
是的,它有效。但我不确定这是否是一个好方法。它看起来很危险,我想知道是否有其他更好、更有效的方法来访问二进制数的每个元素。
python ×3
autograd ×1
html ×1
html5-audio ×1
javascript ×1
librosa ×1
python-3.x ×1
pytorch ×1
soundcloud ×1
torch ×1