diff --git a/js-programming/bytebeat-render.js b/js-programming/bytebeat-render.js index a06f8ed..8714fef 100644 --- a/js-programming/bytebeat-render.js +++ b/js-programming/bytebeat-render.js @@ -7,7 +7,6 @@ Warning: The current result is quick and dirty. Not for educational or production purposes. To-Do: Fix signed bytebeat and floatbeat -To-Do: (cosmetic) Wrap the code before 81th column */ const { appendFileSync, unlinkSync, writeFileSync } = require("fs") @@ -16,7 +15,8 @@ const { execSync } = require("child_process") const { basename } = require("path") let BUFFER_SIZE = 65536 // feel free to change this -const LIGHTNING_MODE = false // disables sequential file write optimization, feel free to change this +const LIGHTNING_MODE = false // disables sequential file write optimization, +// feel free to change this const SAMPLE_RATE = 8000 // feel free to change this const SECONDS = 30 // feel free to change this @@ -69,7 +69,8 @@ const constrainValue = sample => { const random_choice = choices => choices[Math.floor(Math.random() * choices.length)] -const randomFileNameAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" +const randomFileNameAlphabet = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" const generateRandomFileName = () => { let res = tmpdir() + "/" + basename(__filename) + "_" @@ -110,5 +111,7 @@ for (let buffer = 0; t < PRODUCT; buffer++) { audioData = null } -execSync(`ffmpeg -f u8 -ar ${FINAL_SAMPLE_RATE} -ac ${CHANNELS} -i ${fileName} output_${+new Date()}.wav`) +execSync( + `ffmpeg -f u8 -ar ${FINAL_SAMPLE_RATE} -ac ${CHANNELS} ` + + `-i ${fileName} output_${+new Date()}.wav`) unlinkSync(fileName)