Skip to content

CoMakar/PWLab

Repository files navigation

Version 2.0.0

HEXng

HEXNG_EXAMPLE

  • Converts any file into .png
  • Options source: config file

Wavorizer

WAVORIZER_EXAMPLE

  • Converts .png, .jpeg, .jpg ( further .{image} ) into .wav in 2 different modes:
  1. PBP [ Pixel by pixel ]
    • Reads RGB components and writes them as .wav amplitudes
    • Options:
option arg description
post_filter str apply a filter to each pixel (none, sum, mul, xor)
scan_mode str pixel read order (rows, cols, zigzag, spiral)
quantization_level int quantize colors before processing
  1. ISM [ Inverse spectrogram method ]
    • Reads entire .{image} as spectrogram and writes it as .wav amplitudes
    • Must be suitable for many images, but very small and messy images will produce messy result
    • Options:
option arg description
detect_edges bool use the sobel function to detect the edges of objects
blur_radius int radius of the blur applid to an image
noise_strength float strength of the applied noise
  • Other options:
option arg description
sample_rate_mode str if static, sample_rate value will be used, if dynamic sample rate will be computed automatically using remapping
sample_rate int target sample rate of the output .wav file
channels int mono 1 or stereo 2
image_scale int if this value is other than 1, then image will be prescaled using this scale factor
  • Options source: config file

Note: Current max image size is 1e10 ( = 10 000 000 000 ) .{image} with width x height > 1e10 will be skipped. This value is also used for remapping as max value of initial range. Look at the sources if you really want to edit it: src.wavorizer.app.py :: MAX_IMAGE_LIN_SIZE = 1e8

Wavovideo

  • Renders .mp4 video from Wavorizer output using .spec.json files
  • Creates scrolling visualization synchronized with audio
  • Automatically detects scan mode and adjusts scrolling axis:
    • PBP rows/zigzag: vertical scroll
    • PBP cols: horizontal scroll
    • PBP spiral: not supported yet
    • ISM: horizontal scroll
  • Options:
option arg description
resolution str output video resolution (TINY, SMALL, MEDIUM, LARGE, FULLHD)
fps int frames per second
scanner_color int scanner line and area color (RED, GREEN, BLUE, WHITE, BLACK, CYAN, MAGENTA, YELLOW)
scan_area_opacity float opacity of the area under the scanning line
scanline_thickness int line thickness
blend_mode str blend mode for the scanner (NORMAL, DODGE, DIFF, COLOR, SATUR, OVERLAY)
resize_mode str resize mode for image preprocessor (NEAREST, BOX, LANCZOS)
  • Options source: config file
  • Requires: FFmpeg installed and available in PATH

Note: Processes all valid .spec.json files found in the in/ folder. Files with hash mismatches or unsupported scan modes (such as spiral) will be skipped. Output videos are saved to out/ folder.

Complete config structures:

Wavorizer ( Default values ):

{
    "mode": "PBP",
    "channels": 1,
    "sample_rate_mode": "static",
    "sample_rate": 44100,
    "image_scale": 1,
    "PBP": {
        "post_filter": "none",
        "quantization_level": 0,
        "scan_mode": "rows"
    },
    "ISM": {
        "detect_edges": false,
        "blur_radius": 0,
        "noise_strength": 0.0
    }
}

Wavovideo ( Default values ):

{
    "resolution": "FULLHD",
    "resize_mode": "BOX",
    "fps": 2.0,
    "scanner_color": "WHITE",
    "scan_area_opacity": 0.1,
    "scanline_thickness": 1,
    "blend_mode": "NORMAL"
}

Installation

From Release

Pre-built version is available. You can download it from the Releases.

Note

Executables were built using PyInstaller [Windows 10 x64]

Build it yourself

Note

This project uses Pipenv to manage virtual environment and all the dependencies. Make sure to install it first.

  1. Clone the repository:

    git clone https://github.com/CoMakar/PWLab.git
    cd PWLab
  2. Install with dev dependencies

    pipenv install --dev
  3. Use make file or pyinstaller itself to build the project

    make all
    # - or -
    pyinstaller hexng.spec
    pyinstaller wavorizer.spec
    pyinstaller wavovideo.spec
  4. Navigate to ./dist/ or ./bin/pwlab directory to find the executables

    cd ./bin/pwlab
    ls -> hexng, wavorizer, wavovideo
    cd ./hexng
    ./hexng
    # - or -
    cd ./dist
    ./hexng

Examples

HEXng: Notepad++.exe

Wavorizer: Logo

Wavorizer: 2B2T Spawn

About

- Some byte-to-image and image-to-audio conversion tools

Topics

Resources

License

Stars

Watchers

Forks

Contributors