Takes a folder of any type of file(s) and converts all files to audio (often called “databending”). You can specify input/output paths, minimum file size, and the sample format at the input (i.e., treat incoming files as 8-bit unsigned, 16-bit integer, etc.)
Option to filter out sub-audible frequencies and normalize amplitudes before writing to .WAV at the output.
This project uses Rust's cargo package manager. After installing Rust, you can:
- Run the command
cargo runfrom the code folder to run without installing. - Run the command
cargo install --path <path-to-code-folder>to build and install on your computer.
The code will default to expecting your input file(s) and/or folder(s) to be in the input subfolder, and will write .WAV files to the output sub-folder. Here are the commands to change the default options:
-h,--helpshow this help message and exit-i,--inputsubfolder in which to look for files to import (string; default "input")-o,--outputsubfolder in which to write .WAV files (string; default "output")-a,--appendstring to append to all filenames (before extension) (string; default "")- This may be useful when processing the same file(s) with multiple different settings
-m,--minminimum file size to convert (in bytes) — small files (< 1 MB) are often less useful (int; default 0)-s,--sampleratesample rate at which to convert the incoming files to .WAV (int; default 44100)-f,--formatsample format in which to read the files (string: options are 'int8', 'int16', 'int24', 'int32', and 'vox'; default 'int16')-e,--endianwhether to read source bytes as little- or big-endian (string: options are 'little' and 'big'; default 'little')- NOTE: this does not affect 'int8' or 'vox' formats, as the source data for these is only 1 byte
-r,--rawwhether to bypass a 20 Hz low-cut filter which removes sub-audible frequencies (bool; default false)-g,--gaingain in decibels to apply before filtering (float; default -8.0)- When cutting out sub-audible frequencies, the peak-to-peak amplitude often increases. This setting is to compensate for that and avoid clipping. Unused if
--rawis set to true.
- When cutting out sub-audible frequencies, the peak-to-peak amplitude often increases. This setting is to compensate for that and avoid clipping. Unused if
-
Note the extra two dashes (
--) betweencargo runand the command-line options. This sends your options to the running program, rather than to cargo. If you install usingcargo install, these are not necessary. -
Only accept files 1 MB or larger; read as 8-bit integer values
# run with cargo cargo run -- -m 1000000 -f 'int8' # run after installing data2audio -m 1000000 -f 'int8' - Read files from the
datasubfolder and output them to the working folder, rather than a subfolder
# run with cargo cargo run -- -i "data" -o "." # run after installing data2audio -i "data" -o "."