Difference between revisions of "AutoHarmonizer"

From vjmedia
Line 1: Line 1:
 
'''Overview'''  
 
'''Overview'''  
 
The AutoHarmonizer is a small, compact device that allows the user to sing, speak, or make whatever sound and based on user-input, output pitch shifted audio by the chosen amount of semi-tones. The device has an onboard screen that tells the user the frequency of the incoming audio, the closest calculated note, the semi-tone shift, as well as the outgoing audio's calculated note.  
 
The AutoHarmonizer is a small, compact device that allows the user to sing, speak, or make whatever sound and based on user-input, output pitch shifted audio by the chosen amount of semi-tones. The device has an onboard screen that tells the user the frequency of the incoming audio, the closest calculated note, the semi-tone shift, as well as the outgoing audio's calculated note.  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  

Revision as of 19:13, 24 August 2025

Overview The AutoHarmonizer is a small, compact device that allows the user to sing, speak, or make whatever sound and based on user-input, output pitch shifted audio by the chosen amount of semi-tones. The device has an onboard screen that tells the user the frequency of the incoming audio, the closest calculated note, the semi-tone shift, as well as the outgoing audio's calculated note.










Menu View.jpg


Intro Sometimes when singing, you want to harmonize! However you don't always have another person with you and they might not know how to sing! The intervals also might not be exact and maybe you don't have the same range! The idea of an AutoHarmonizer is a cool device that lets you fool around with cool harmonies all by yourself without any complicated hardware or software. It is a great tool to have some fun as well as to learn about musical intervals and harmonies in general.

Objectives The goal of this project was to create a very small, compact device that is able to output the incoming audio at a different interval. The device would be controlled on an microcontroller utilizing I2S communication. A single encoder would be utilized to keep the device simple. An onboard microphone will be used to detect the incoming audio. Powered by a 9V for a longer use time. And finally a 3D-printed shroud to keep everything together.

The Thought Process Originally I started by searching for the correct microcontroller based on my requirements. The classic ESP-32 is great, however it doesn't have precise computation timing which isn't the best for audio. The teensy also has dedicated high speed peripherals including I2S. But most importantly, the teensy has an expansive Teensy Audio Library with many optimized functions that the ESP-32 lacks. And ultimately the teensy is tiny! Much smaller than an ESP-32, especially when choosing the teensy 4.0! I needed a small screen that could display a lot of information at once. For this, an OLED just made sense as it is so customizable. I decided to go with an I2C OLED to utilize the very high speed of the teensy. The I2C bus would also be unutilized without it, so why not make use of it. A very basic mechanical rotary encoder with detents would be perfect for the control knob, no built in switch needed, just channel A and channel B! To power the teensy from a 9V, a 5V buck converter was necessary. I found the smallest one I could. A simple 2 pole switch would be all that's needed to turn the device on and off. For audio, an electret mic with a pre-amp already implemented would be great to pickup analog audio and feed it into the microcontroller. However, in order to do this seamlessly, I would utilize an audio shield for the teensy, which is also tiny and has tons of features. Mainly the Line-In and the 3.5mm audio jack on the shield, which I decided I could use as the audio output. And of course a custom PCB in order to very neatly organize and connect together all the components!

Outcome Almost everything went according to plan. The main issues that came up were as follows:

    Rotary encoders with non clean edges
    Incredibly noisy I2C lines
    Very power hungry OLED

I originally was utilizing a breakout board for the rotary encoder that had 10K pullup resistors already on it to keep the signals from floating. The rising edge of the encoder from the 2 channels however were perfectly overlapping. This makes it very difficult to code consist quadrature encoding to track the intervals of the encoder. Eventually I ended up purchasing different encoders and utilizing the internal pullups of the teensy which seems to have made things better. With using an analog mic, it of course picks up things that aren't audio. The I2C lines were so noisy, you could always here a consistent clicking going on, I managed to fix this with an RC filter, however the power consumption of the OLED was a different story. The Teensy can output 3.3V which is what every component on the board ended up using, therefore the OLED and the Mic are on the same line, because of the OLED's hunger for power, it created a lot of current pulses back to the voltage line which really screws up the analog mic and creates a crazy amount of buzzing that an RC filter just cant perfectly clean. I thought about using an LDO for the electret mic to keep the VCC lines voltage consistent, but ended up deciding to use a digital MEMS mic which completely removes the need for all these resistors and capacitors. This really cleaned up the system. Now though, without the need for the Line-In on the audio shield, I was only utilizing the audio jack on the shield. This made me temped to remove the shield completely and use a separate DAC for the output, but ended up just keeping it anyway.

Final Thoughts This project was really fun. I learned a lot about different pitch shifting algorithms and how complicated and difficult it is to create natural sounding, non sped up or slowed down audio, that doesn't make you sound like a chipmunk. Even though I wasn't able to make it sound super natural, I am still happy with the outcome. I always love learning more about ECE and so this was another great learning experience. Maybe eventually I will return to this project and make it even cleaner and smaller!