为什么要使用udacity gui和scipy从wav文件中提取样本,并给出不同的值? [英] Why extract sample from wav file using udacity gui and scipy give different values?

查看:83
本文介绍了为什么要使用udacity gui和scipy从wav文件中提取样本,并给出不同的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个7秒的音频wav文件:full.wav.

I have an audio wav file of 7seconds: full.wav.

我提取了其中的一小部分.我使用大胆性选择时间范围,并为其打上标签.我导出标签(包含样本的开始和结束时间).

I extract a small sample of it. I select the timeframe using audacity and I label it. I export the label (containing start and end time of the sample).

1/我使用audacity菜单导出样本,并将其另存为sample_audacity.wav

1/ I export the sample using audacity menu and save it as sample_audacity.wav

2/我使用scipy.io.wavfile.read在python脚本中加载了full.wav我将示例保存为完整[开始:结束].它给了我sample_python.wav

2/ I load in a python script the full.wav using scipy.io.wavfile.read I save the sample full[start:end]. It gives me sample_python.wav

当我收听sample_audacity.wav和sample_python.wav时,我听到的声音与此相同.

但是,如果我使用scipy.io.wavfile.read加载这两个文件,则这两个文件的值将有很大不同.sample_python.wav的值是full.wav的值的子集-这是正常的.

But if I load both of them using scipy.io.wavfile.read I got very different values for the 2 files. the values of sample_python.wav are subset of the values of full.wav - which is normal.

但是sample_audacity.wav的值不是.

But the values of sample_audacity.wav are not.

有人知道保存原始数据提取时为何胆量会如何/如何修改初始数据(full.wav)吗?

Does someone know why/how audacity is modifying the initial data (full.wav) when saving an extract of it?

如果可能的话,如何获得胆量给我作为具有相同初始数据值(子集)的样本?

And if possible how to get audacity to give me as sample that will have same values (subset) of the initial data?

例如,sample_audacity.wav的前100个值

As an example, the first 100 values of sample_audacity.wav

[128122124123134134138143142139139135144144149155156148144143144151152159152160150157151155153155155156154151145139128132124131130129123115104 100 94 94 88 85 78 74 65 59 52 4843 45 46 45 40 30 19 10 6 7 14 15 12 0 -8 1 23 5172 63 55 26 23 20 31 36 40 35 27 22 15 15 7 9 1 -2-4 0 -3 -4 -18 -25 -25 -12 -1 -9]

sample_audacity.wav的形状:(36296,)

Shape of sample_audacity.wav: (36296,)

sample_python.wav的前100个值

the first 100 values of sample_python.wav

<代码> [128127124122125132139139143142138138137142150155155149144142145 150 154 156 156 155 155 154 153 153 154 155 155 154 151 145 138 131128127129131129123114105 99 95 93 89 84 84 79 73 66 59 5247 44 45 46 45 39 31 19 10 5 8 13 16 11 0 -7 0 2352 69 68 50 30 20 22 30 37 39 35 28 21 16 13 10 7 2-3 -3 -1 -1 -6 -17 -26 -24 -12 -2]

sample_python.wav的形状:(36297,)

Shape of sample_python.wav: (36297,)

大胆2.1.2Ubuntu

Audacity 2.1.2 Ubuntu

首选项导入/导出:

导出设置:

两个文件的媒体信息:

Media info for both files:

推荐答案

将文件导入到audacity后,它将转换为32位格式.当您将文件重新导出回16位时,Audacity将根据首选项使音频抖动.此页面上有更多详细信息: https://wiki.audacityteam.org/wiki/Dither

Once the file is imported into audacity, it is converted to 32-bit format. When you re-export the file back to 16-bits, audacity will dither the audio according to the preferences. There are more details on this page: https://wiki.audacityteam.org/wiki/Dither

此导出设置不在明显的位置.转到偏好设置/质量",然后转到高质量转换"标题下的抖动".如果将其设置为None,则应该获得与python相同的结果.

This export setting is not in an obvious location. Go to Preferences/Quality and then Dither under the "High Quality Conversion" heading. If you set this to None you should get the same results as python.

这篇关于为什么要使用udacity gui和scipy从wav文件中提取样本,并给出不同的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆