Edward Wang

box (OP-1 Clone)

Latest:

August 27th: progress

The new stack is opengl and tracktion_engine. We’ve been making good progress on the audio and graphics. Screenshot 2024-08-27 at 11 04 40 PM I’m starting to really hate c++. I want to rewrite the whole thing in c or zig but I’m worried that it won’t work and I’ll get stuck.

Jun 18th (2024):

Restarting. Gonna use tracktion_engine for the core audio stuff and write an emulator with ncurses.

Also moving from an hdmi display to pure 128x128 SPI. A lot simpler and also more unique.

Lastly, the pi cm4 is back in stock so I think I’m gonna go with that this time. I had a lot of trouble just getting i2c to work on the radxa, and it’s better in both cost and time to use the pis.

August 16th: PCB DONE!!!!!!!!!!!!!!!!!!!!

Screen Shot 2022-08-16 at 3 38 36 AM

August 9th: PCB almost done

July 7th: timeline + new terminal setup

ALSO I got a new terminal setup (copied from jdh)

Screen Shot 2022-07-07 at 5 21 47 PM

June 26th: Built box on the radxa zero

June 20th: Built allolib on the radxa zero

I decided to build natively instead of cross compiling

This actually took me a really long time (~3 weeks)

Ran into a bunch of issues

June 6th: HDMI LCD display came!!

There’s still a lot of problems with this design:

May 16th: Hardware - I2C GPIO Expander

Got my prototype GPIO expander working.

I’m using the CAT9555, an I2C chip with 16 input/output pins.

It communicates over I2C, which is really nice because it only uses 2 pins, SDA and SCL

Additionally, you can chain them together, with up to 8 on the same 2 lines by modifying the I2C address pins, which lets you have up to 128 IO lines with only 2 pins!!!! (8 IC’s should still be within the 3mA limit i2c_diagram credit: bluedot

May 4th: Got pixel image rendering working

doom_render rectangle_test_render

I’m using allolib’s Image class, which stores images as a vector of uint8_t’s

Every 4 indices represents a pixel’s Red, Green, Blue, and transparency values (stride = 4)

I’m then just iterating through the pixels to plot each one on the screen. You have to iterate in reverse because stb has a different coordinate system than openGL (see below). This means if I draw it regularly, it will actually be flipped upside down. I think the “official” way to fix this is to run:

stbi_set_flip_vertically_on_load(true);

opengl_vs_stb_coords

The only thing was, I was worried that it would mess up other texture rendering services (in allolib), so even though it’s more annoying this way, it will probably end up better overall.

I feel like in general the double for loop is a super slow approach, but I’m also not sure how to make it better. The one thing I did think of is to not run plot_pixel() if the pixel has a transparency of 0 (visibility of 0?) because it won’t be visible anyway.

int position = x_position * t_width + y_position;

for (int y=image.height()-1;y>=0;y--) { 
    for (int x=image.width()-1;x>=0;x--) {
    
        int red = get_image_index(x, y, image);
        int green = red + 1;
        int blue = red + 2;
        int a = red + 3;

        if (a!=0) {
            al::Color c (image.array()[red]/255., image.array()[green]/255., image.array()[blue]/255., image.array()[a]/255.);

            plot_pixel(c, x_position - x, y_position - y);
        }
        
    }
}

Here’s how I got the image to be centered, one kind of annoying thing is that I made the MF DOOM head asymmetrical (odd pixel width) when I drew it, so I can’t actually center it. Kinda nice how the integer rounding is actually useful here though! Screen Shot 2022-05-04 at 11 15 11 AM

ALSO note to self: use square images that are multiples of 2^n i.e. 2x2, 4x4, 16x16, 2048x2048 because they are better optimized or something

April 29th: Got pixel drawing working

I’m using the Midpoint circle algorithm to draw circles

Midpoint_circle_algorithm_animation_(radius_23)

Circles are very symmetrical, so you can save a lot of time by just making 1 computation and repeating it 8 times image

April 28th: Got wav visuals working

Art style & Creative direction

April 15th: Got the subtractive synthesizer working.

I also got started ordering proof of concept parts, and GOD DAMN are SMD breakout boards expensive (Adafruit ones are ~$2.5 each but almost all others are >$7)

April 9th: Got the MPC3000 clone working

April something: starting point

I started working on my new synth, which is a clone of the OP-1 this time.

To start, I was heavily inspired by Prajwal Mahesh’s Portable Synth, as well as the OTTO Project I’m going to try and make updates to this post as I go, as last time it was really annoying to go back and reupdate things.