Arduino Piano Tuner Helper

by JanHerman in Circuits > Arduino

6185 Views, 30 Favorites, 0 Comments

Arduino Piano Tuner Helper

front.jpg
back.bmp

Many electronic tuning devices are on the market. The cheaper ones are designed for specific instruments (such as guitar, violin). The more expensive ones often are called 'orchestral tuner', piano tuning included. For example, the Korg OT-120 (€ 62) or the Seiko SMP100 (€ 59). Considering the prices of tuners specifically for harpsichords and pianos, I suppose they are targeted at professionals: For instance the Jahn CTS-5-C (€ 718), Jahn CTS-7-C (€ 979) and Jahn CTS-7-CE (€ 1390). All these latter models have at least two displays: the one showing the deviation in cents (which will be explained later), note name and frequency, and the other display showing a stroboscopic indicator (indicating whether you're tuning too low or too high).

The main difference with the different models is precision: Jahn its detection accuracy is 0.1 cents, opposed to 1.5 cents for Korg. For pianos, accuracy counts! This has to do with tuning in a particular temperament, which will be explained later. I consider that currently for non-professional piano owners an affordable tuning assistent isn't available. They are either not precise enough or way to expensive. But there is more to the story.

Cheap or expensive, all aboved mentioned tuners have something in common: they have one or more displays, showing your progress. Both the Korg and Seiko models contain a needle-type gauge, the intended frequency in the center of the range. In my opinion, this is a bad idea, because at any angle but 90 degrees, you cannot exactly see the correct position (parallax effect). In general, l think that inspecting some display differs from what old school piano tuners always and only do: they listen to the progress. And for a good reason. The end result must sound well!

Therefore I decided to develop a new device that (1) is affordable, (2) still very precise, (3) easy to use for non-professionals, and (4) does it job without visual clues. And that is what this device does: It generates the required frequencies at a very high precision and renders this to the (grand) piano by means of a transducer, a contact loudspeaker. Just listen and tune the strings equally, which is pretty straightforward.

Supplies

top.jpg

At the core of this project is an Arduino microprocessor, AD9833 synthesizer (breakout board), two small amplifiers and a few electronic components such as two potmeters, a voltage regulator, wiring, three rotary switches, one capacitor, one resistor, cooling element, a DIN connector and a small Veroboard-like PCB. The rest is interface related: enclosure, loudspeaker / transducer, battery holder, on/off switch and five knobs. As with any prototype, lessons are learned. Probably the most interesting is that it can be cheaper, without loss of functionality. This will be adressed.

  • Arduino DUE: The DUE is a 32-bit ARM processor. It is chosen for its 32-bit architecture (frequency precision) and enough pins. This is the most expensive component and progessive insight (see Evaluation section) learned that probably a much cheaper 32-bit Arduino also is possible.
  • AD9833: A ready to use AD9833 breakout board can be achieved for a low price.
  • Potentiometers: two of approx.10K each, although a somewhat higher value will function also.
  • PAM8302: Ready to build in amplfier from AdaFruit. The price is below 4 USD, making it nonsense to build the device yourself. But if cost is an issue, clones are available at a much lower price. Two amplifiers reside inside, one for the transducer, the other for the internal loudspeaker. The latter isn't a must and can be omitted in most cases, together with its volume pot.
  • Rotary switches: Two 5-position switches are used for selecting a frequency for A4 and for the wave outputs. The 24-position is for tone selection. Finding an affordable 24-position switch isn't easy. For instance, I found the cheapest Elma Type04 rotary switch (one deck only!) at don-audio.com for 'only' 48 Euro (approx. 56 USD). The same shop (as does this one) also offers a much cheaper model (approx. 11 Euro, with the required two decks), which I used. Evaluation learned that a more common 12-position rotary switch might be a good alternative. The 5-position switch for wave output selection may be omitted too, because sine waves only are sufficient.
  • Knobs: Two for the volume pots and three for the rotary switches.
  • Transducer: A transducer is a speaker that directly transfers audio movements to the object where it is placed on. The used model is AdaFruit's Medium Surface Transducer. I glued it directly on the soundboard of my piano. Use a good glue (vibrations!), I chose Araldite. The effect is that the sound comes from inside the piano, as if a string is sounding. Of course, any other place (without glueing) can be found with a little experimenting.
  • DIN connector: For connecting the external transducer
  • Loudspeaker: An internal loudspeaker was added at the bottom of the housing, although it perhaps may be omitted, together with its amplifier and volume pot.
  • STM LD1117V33: This is a voltage regulator. You'll need it to convert to 9V battery power to 3.3V for the circuitry, ecxept the DUE. The Arduino DUE requires an input voltage of 7-12V.
  • Capacitor: A small 10uF electrolytic at the output of the voltage regulator for stabilization.
  • Resistors: 10K at the Flip-Flop and 27K mounted between the wave output switch and amplifiers, for dimming the square wave level coming from the AD9833. The latter can be omitted if only sine waves are sufficient.
  • CD4013BE Dual D-Type Flip-Flop: A Flip-Flop is a component that switches between two states: ON and OFF, which is the same as zero volt or a positive one at the output. The Mute switch triggers this component each time in the opposite state. Its specifications can be found at https://www.ti.com/lit/ds/symlink/cd4013b.pdf.
  • Mute switch: a common momentary switch, mounted at the front.
  • On/Off toggle swicth, mounted at the back.
  • Enclosure: Any case will do, but remember, the scale at the interface for the 24-position rotary switch requires some height to be read without errors. From a distance, when printed small, and perhaps in a somewhat dark room, the letters E and F look quite similar. The current height is 8.3cm (3.26") which I recommend for the project.
  • Bulgin 9V battery holder: Mounted at the back, enables battery swapping externally.

Exploring and Brushing Up the Theoretical Background

Tuning scheme.bmp

Tuning and Temperament

In Western music, an octave is divided in 12 semi-tones (chromatic scale). Modern pianos are tuned in the equal temperament system. This means that all 12 semi-tones are equal in size. This may sound normal, but it isn't. In history, many other systems were in use. In general, defining the exact size of intervals is called a temperament. Tempering is making a pure interval wider or narrower. Pure intervals exist in the lower range of the overtone scale. The ratios of these intervals can be derived from its integer rank numbers. The most stable intervals are octave (1:2), fifth (2:3) and major third (4:5). These rank numbers represent both string length relations and frequency ratios. For instance, an octave lower than note A4 (440 Hz) is A3(220 Hz); the string length of A3 is twice that of A4. Pure intervals have a certain stability when played simultaneously: The more the overtones of two tones sounding together match, the greater the stability ('purity') of the sound. In music theory parlance such sounds are called (perfect) consonants.

Dividing the octave in 12 equal semi-tones has a great advantage: Music can be played in all 24 keys, 12 major and 12 minor (e.g., C major, G-sharp minor), without loss of quality. The disadvantage is that now all intervals but the octave differs from its native ratios, all are a tiny bit 'false'. In manual tuning, making all 12 semi-tones equal is achieved by tempering all fifths by a very small value: 1/12 part of the so-called Pythagorean comma, which is about 23.46 cents (a semitone is 100 cents). This will be explained.

In our music we use sharps and flats. A violist can make a difference between for instance F-sharp and G-flat. However, keyboards would become very complex if these differences should lead to different keys (see Fokker's 31-tone organ). Therefore, keyboards use the same keys for sharps and flats. For instance, the key for F-sharp is the same as for G-flat, although in reality, both notes differ a small value. This difference is that so-called Pythagorean comma. By tempering it out, a cycle of fifths can be tuned that repeats itself after 12 steps: C-G-D-A-E-B-F#-C#-G#-D#-E#-B#(=C). B# is the Pythagorean comma higher than C, so all pure fifths must be narrowed by 1/12 of this comma, which is 23.46 / 12 = 1.955 cents. That's why accuracy of electronic tuning devices is important! Compare this with the specs of the above mentioned tuning devices...

Cents

The cent is a logarithmic unit of measure used for musical intervals. Interval ratios are the same as frequency ratios. The ratio of a pure octave is 1:2, the fifth 2:3. If for example a tone is 200 Hz, then the tone an octave higher is 400 Hz, a pure fifth higher is 3/2 * 200 = 300 Hz. For cent expressions, any octave is geometrically divided into 1200 cents. Therefore, 1 cent = 2^(1/1200)=(1200)√ 2 = 1.0005777895065548592967925757932. One cent is thus the number that multiplied by itself 1200 times results in the number 2 (octave). Our ears cannot hear a one cent interval, it's way to small.

Cents are used to express intervals and to compare intervals in different tuning systems. Only the twelve-tone equal temperament system divides the octave into 12 equal semitones of 100 cents each. In this system, a fifth is 1.955 cent lower than a pure 3:2 fifth. 

Can you tell how many cents are in one hertz? No, but if you want to calculate the frequency of A4 (440 Hz), increased by 5 cents, then you must multiply 440 with this 5 cent ratio: This formula is 440.00 * (1200/5 )√ 2 = 440.00 * (240 )√ 2 = 441.27 Hz. You can also write 440.00 * 2^(1/240 )

It is easier to do a log10 calculation, because this is available on scientific calculators. See for instance http://www.sengpielaudio.com/calculator-centsratio.htm.

Tuning a piano in the equal temperament system

If a pure interval is tempered, you'll hear beats: A beat is an interference pattern between two sounds of slightly different frequencies, perceived as a periodic variation in volume, whose rate is the difference of the two frequencies (Wikipedia).

Piano tuners, tempering aurally, listen to this beat effect when tuning a piano in a particular temperament system. This requires a lot of experience, because the beat frequency increases if the intervals go up. For example, the beat frequency for C4-G4 is lower than for F4-C5 (both are fifths), provided that you tuned both in the same temperament system. If tuned well, the beat rate (of the same intervals) increases evenly in the temperament region.

For the equal temperament system, professionals follow a tuning scheme consisting of tempered fifths and pure octaves, in such a way that first the about middle one and the half octave of the keyboard is processed. From time to time, the temperament is checked by pressing available major chords. (Some professionals use faster tuning schemes, which are much more difficult to master). If the temperament in this region is established, the rest is tuned in pure octaves, chromatically starting from each available string upwards and downwards.

Home-tuners will have to tune their piano once or twice a year. They may benefit from an electronic tuning device, because learning and remembering the beat frequencies requires more practice than once or twice yearly. Harpsichord players have to tune their instruments much more frequently, once a week or even more often (dependent on the weather). For them, a tuning device is useful both for training and practice. As a former harpsichord player, I tuned the instrument completely aural. Something to be expected from experienced harpsichord players. Not from piano players!

The figure at the top of this section shows the tuning scheme for the equal temperament. I modified the scheme somewhat, to have some control chords earlier in the process. It may safe time (and irritation if you have to go back). Even if you intend to use an electronic tuning device, my personal recommendation is to follow this scheme, both for pianos and harpsichords.  

In the first step, the A4 string is compared with the ‘concert pitch’ 440 Hz. If it isn't safe to tune the string directly up to 440 Hz, then perhaps a somewhat lower value is a good idea (the device can lower A4 in five steps of 1/8 interval each, down to G#). If not, then call a professional for your piano (better safe than sorry). If safe, tune the A4 string and next all remaining red marked strings with the electronic tuning device. Just follow the scheme.

When tuning a fifth with the electronic device, don't play the interval, but only the single red marked note. Afterwards you can play the fifth, to judge its sound and the beats. Octaves are always tuned manually. Octaves are 'clean' if beats are absent. The black major cords enable you to check your tuning. All must sound equally 'false'.

The electronic device won't support you outside this scheme. Tune remaining strings in octaves, upwards and downwards, chromatically starting at the strings already tuned. First read the section below about inharmonicity.

Beware: In case of aural tuning, you'll also hear beats if erroneously a fifth is made wider!

Tuning for newbies

This is not the place to provide a detailed manual about how to tune your piano. You will find enough reading material on the internet. For example WikiPedia, the ‘How to Tune a Piano’ pages and so on. Nevertheless, a few remarks and warnings may benefit, specifically for newbies.

- How to break a string

Strings won't break easily, but if they do it may hurt your hands (or even face). Breaks are caused primarily by wrenching the wrong pin, so first follow the string from the damper up to the pin with your hand, pluck the string with a finger to check, and only then place the tuning lever and start tuning.

Rusty strings in an old piano are inevitably at risk. Be careful, limit your power on the tuning lever. It may help first lower the string tension somewhat, to get movement in the (often 'frozen') tuning pin.

For any piano that did not receive any tuning or maintenance for several years: Do not tune the A4 string directly to 440 Hz if it requires tuning 30 cents or more upwards. Contemporary pianos allow a greater stretch than older ones, but even for modern pianos, 30 cents can be too much. It depends on the condition of the instrument. You'll have to tune in passes: In the first pass, tune the entire piano only a small value higher. A safe value for such a piano perhaps is 20-30 cents in the middle region. Repeat it next tuning passes, until you have reached the concert pitch. The electronic tuning device might support you, it has an option for setting A4 to lower values (415.305 Hz the lowest).

- How (not) to handle the tuning lever ('hammer').

Your tuning lever is for wrenching the pin clockwise or anti-clockwise. These are the only movements allowed. This is very important. Impatient people (even some 'professionals'!) tend to wrench the pin sideways, to give it the motion they need. It will damage the wooden pin-block internally, irreversible.

Don't overestimate the amount of wrenching needed: Only very small movements often satisfy. This is particularly true with the topmost strings. You will even experience that you made the required adjustment only after applying some pressure on the lever.

To limit the amount of tension on the string, pay some attention to the position of the tuning lever. If its handle is horizontal orientated, you are at risk to apply to much force, thus wrenching over the string's limit. Keep the handle more vertical upright. 

Tuning a string is one thing, but keeping it in tune after playing the piano for a while is another. When tuning upwards, the tension is increased. It helps repeatedly striking the string while tuning, to establish a stable tension. It also helps to go very slightly above the required pitch, and then gradually coming down to the right pitch.

- When not to use this electronic tuning device

The very low notes on the piano are produced by one string only, followed by two strings for each note (bichords), and for the rest, the main part, three strings (trichords) are used for each separate note. One string at a time must be tuned and therefore rubber or felt mutes are used to mute the other strings of the bichord and trichord in treatment. Instead of these mutes you can also use one continuous strip of felt, placed between all strings. This enables to tune the section needed for the temperament on single strings only. Next, the remaining unison strings are tuned by ear: Wrench until the beats are disappeared completely.

- For the rest:

Tuning the upper and lower octaves is very much the same as tuning the unison strings: Beats disappear if the octave is pure. But there is a caveat: Striking a string on a piano produces a tone consisting of the fundamental (the one defining the frequency of the note) plus several 'overtones' ('harmonics') which not match the overtone scale. For example, the A4 string, 440 Hz, is expected to have a second overtone of 880Hz, but may present instead 881 Hz, and a fourth overtone of 1766 Hz, instead of the expected 1760 Hz. Both sound a bit higher than described in theory.

This is caused by the stiffness of the piano string and is different from instrument to instrument. The phenomenon is called inharmonicity and is the reason for the common practice to tune the bass section a bit lower, and the descant section a bit higher. It is impossible to tell how much lower resp. higher: It depends on your piano and must be experienced by practice. Your electronic tuning device can't help you. But there is a solution: the free application Entropy is a software piano tuner, also capable of calculating the amount of stretch for your piano.

Defining Requirements for the Device

In the project managing field, one of the 'classics' is the MoSCoW principle: Must have, Should have, Could have, and Won't have this time.

Must have

Tuning is a highly analogue process: A string is tuned a small bit up, then down and so on, until the right position is achieved. The feedback from an electronic tuning device must be able to keep up with this process: Any latency won't support, but instead hinder the manual process.

Requirement 1: Zero latency.

We already learned about beats, caused by narrowing all pure fifths by 1.955 cents. Let's bring it in practice. The A4 is 440 Hz. The pure fifth below, D4, is 2/3 * 440 = 293.333 Hz. But in our tempered system, D4 is tuned at 293.665 Hz. The difference is only 0.3316 Hz ! That's why accuracy counts.

Requirement 2: Frequency accuracy <= 0.5 cent.

Technicians often tend to develop new devices as if they themselves are the future end-users, even with little or no experience in the field of application. This is in contrast with a user-centered design approach, where existing experience and practices (so-called 'mental models') are taken into account. While cycling through a series of fifths (see the tuning cycle figure in previous section), professionals listen to the beats when tuning. Our device will support this tuning practice. An advantage is that it also can be employed for self-training purposes.

Requirement 3: Supports current tuning practice.  

If a piano wasn't tuned for a long time, setting A4 up to 440 Hz in one session may be a little too much. Tuning somewhat lower is a better idea.

Requirement 4: Supports a lower concert pitch.

Should have

Baroque instruments often are tuned in a lower A4, mostly 415 Hz. If they are accompanied by a harpsichord, this also must be tuned lower. This is not an impossible feature for an electronic tuning device. However, harpsichords often have a mechanical solution, enabling the entire keyboard to be shifted a position to the left. This achieves the same. But if you really need it, the A4 selection switch enables this function: it presents five 1/8 intervals below 440, ending at 415.305 Hz (G#). But this switch cannot start at 415.305, presenting five lower frequencies. The main focus remains on pianos.

Could have

Today, the equal temperament system is dominant. In history, many other systems existed. For instance, J.S. Bach's church organ was tuned in the Meantone system. Some musicians prefer to perform older compositions in the temperament system of that period. This is unlikely for modern pianos, but copies of older keyboard instruments are on the market.

Software wise, this is a possible enhancement. But not right now.

Won’t have

Some electronic tuners cover a wide range. For instance, the Korg OT-120 model ranges from A0 to C8. For pianos, this would be an overkill. The range in the tuning cycle figure (previous section) covers all you need.

What is the information requirement for a piano tuner? Existing devices tend to show as much as possible, such as the achieved frequency value, the cents deviation in numbers and so on. I assume that your attention isn't with the tuning lever and a device screen at the same time. The only thing you really need is some form of feedback on your action, something you can hear or see. You won't get all the redundant information. I like the KISS principle.

You also won't have a record system of achieved stretches, called the "Pianyzer" in the Jahn tuning models. This is a very sophisticated feature and considering the cost, only relevant for professional tuners.

Initial Design Attempt That Failed

fig2.bmp

Initially, the idea was to use a microphone, recording the tuning effort. An LCD screen should show the result, by moving a horizontal line, under / above a fixed center line. If both lines should collide, the tuning position was achieved, confirmed by rendering the center line in a different color. This way, parallax effects could be avoided (see figure above).

The display should render the tuning process in a resolution of only a few cents, because the required deviation from a pure interval is only 1.955 cents. Unfortunately, measuring both this very small frequency value and to do this in real time (no latency!) was a problem:

  • Fourier analysis, such as deployed in the Guitar Tuner project, takes too much time. Same as for another Arduino Fourier project, EasyFFT.
  • Next, Frequency to Voltage conversion possibilities were explored. In particular, the LM331 circuit was studied. Here, the main problem was temperature stability. This can be managed, but at a certain cost and increased complexity.
  • Finally, an interesting article about Frequency to Voltage converters, published by Electronic Design (Bob Pease) was studied. His final circuit was a mix of analog and digital techniques and enabled a very fast conversion: Only one cycle of the incoming signal sufficed. It triggered a digital oscillator during the cycle, whose pulses were buffered, and then processed by an MDAC (multiplying digital to analog convertor). The obstacle was the cost: Because of the required precision, the high-speed clock oscillator should push many other components to a high price.

Another consideration was the requirement of a microphone in this setup type. It's not my personal favorite to have one in an equipment, it often catches more than you need.

Final Design

fig3.bmp

The final design decision was to rely completely on aural appraisal. Because, that’s what you as a home-tuner always will do, while tuning both the remaining bi- and trichord strings and the lower plus upper octaves: You'll listen to beats. This now also applies to the central strings: The electronic tuning device generates the frequencies at a very high precision (Direct Digital Synthesis) and these signals are transmitted to the piano by an audio transducer. An extra loudspeaker helps for additional aural control. Both have a loudness control, for making the best aural mix.

The only thing now required is to employ the tuning hammer until zero beats are achieved, for everything you must tune.

This complies to all ‘must have’ requirements.

Highly recommended is Roland Pelayo's article 'Using AD9833 Signal Generator with Arduino'. It is at the core of this project, as it is (or can be) for many other AD9833 Arduino projects. I used it to establish this Arduino Piano Tuner.

First Implementation

In the first implementation I used the UNO. Its limited number of pins caused some problems. For instance, an additional waveform selection switch was not possible. And for tone selection, a solution had to be found: Rotary switches jump from 12 positons to 24, so I expected to need an 24-position switch. A 24-position rotary switch for tone selection covers chromatically two octaves. But the UNO offers only thirteen digital pins in total. Therefore, the ten available pins (three pins were used for the AD9833) were read in single or in pairs. To set two pins at the same time 'active', the switch needs two decks and must be wired with internal connections. In the source code, simple boolean expressions read these pin combinations. The internal switch wiring is maintained in the final implementation, because components were re-used as much as possible. The tone-selection switch is one of these components.

Final Implementation

wiring diagram.bmp
schema2.bmp
frontplate.bmp

The first implementation sounded well. And placing the transducer on the soundboard of a grand piano (my first tryout) was a good idea, it really helped tuning, because the sound seems to come from inside, just as when you're tuning a string interval. But as a trained tuner (I’m a former harpsichord owner, an instrument that must be tuned almost at a weekly frequency), I doubted many intervals: the beats were not correct. A fact that probably could have known in advance: The UNO is an 8-bit device, lacking the required precision for floats and doubles. So, the final implementation uses the Arduino Due, a 32-bit microprocessor. It has an overwhelming pin amount, now all limits vanish like a shadow in the sunshine.

24-position tone selector switch

The internal old wiring of the 24-position tone selector is maintained because of the re-use. Of course, old wires could have been removed, but this is a very heat sensitive switch and the advantage is that it only requires 10 wires to the Arduino, instead of all 24. The wiring and connections to the DUE are shown in the image above. Standard color codes (brown=1, red=2, orange=3 etc.) are used, so color red connects to Arduino pin2 and so on, with the only exception of brown to pin 12 (pin1 on Arduino isn't available).

A4 selector rotary switch

This 5-position rotary switch is for setting the exact frequency for A4, default 440Hz. The other 4 positions lower the frequency in 1/8 tone intervals, up to 415Hz. After setting A4, the tone scale is calculated by multiplying or dividing next resp. previous tones by the 12 root 2 factor (1.05946309435):

scale[3]=A440/2; //A3
scale[2]=scale[3]/1.0594631; //G#3
scale[1]=scale[2]/1.0594631; //G3
for (int i=4;i<25;i++) {
  scale[i]=scale[i-1]*1.05946309435;
}

This rotary selector is connected to the DUE pins A1..A5. Again, colors help to connect to the right pins.

Wave form selector

The remaining rotary selector is for setting the wave form: Sine, Square, Triangle or Half square. It is connected to pins A6..A9. Because of the loudness differences between Sine or Triangle and Square, I used the second deck of the switch for an extra 27K series resistor. The audio output for the AD9833 goes to the mother pin of this section, and only in the Square position the extra series resistor is used. All others positions go straight to the amplifiers.

All remaining mother pins of the rotary switches are connected to ground, because all microprocessor header pins used for these switches are internally set to HIGH (by the command pinMode(<pinnumber>, INPUT_PULLUP). In the code, settings are checked for LOW.

Mute switch

A device constantly beeping can be very annoying, and therefore a mute button is considered relevant. The Adafruit amplifier has a convenient 'Shutdown' pin for muting, just give it a Ground or V+ level. A D-type Flip-Flop manages this. Anyone interested in its working is advised to read https://pfnicholls.com/Electronics/Dtype.html (or any other electronics page, this is a commonly known component). Currently, both the transducer and the loudspeaker are muted at the same time. But if you want to separate this, the solution is easy: Repeat the circuitry at the other half of the 4013, and connect it to a second mute button.

Electronic components

The Flip-Flop IC, the voltage controller, the AD9833 synthesizer and both amplifiers are mounted on a small PCB (Veroboard style). I used pins and headers for mounting the AD9833 and both amplifiers, to enable easy servicing. Headers also are used for connecting wires, e.g. to voltage output, ground and so on.

Enclosure

All components are packed in a small housing: At the front panel, the rotary selectors and mute button. At the back panel, the on-off switch, 9V battery housing, two volume pots and the transducer output (DIN connector). The speaker is at the bottom below the DUE.

Software

The software has a sufficient number comment lines for a good understanding. The source code file can be found below. You'll also need to download the AD9833 library, created by Bill Williams and located at GitHub.

Evaluation

The cheap 24-position rotary switch caused some problems. You get what you pay for. After having soldered all wires, it was stuck. Opening learned that some contacts were short-circuited and others bended up- or downwards. In other words: the plastic housing is very heat-sensitive. I bought a new one and first pre-assembled al wires, next pre-soldered the contacts, and finally 'glued' both together as fast as possible. Not the best soldering technique, but it helped. You have been warned.

The average precision of the generated frequencies, compared to the tuning standard, is 99.9961% (absolute values, most achieved frequencies are a tiny bit lower, others higher)). All frequencies measured with a resolution of 0.020Hz (using the Visual Analyser application). The average deviation is 0.007217%, close to 0.1 cent, which is a good result.

A disadvantage is that the loudness levels of the AD9833 differ significantly: the sine and triangle wave levels are low, compared to the very loud square waves. This has been solved by a 27K series resistor, situated on the second section of the wave form selection switch. It required an extra wiring between the back and the front (output AD9833, amplifiers).

A further issue is the loudness at lower frequencies: Either the transducer has a somewhat limited frequency range, or the installment on the soundboard of my piano isn’t optimal (or both): below C4 everything sounds gradually softer. This can be compensated by the internal loudspeaker, but now the question rises if a 24-position switch is a “really must”. I suppose that a 12-position switch (range C-sharp4-C5) can do the job too. Just tune the rest in octaves. This will also be a money saver and perhaps also a cheaper 32-bit micro-processor now is possible. On the market are footprint-compatible micro-processors available, from other brands than Arduino. This will of course change the design somewhat.

The final loudness issue is about the built-in loudspeaker. Can it be removed from the design? When tuning a grand, it was sometimes useful because of the grand’s greater sound production. In a future design, I would choose a bigger amplifier for the transducer and use a bigger transducer, which is available at AdaFruit. You might consider to leave the internal loudspeaker intact, because better have it than to regret you haven’t built it in. Personally, I wouldn't use it next time.

An open question was about the most effective wave form for tuning. Is a wave form selection switch really something we need? The answer must come from practice. I used the device both for tuning my piano and a grand. My answer is: sine wave only!. With the sine wave I heard beats the very best. But this can be personal and I’ve no idea if instrument differences are a possible factor. So, probably it’s wise to keep the switch in your design. It doesn’t hurt to have one and the cost is low.

October 2021, JanHerman Verpoorten