📈 Audio Waveform Visualizer
📐 計算公式 / 原理
相位 t = (x ÷ 寬) × 2π × 頻率 + (相位角 + 動畫相位) × π ÷ 180;波形取值:正弦 sin t;方波 sin t ≥ 0 ? 1 : −1;三角波 (2 ÷ π) × asin(sin t);鋸齒波 2 × (t ÷ 2π − floor(0.5 + t ÷ 2π));混合波 (sin t + sin 2.5t ÷ 2 + sin 5t ÷ 3) ÷ 1.83;螢幕縱座標 py = 高/2 − y × 幅度 × (高/2 − 10)
按所選波形公式(正弦/方波/三角波/鋸齒波/混合波)逐點計算並繪製時域波形,不讀取音訊檔案、不提供縮放;用於波形外觀演示與教學示意。
📚 深度解析:波形視覺化
💡 常見使用場景
- 波形外觀樣式演示。
- 教學振幅與相位變化。
- 頁面動效素材試驗。
生成波形預覽
輸入:波形型別、頻率、振幅與相位。
處理:按對應波形公式逐點計算。
輸出:時域波形圖;不讀取音訊檔案,本地繪製。
❓ 常見問題(FAQ)
- 能匯入音訊檔案嗎?
- 不能。本工具只按公式生成波形,不讀取或上傳任何音訊檔案。
- 精度夠嗎?
- 用於波形外觀演示與教學示意;真實音訊測量請使用專業音訊軟體。
- 會儲存或上傳我的內容嗎?
- 結果以瀏覽器即時計算為準,純前端本地處理、資料不上傳;生成的樣式與程式碼僅作快速產出參考,正式專案請以設計系統、規範與瀏覽器實測為準。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Amplitude normalisation | y = centre − amplitude × half canvas height × f(x), with f(x) the normalised function of the selected waveform | Function-graph plotting convention |
| Per-column evaluation | each pixel column is evaluated directly from the analytic formula - no sampling or decimation involved, so the curve stays continuous at any canvas width | Parametric curve plotting |
| Frame-synced drawing | redraw with requestAnimationFrame to avoid timer jitter | W3C Animation Timing |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準