auto-tuning for electric guitars using digital signal processing pat hurney, 4ece 31 st march 2009
TRANSCRIPT
Auto-tuning for Electric Guitars using Digital Signal Processing
Pat Hurney, 4ECE 31st March 2009
Outline of PresentationProject Background
Aims of ProjectSystem Overview
Research, Development and Testing of Functions used in Developing the System
Pitch DetectionPitch ManipulationVST Development
Project ConclusionSummary of GoalsPossible Future WorkQuestions
Project BackgroundTuning problems are a large problem for guitarists, both professional and amateur
Can be hard to correct in a live environment due to a variety of factors.
Numerous hardware methods have been used to try and prevent tuning loss in guitars but these still don’t completely prevent it
This system aims to develop a system capable of digitally correcting the pitch offset of the guitar with the use of a VST
Project Overview
Signal from Piezo Saddles
sent to Firepod interface
Pitch altered Signal sent to Guitarists
Rig
One signal sent in to auto-tune VST
for correction
Piezos located on
bridge
Pitch DetectionAn FFT was used to determine the pitch of the guitar signal
An FFT was used on blocks of 8000 samples, sampled at 16 kHz to acquire the Magnitude Spectrum of the guitar signal.
The fundamental frequency was then determined from this by determining the position of the first significant peak in the signalHighest peak was not used to determine fundamental as 2nd and 3rd harmonics are tallest peaks for small window of time
The resolution used with the FFT varied depending on the approximate location of the fundamental frequency
The location of the fundamental was approximated with the use of LP, BP and HP filtersThe fundamental has the highest energy content in the noteIf the highest energy content was present in the low pass filter, the fundamental is located here and a resolution of 8192 is used
Pitch Detection - FilteringExample of filters and cut-off frequencies:
If a 110Hz wave was input to the system, its fundamental would lie in the range of the low-pass filter. A resolution of 8192 would then be used
8192 filter 4096 filter 2048 filter
Pitch Detection - TestingThe cut-off frequencies used in the filters were determined through testing the signal
Signals ranging in pitch from 110Hz to 660Hz had FFTs of varying resolutions,(8192-1024), performed on themThis testing showed that low frequencies, from <82Hz to ~170Hz require a large resolution of 8192 for accurate results
Pitch ManipulationPitch of out-of-tune guitar signal is corrected with the use of a phase vocoder
A MATLAB implementation of a phase vocoder was discovered through research.
This was then tested to determine how accurate it was at manipulating pitch, and how natural sounding the notes were
Flow of Phase Vocoder
Block of 8000 samples
Windowing
STFT
Spectral Manipulation
ISTFT
Overlap Add
Pitch-shifted Signal
Pitch Manipulation - TestingTesting carried out in MATLAB by strumming the guitar and determining how much the guitar goes out-of-tune by
Strummed softly, max drop in pitch = 2.6HzStrummed hard, max drop = 10.85HzThese results show that strumming the guitar hard causes a much larger drop in pitch then soft strumming
Auditory testing was carried out to determine how natural sounding the pitch shifted note from the phase vocoder was
Max pitch shift capable ~ 1.8-2.0 semitones
Large pitch-shifts are not possible with the phase vocoder as the spectral envelope of the reconstructed signal has been changed resulting in unwanted sounds in the finished signal
VST Development
A VST (Virtual Studio Technology) was used to implement the pitch algorithms in real-time
This required re-coding the pitch algorithms in C++ for compatibility with the Steinberg VST SDK
The VST is run from a DAW (Digital Audio Workstation)
The DAW selected for the project was REAPER. This is a free user-friendly application that is compatible with most free and commercial VSTs
VST DevelopmentTwo main functions in guitar auto-tuning C++ source code
VST constructorprocessReplacing
Variables declared in header file are initialised in main constructor. Other classes called in the main VST, such as the FFT and phase vocoder classes, are also initialised here
The input audio stream is manipulated in the processReplacing function before being passed out to the output stream
The input audio stream consists of a buffer of 1024 samples rather then a continuous stream of samples. Once these 1024 samples are processed, the next block of samples is passed in to be processed by the VST
VST Development - OperationTwo modes of operation available to user:
Mode One determines tuning offset of selected stringMode Two continuously corrects tuning offset with phase vocoder
If Mode One is enabled, the system accumulates 8000 samples when the selected open string is struck. The tuning offset is then calculated from this and stored for future use
If Mode Two is enabled, the tuning offset determined from Mode One is used to correct the pitch of the out-of-tune string
VST Development - Operation
Example of System UI, with Low E Pitch Detection enabled is shown below
VST Development - ProblemsCPU usage is a major factor in the system. A large amount of CPU power is used in:
Filtering – 3 5th Order Butterworth FiltersLarge FFT – 8192 resolution on block of 8000 samplesSix independent channels being run in VST to process each string individually
Input/Output Latency is also a large factor in the system. Standard Windows audio drivers have a latency of approximately 447ms.
This was solved with the use of the ASIO driver ASIO4ALL. This has a latency of approximately 13ms.
ConclusionAim of project was to develop a VST system capable of correcting the pitch of an out-of-tune electric guitar signal
Both algorithms embedded in C++ in a VST format
Pitch Manipulation algorithm runs in real-time, Pitch Extraction algorithm not fully implemented due to time constraints
Research performed in MATLAB has proven concept of auto-tuning guitar system
Future Work
Wireless link could be implemented between piezos and interface
Error handling needs to be embedded in VST to prevent two sliders being turned on for the strings
Questions?