安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
so let's say we have the values:
[1,9,5,3] (=> this represents the audio data)
but instead of 4 points, we want 7 points (that's the easiest example)
then it becomes:
[1, 5, 9, 7, 5, 4, 3] ( we just averaged the numbers in between the existing data set, to calculate the numbers in between )
Now, if you would like to create a data set from 64 to 65, you can just put in into a formula, where it would take something like where the second value would be between the first and second, at 64/65*100% value etc.
var newData = [];
var data = array;
// If the Smooth library is available, use it instead for better results
if (!!Smooth) {
var s = Smooth(data, { method: Smooth.METHOD_CUBIC, scaleTo: newLength });
for (var i = 0; i < newLength; i++) {
newData = s(i);
}
} else {
var linearInterpolate = function(before, after, atPoint) {
return before + (after - before) * atPoint;
};
var springFactor = Number((data.length - 1) / (newLength - 1));
// assign first value
newData[0] = data[0];
for (var i = 1; i < newLength - 1; i++) {
var tmp = i * springFactor;
var before = Number(Math.floor(tmp)).toFixed();
var after = Number(Math.ceil(tmp)).toFixed();
var atPoint = tmp - before;
newData = linearInterpolate(data[before], data[after], atPoint);
}
// assign last value
newData[newLength - 1] = data[data.length - 1];
}
// Return the new array
return newData;
}
This is how it's impemented in JavaScript in the Wallpaper :P The ''Smooth'' Library, will also take the difference between the numbers into account, and 'smooths' it out using the Qubic Quadratic method. ( the fallback would be like I described in my first post )
Thanks for the reply, have a good day