简体   繁体   English

如何从 Jupyter Notebook 下载音频?

[英]How do I download audio from Jupyter Notebook?

I have loaded an audio file in Python and I add some white noise to it.我在 Python 中加载了一个音频文件,并在其中添加了一些白噪声。 How do I download the new file with the white noise in it?如何下载包含白噪声的新文件?

I have attached my code below.我在下面附上了我的代码。 Please note that this is being done in Jupyter Notebook.请注意,这是在 Jupyter Notebook 中完成的。

data = load_audio_file("chunk0_1.wav")
wn = np.random.randn(len(data))
data_wn = data + 0.01*wn
ipd.Audio(data_wn, rate=16000)

You can save the wav file using librosa, with the write_wav function.您可以保存使用librosa WAV文件,与write_wav功能。

Then in Jupyter you can browse to the file location and download it by checking the box and selecting download at the top.然后在 Jupyter 中,您可以浏览到文件位置并通过选中框并选择顶部的下载来下载它。

示例图像

If you are using Jupyter Lab, you should see something like this:如果您使用的是 Jupyter Lab,您应该会看到如下内容:

在此处输入图片说明

Left-click the three dots and you should get the opportunity for a local download.左键单击三个点,您应该有机会进行本地下载。 I am currently running GPUs in a specialized kubernetes container with multiple layers of indirection, but I access it on a windows laptop via Jupyter from anywhere, and I can download those individual files direct to my laptop.我目前在具有多层间接性的专用 kubernetes 容器中运行 GPU,但我从任何地方通过 Jupyter 在 Windows 笔记本电脑上访问它,我可以将这些单独的文件直接下载到我的笔记本电脑。

I cannot at the moment verify this works on older Jupyter set-ups, but if you're not using Lab, strongly consider upgrading.我目前无法验证这是否适用于较旧的 Jupyter 设置,但如果您不使用 Lab,请强烈考虑升级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM