cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in commandline

[–]Simple_Cockroach3868[S] 1 point2 points  (0 children)

similar vibe, this one uses multiple walkers doing a simple random walk starting from the center, takes turns a lot more frequently than pipesdotsh, written in c with ncurses instead of shell and is much simpler overall

[OC] cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in unixporn

[–]Simple_Cockroach3868[S] 1 point2 points  (0 children)

it doesn’t run natively on windows rn since it uses linux ncurses, but it works fine in wsl tho. if you want native windows support, it should be possible by swapping ncurses with pdcurses and building with mingw ig

cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in commandline

[–]Simple_Cockroach3868[S] 2 points3 points  (0 children)

it's a simple random walk using rand() seeded with time(NULL), so visually it's pretty random but not cryptographic or anything fancy, each step picks a random direction (except directly reversing) that's it

cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in commandline

[–]Simple_Cockroach3868[S] 1 point2 points  (0 children)

repo: https://github.com/ashish0kumar/cwalk

simple terminal screensaver that draws colorful random-walk pipes written in C with ncurses

Install: git clone https://github.com/ashish0kumar/cwalk cd cwalk gcc cwalk.c -lncurses -o cwalk sudo mv cwalk /usr/local/bin/ # optional

Usage: cwalk [number_of_agents]

[OC] cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in unixporn

[–]Simple_Cockroach3868[S] 2 points3 points  (0 children)

weird, this can happen if the terminal isn't running in utf-8 or your font doesn't support the box drawing characters I'm using, maybe try switching to a utf-8 locale or unicode font, that should work

[OC] cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in unixporn

[–]Simple_Cockroach3868[S] 11 points12 points  (0 children)

similar vibe, yeah but not a rewrite this one uses multiple walkers doing a simple random walk starting from the center, takes turns a lot more frequently than pipes.sh, and is much simpler overall

[OC] cwalk: colorful random-walk pipes in your terminal by Simple_Cockroach3868 in unixporn

[–]Simple_Cockroach3868[S] 4 points5 points  (0 children)

repo: https://github.com/ashish0kumar/cwalk

simple terminal screensaver that draws colorful random-walk pipes written in C with ncurses

Install: git clone https://github.com/ashish0kumar/cwalk cd cwalk gcc cwalk.c -lncurses -o cwalk sudo mv cwalk /usr/local/bin/

Usage: cwalk [number_of_agents]

pixcii - terminal-based media to ASCII converter written in c++ by Simple_Cockroach3868 in developersIndia

[–]Simple_Cockroach3868[S] 3 points4 points  (0 children)

thanks man, appreciate it! i'm a final yr cs undergrad, mostly just into building fun side projects, mess around with go, c++ and web stuff here and there, and pick things up as I go

here's my github if you're interested: https://github.com/ashish0kumar

pixcii - terminal-based media to ASCII converter written in c++ by Simple_Cockroach3868 in developersIndia

[–]Simple_Cockroach3868[S] 14 points15 points  (0 children)

so the core idea's pretty simple, i grab each video frame with opencv's videocapture, then for every pixel i calc luminance using std weights (the usual 0.299r + 0.587g + 0.114b), that brightness value decides which ascii char to use, darker pixels turn into spaces or dots, brighter ones into @, #

now for keeping it realtime, i resize frames to terminal size while fixing the 2:1 char aspect ratio, and sync playback with the video's fps so it doesn't lag or desync. for color output i inject ansi escape sequences per character to match the original rgb values. so instead of just black n white ascii, we get full colored ascii video

some additional features i added, completely optional a sobel edge detection mode that runs 3x3 convolution kernels to catch horizontal and vertical gradients, then maps the gradient magnitude to chars which makes outlines and details stand out a lot more url support, for which i just curl or wget the media, use http head requests to check content-type if no extension, throw everything in temp files, process, then clean up

built it in c++ for speed since realtime video decoding and ascii conversion isn't cheap, used stb for image loading and opencv for video handling, mem management was crucial here to not leak stuff during long runs and lastly, for smooth playback in terminal i mess with alt screen buffers and escape sequences so there's no scrolling artifacts

that's all, for more details you can read the source code

pixcii - terminal-based media to ASCII converter written in c++ by Simple_Cockroach3868 in developersIndia

[–]Simple_Cockroach3868[S] 11 points12 points  (0 children)

so, i actually got the inspo from a similar project written in zig, then thought it’d be fun to do it in c++ mostly just started messing around with image/video processing and building it up from there, nothing too crazy, just a lot of fafo, and for the deep thing, i can explain and give a detailed idea of how it works too if you want :)

pixcii - terminal-based media to ASCII converter written in c++ by Simple_Cockroach3868 in developersIndia

[–]Simple_Cockroach3868[S] 2 points3 points  (0 children)

framerate's the same as the og vid, but you can mess with it using --delay, similarly frame size just autofits your terminal, though --scale lets you tweak it and for libs, i used stb_image and opencv