I like this one, you can replace the string with your npub and run it using https://processing.org

int xspacing = 0;

int lineLength = 0;

int w;

float theta = 0.0;

float period = 500.0;

float dx;

float[] yvalues;

String asciiString = "npub1tltf8es60957eawprkl4ecs2akkpe6n3wgt4tvphj4vef0mqvxasv6ve7g";

void setup() {

size(800, 400);

xspacing = width / max(1, asciiString.length());

lineLength = xspacing;

w = width - xspacing;

dx = (TWO_PI / period) * xspacing;

yvalues = new float[w / xspacing];

calcWave();

}

void draw() {

background(0);

renderWave();

}

void calcWave() {

float x = 0;

for (int i = 0; i < yvalues.length; i++) {

char c = asciiString.charAt(i % asciiString.length());

float amplitude = map(c, 0, 127, 0, height);

yvalues[i] = amplitude;

x += dx;

}

}

void renderWave() {

noFill();

strokeWeight(2);

float xOffset = width / (float) (asciiString.length() + 1);

for (int x = 0; x < yvalues.length; x++) {

char c = asciiString.charAt(x % asciiString.length());

if (Character.isDigit(c)) {

stroke(255, 165, 0);

} else {

stroke(128, 0, 128);

}

float lineY = height / 2 - yvalues[x] / 2;

line((x + 1) * xOffset, lineY, (x + 1) * xOffset, lineY + yvalues[x]);

}

}

Reply to this note

Please Login to reply.

Discussion

No replies yet.