Close

Grand Piano Notes

A project log for 3-Chip Z80 Design

Combining a Z80 retro design with a modern PSoC CPU.

land-boardscomland-boards.com 11/01/2019 at 23:340 Comments

Added a function to make the scale for a grand piano. Here's the logic in the FPGA.

Here's the WaveDAC8 configuration:

This uses a note table to convert the note number to the frequency scaler.

const uint16 notes[] = {12000, 10909, 10297, 9719, 9173, 8659, 8173, 7714, 7281, 6872,
    6487, 6123, 5779, 5455, 5148, 4859, 4587, 4329, 4086, 3857, 3640, 3436,
    3243, 3061, 2889, 2727, 2574, 2430, 2293, 2165, 2043, 1928, 1820, 1718,
    1622, 1531, 1445, 1364, 1287, 1215, 1147, 1082, 1022, 964, 910, 859,
    811, 765, 722, 682, 644, 607, 573, 541, 511, 482, 455, 430, 405, 383,
    361, 341, 322, 304, 287, 271, 255, 241, 228, 215, 203, 191, 181, 170,
    161, 152, 143, 135, 128, 121, 114, 107, 101, 96, 90, 85, 80, 76, 72,
    68, 64, 60, 57, 54, 51, 48, 45, 43, 40, 38};

Writing OUT 98,40 produces 262 Hz which is Middle C.

The output is a bit noisy. I used a 22 Ohm resistor instead of the chip inductor for the analog power so it's probably coupling in noise.

Discussions