Old 03-25-2022, 09:09 PM   #1
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default ashSCII

In case you ever wanted to do such a thing.

You can replace the density map string, just keep a few things in mind:

1) It wants to go big to small like the one I've got in there. I left one blank space at the end, but that's kind of optional, and you could add more if you wanted to.
B) Make sure to change the map_length value to match the number of characters in your string, including those trailing blank spaces, but...
III) For some reason, the strcpy_substr function was returning nothing when I tried to grab index 1, so I added two blank spaces at the beginning. These are NOT included in map_length, but rather are represented in map_pad. It doesn't make sense that they are necessary, and if it works for you without them, then great!

You could of course change the font, too. Monospaced fonts are supposedly best, but...


As always, let me know what you think.


Edit 15:10CT 3/26/22 -
Added a source parameter so it can be on the same track as your video (source = 0), or index to others below it.

Code:
// ashSCII

//@param1:source 'source (tracks below)' 0 0 50 25 1
//@param2:rez 'resolution' 0.025 0.01 0.05 0.025 0.001
//@param3:mode 'mode' 0 0 1 0 1
//@param4:contrast 'contrast' 1 0 4 2.5 0.1

colorspace = 'RGBA';
//#map="   _.,-=+:;cba!?0123456789$W#@Ñ"; // set to string to override
#map = "  $@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,'. ";
map_length = 66;
map_pad = 2;
third = 1/3;
_8bit = 1/256;
value_mult = map_length * _8bit;

down_h = rez * project_h;
font="Ariel";
gfx_setfont(down_h,font);
#text = "@";
gfx_str_measure(#text,txtw,txth);
gfx_setfont(down_h,txth);
txt_x_pad = 0;
txt_y_pad = 0;
txt_x = (txtw + txt_x_pad);
txt_y = (txth + txt_y_pad);
d_x = floor(project_w / txt_x);
d_y = floor(project_h / txt_y);
temp = gfx_img_resize (temp,d_x,d_y);
gfx_dest = temp;

gfx_blit (source == 0 ? 0 : input_track(source-1), 0, 0, 0, d_x, d_y);
gfx_dest = -1;
gfx_set (mode);
gfx_fillrect (0,0,project_w,project_h);
gfx_set(1-mode);
i = 0;
while (i < d_x)
  (j = 0;
   while (j < d_y)
    (gfx_getpixel(temp, i, j, r, g, b);
     value = floor (value_mult * ((0.3 * r + 0.59 * g + 0.11 * b - 127.5) * contrast + 127.5));
     mode == 0 ? value = map_length - value;
     value = max(0, min (map_length, value));
     value += map_pad; 
     #text = "";
     strcpy_substr(#text,#map,value,1);  
     gfx_str_draw (#text, i*txt_x, j*txt_y);
     j += 1;
    );
   i += 1;
  );

Last edited by ashcat_lt; 03-26-2022 at 01:12 PM.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 12:04 AM   #2
karhide
Human being with feelings
 
Join Date: May 2008
Location: Nottingham
Posts: 200
Default

Just had a play with ashSCII and it's pretty cool!
karhide is offline   Reply With Quote
Old 03-26-2022, 02:29 AM   #3
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Wow, looks amazing!
vitalker is offline   Reply With Quote
Old 03-26-2022, 02:35 AM   #4
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

What is this ?
thanks

(*im dumb but I want to try this)
__________________
I like turtles

Last edited by bezusheist; 03-26-2022 at 02:43 AM.
bezusheist is offline   Reply With Quote
Old 03-26-2022, 02:51 AM   #5
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by bezusheist View Post
What is this ?
thanks

(*im dumb but I want to try this)
Translates image to ASCII. It was popular > 10 years ago.
vitalker is offline   Reply With Quote
Old 03-26-2022, 03:54 AM   #6
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

Is it a script ? What image does it convert ? Do I drag a gif or video onto a track ?
Thanks
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 03-26-2022, 04:33 AM   #7
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by bezusheist View Post
Is it a script ? What image does it convert ? Do I drag a gif or video onto a track ?
Thanks
Check what subforum you are in. Check it for yourself, I didn't try.
vitalker is offline   Reply With Quote
Old 03-26-2022, 04:46 AM   #8
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

Ok thanks for nothing lol
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 03-26-2022, 04:52 AM   #9
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by bezusheist View Post
Ok thanks for nothing lol
A question the answer.
vitalker is offline   Reply With Quote
Old 03-26-2022, 06:42 AM   #10
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by bezusheist View Post
What is this ?
It’s a preset for the video processor. Put an image or video on a track. Insert the VP plugin on that track. Copy the code from here into the big blank area in the VP and hit Ctrl+S. View the results in the Video window. In my gif, I have the video window floating above the actual VP window so that you can see it while I turn the knobs.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 06:51 AM   #11
bezusheist
Human being with feelings
 
bezusheist's Avatar
 
Join Date: Nov 2010
Location: Mullet
Posts: 829
Default

Oh good explanation, thanks. I knew it had something to do with video but no idea what was involved.
__________________
I like turtles
bezusheist is offline   Reply With Quote
Old 03-26-2022, 07:07 AM   #12
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Wow!

That brings old memories! Back in the early 80s my father brought back from the university a printout of the famous Einstein's picture in ASCII that he gathered from of printer terminals with no screen....
papagirafe is offline   Reply With Quote
Old 03-26-2022, 07:27 AM   #13
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

I tried but all I get are repetitive patterns, does this code assume a specific video size or format?

btw there is a difference between "RGBA" and 'RGBA', the first one is a string and the second is a single number written in an alternate notation.
papagirafe is offline   Reply With Quote
Old 03-26-2022, 07:34 AM   #14
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by papagirafe View Post
btw there is a difference between "RGBA" and 'RGBA', the first one is a string and the second is a single number written in an alternate notation.
Is it EEL specific?
vitalker is offline   Reply With Quote
Old 03-26-2022, 07:38 AM   #15
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by papagirafe View Post
I tried but all I get are repetitive patterns, does this code assume a specific video size or format?
It shouldn’t. Everything is calculated from project_w and _h, so it should just adapt to whatever, but…
Quote:
btw there is a difference between "RGBA" and 'RGBA', the first one is a string and the second is a single number written in an alternate notation.
…it definitely depends on getting RGB values from getpixel. YUV will give unpredictable results. If I got the colorspace thing wrong, it could be your issue. Sorry about that. I stuck that line in there without referencing working presets, and it seemed to fix things, so….

I’ve edited the code above. Hope it helps.

It could of course be changed to work with the other colorspaces by adjusting the calculations for value, but I haven’t looked into that.

Last edited by ashcat_lt; 03-26-2022 at 07:43 AM.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 09:08 AM   #16
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by ashcat_lt View Post
It shouldn’t. Everything is calculated from project_w and _h, so it should just adapt to whatever, but…

…it definitely depends on getting RGB values from getpixel. YUV will give unpredictable results. If I got the colorspace thing wrong, it could be your issue. Sorry about that. I stuck that line in there without referencing working presets, and it seemed to fix things, so….

I’ve edited the code above. Hope it helps.

It could of course be changed to work with the other colorspaces by adjusting the calculations for value, but I haven’t looked into that.
Don't feel bad! I'll look deeper into it when I need a break from my current choir mixing project. As for the colorspace thing, I find this "feature" of the EEL language a weak point easily leading to confusion. BTW that explains also why you can't have more than 4 styles at the same time with the stock text overlay preset.
papagirafe is offline   Reply With Quote
Old 03-26-2022, 09:56 AM   #17
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

This is very cool! As someone who ran a BBS for the decade of the 90's I love ASCII art.

I tried this on a video but it was showing no motion. Just a full screen of one character repeated over the screen. When I change text size it zooms in and out. Mode toggles the background color. And contrast changes what ascii character is being used. But no matter which ascii character it's using... it's a full screen of that one character with no movement with the video.

Here are the video settings...

Length: 7:00.086
Video: 1920x1080@29.97fps, Aspect=1.00, Decoding format=RGB
Audio: 48000Hz 2ch 32bps

Using VLC decoder (v3.0.x)
Video: 1920x1080, h264, 29.97fps
Audio: 48000hz, 32bps, 2ch, mp4a

Loaded from: C:\Program Files\VideoLAN\VLC
fuzzball is offline   Reply With Quote
Old 03-26-2022, 10:32 AM   #18
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by fuzzball View Post
…it's a full screen of that one character with no movement with the video.
I’m sorry you’re having trouble. Not sure how much help I can be in debugging. You did grab it after my reply at 9:38am CT? Every time I tested this, the video source was on the track below where I put the plugin, never on the actual track with it. You might try that. Whether you put it above or below depends on your Project Settings. I always prefer lower numbered tracks to replace higher, but default is opposite. I’m not in a place I can mess with this atm. Let me know if it actually helps and I’ll look later at how to fix it.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 10:37 AM   #19
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Quote:
Originally Posted by ashcat_lt View Post
Every time I tested this, the video source was on the track below where I put the plugin, never on the actual track with it. You might try that.
That was it. I moved the FX to an otherwise empty track above the video track and it sprang to life.
fuzzball is offline   Reply With Quote
Old 03-26-2022, 10:45 AM   #20
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by fuzzball View Post
That was it. I moved the FX to an otherwise empty track above the video track and it sprang to life.
Oh good! It should be an easy fix, when I get the chance. Thanks a bunch.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 12:21 PM   #21
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,416
Default

This is SO! cool. Nice! Thanks a lot for this video preset.

I had to change ‘RGBA’ on line 7 to "RGBA" for it to compile correctly, Reaper v6.52, Win.

SO COOL!
Thanks

EDIT: I would want to experiment with different #maps. So I did set
Code:
map_length = strlen(#map);
and that seems to work, but I see that the original value for map_length was 66, while #map is 69 chars long. Should I use
Code:
map_length = strlen(#map) - 3;
instead?

OK, I read now the OP:
Quote:
For some reason, the strcpy_substr function was returning nothing when I tried to grab index 1, so I added two blank spaces at the beginning. These are NOT included in map_length, but rather are represented in map_pad.
So never mind, I got it. Thanks.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...

Last edited by Fabian; 03-26-2022 at 12:33 PM.
Fabian is offline   Reply With Quote
Old 03-26-2022, 01:13 PM   #22
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Quote:
Originally Posted by Fabian View Post
I had to change ‘RGBA’ on line 7 to "RGBA" for it to compile correctly, Reaper v6.52, Win.
Really? Works either way for me, but the ticks match other plugins that I know work.

Quote:
Thanks.
NP! Thanks for taking a look.
ashcat_lt is online now   Reply With Quote
Old 03-26-2022, 02:08 PM   #23
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

edit 2022-03-27: Your version does work very well... track number confusion ... mea culpa.

Last edited by papagirafe; 03-27-2022 at 12:30 PM. Reason: new info
papagirafe is offline   Reply With Quote
Old 03-29-2022, 04:40 AM   #24
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Cool, really amazing. Would it be possible to make it work only on a part the screen? For example to censor something instead of pixelation. Here is the pixelation code (not sure whether it is bundled with Reaper).

PHP Code:
// Pixelate image
//@param 1 'x pos' 0.25
//@param 2 'y pos' 0.25
//@param 3 'width' 0.5
//@param 4 'height' 0.5
//@param 5 'pixelsize' 0.5
src 0;
function 
pixelate_rect(xywhszlocal(rsubwsubhinstance(fs)
(
  
subw max(2,sz & -2);
  
subh = (subw*w) & -2;
  
r=floor(w/subw+0.5)*.5;

  
gfx_dest fs gfx_img_resize(fssubwsubh);
  
gfx_blit(-1000subwsubhx+ry+rwh);
  
gfx_dest = -1;
  
gfx_blit(fs0xywh00subwsubh);
);

param5>&& input_info(src,project_w,project_h) ? (
  
gfx_blit(src);
  
pixelate_rect(project_w*param1project_h*param2,
                
project_w*param3project_h*param4,
                    
+ (.9*(1-param5))^2*(project_w*param3)
                    );
); 
vitalker is offline   Reply With Quote
Old 03-29-2022, 05:57 AM   #25
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Suggestion:

bottom track: put your video item there
track above: insert ashscii preset followed an image overlay preset that includes cropping.

tried it, it works


update: I forgot to quote vitalker's question in my response.
Quote:
Originally Posted by vitalker View Post
Cool, really amazing. Would it be possible to make it work only on a part the screen? For example to censor something instead of pixelation. Here is the pixelation code (not sure whether it is bundled with Reaper).

Last edited by papagirafe; 04-02-2022 at 10:15 AM. Reason: omission
papagirafe is offline   Reply With Quote
Old 03-29-2022, 08:13 AM   #26
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

I thought I fixed that track thing.
ashcat_lt is online now   Reply With Quote
Old 04-01-2022, 10:28 PM   #27
karhide
Human being with feelings
 
Join Date: May 2008
Location: Nottingham
Posts: 200
Default

Used ashSCII on 3 videos from my new album that came out yesterday

https://youtu.be/-sbDv1tU88w

https://youtu.be/zdsapRYW1XY

https://youtu.be/IGwp0V3NxRw
karhide is offline   Reply With Quote
Old 05-22-2022, 11:35 AM   #28
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,416
Default

I modded ashSCII to allow changing the maps:
Code:
// ashSCII MF-mod

//@param1:rez 'text size' 5 1 10 5 0.01
//@param2:mode 'mode' 0 0 1 0 1
//@param3:contrast 'contrast' 1 0 4 2.5 0.1

//@param4:map "map" 0 0 3 1.5 1

colorspace = 'RGBA';
#map3 = "   _.,-=+:;cba!?0123456789$W#@Ñ"; 
#map0 = "  gloglOgLOGLOgLOglOgloglOgLoGLOGLOGLOGLoGloglo";  
#map1 = "  $@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,'. "; 
#map2 = "  goddessgoddeSSgoddESSgodDESSgoDDESSgODDESSGODDESSGODDESSGODES";
maps[0] = #map0;
maps[1] = #map1;
maps[2] = #map2;
maps[3] = #map3;
#map = maps[map];
map_pad = 2;
map_length = strlen(#map) - map_pad; // 66;
third = 1/3;
_8bit = 1/256;
value_mult = map_length * _8bit;

down_h = 0.005 * rez * project_h;
font="Ariel";
gfx_setfont(down_h,font);
#text = "@";
gfx_str_measure(#text,txtw,txth);
gfx_setfont(down_h,txth);
txt_x_pad = 0;
txt_y_pad = 0;
txt_x = (txtw + txt_x_pad);
txt_y = (txth + txt_y_pad);
d_x = floor(project_w / txt_x);
d_y = floor(project_h / txt_y);
temp = gfx_img_resize (temp,d_x,d_y);
gfx_dest = temp;

gfx_blit (input_track(0), 0, 0, 0, d_x, d_y);
gfx_dest = -1;
gfx_set (mode);
gfx_fillrect (0,0,project_w,project_h);
gfx_set(1-mode);
i = 0;
while (i < d_x)
  (j = 0;
   while (j < d_y)
    (gfx_getpixel(temp, i, j, r, g, b);
     value = floor (value_mult * ((0.3 * r + 0.59 * g + 0.11 * b - 127.5) * contrast + 127.5));
     mode == 0 ? value = map_length - value;
     value = max(0, min (map_length, value));
     value += map_pad; 
     #text = "";
     strcpy_substr(#text,#map,value,1);  
     gfx_str_draw (#text, i*txt_x, j*txt_y);
     j += 1;
    );
   i += 1;
  );
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.