1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2025-01-10 17:32:05 +05:30

bytebeat-render.js: simplify generateAudio

This commit is contained in:
パチュリー・ノーレッジ 2023-12-29 22:31:26 +03:00
parent 0b4349e8c3
commit 5f83c22ce8
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -53,7 +53,6 @@ const tan = Math.tan
const tanh = Math.tanh const tanh = Math.tanh
const generateAudio = t => { const generateAudio = t => {
t *= FINAL_SAMPLE_RATE_CONVERSION
return t&t>>8 return t&t>>8
} }
@ -90,7 +89,7 @@ for (let buffer = 0; t < PRODUCT; buffer++) {
let idx = 0 let idx = 0
for (; idx < BUFFER_SIZE && t < PRODUCT; idx++) { for (; idx < BUFFER_SIZE && t < PRODUCT; idx++) {
let sample = generateAudio(t) let sample = generateAudio(t * FINAL_SAMPLE_RATE_CONVERSION)
if (sample.constructor === Array) if (sample.constructor === Array)
sample.forEach((sample, index) => { sample.forEach((sample, index) => {
audioData[CHANNELS * idx + index] = constrainValue(sample); audioData[CHANNELS * idx + index] = constrainValue(sample);