mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-11-10 06:42:02 +05:30
bytebeat-render.js: reformat the code
This commit is contained in:
parent
a46019a754
commit
3817607ee4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user