smooth()函數是p5.js庫中的內置函數。默認情況下,通過關閉最後一個分析幀的平均值,此函數可用於獲得平滑的振幅分析。
用法:
smooth(channel)
注意:僅當index.html文件的開頭部分中包含聲音庫時,所有與聲音相關的函數才起作用。
參數:該函數接受如上所述和以下描述的單個參數:
- set:此參數用於設置平滑度0.0
以下示例說明了JavaScript中的p5.smooth()函數:
var sound;
function preload() {
// Initialize sound
sound = loadSound("pfivesound.mp3");
}
function setup() {
// using the smooth function
sound.smooth(0.5);
// Playing the preloaded sound
sound.play();
}
支持的瀏覽器:下麵列出了p5.js smooth()函數支持的瀏覽器:
- 穀歌瀏覽器
- IE瀏覽器
- 火狐瀏覽器
- 蘋果瀏覽器
- Opera
相關用法
- p5.js second()用法及代碼示例
- CSS var()用法及代碼示例
- PHP Ds\Set xor()用法及代碼示例
- d3.js d3.hcl()用法及代碼示例
- PHP next()用法及代碼示例
- PHP each()用法及代碼示例
- PHP pow( )用法及代碼示例
- p5.js day()用法及代碼示例
- PHP pi( )用法及代碼示例
- p5.js min()用法及代碼示例
注:本文由純淨天空篩選整理自skyridetim大神的英文原創作品 p5.js | smooth() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。