Welcome. This script will calculate the well depths of a QRD (Quadratic Residue Diffuser) given a specified well width and a maximum well depth. The width and max depth should be specified in inches, with or without decimal fractions (ie 9 or 8.5 for example). This can be used as a guide for building a diffuser. The sequence of well depths shown are simply repeated over and over.

At some point I may add a detailed description of the math used. Briefly, the residue is the modulo of the well sequence number squared and the number of wells per period. For example, with 7 wells per period, well number 5 will have a residue of 4 (the mod of 25 and 7). Note that the number of wells per period is always a prime number. The well depths are proportioned based on the residues.

The results show the well sequence number, the quadratic residue used to calculate the depth, and the well depth for each well in one period. It also shows the resulting frequency range that will be diffused. The minimum frequency is a function of the maximum well depth (the deeper the well, the lower the minimum frequency), while the maximum frequency is a function of the well width (the narrower the well, the higher the maximum frequency). Note that the practical frequency range will generally be wider, about a half octave below the minimum and a half octave above the maximum shown.

If anyone finds a problem with my math, please let me know. The calculations are based on equations I found on the net, which were from various books by F. Alton Everest. I'm not 100% sure on the minimum frequency calculation.

NOTE: You may want to check out the QRDude Quadratic Residue Diffuser calculator. Among other things, it's been brought to my attention that my calculations don't factor in the width of fins at all. The QRdude calculator does this.