Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
TUBE
(Transistor Utility for Blonde Emulation) Second Semester Report
Spring Semester 2012
Full Report
By
Dave Anderson
Sean Byers
Prepared to partially fulfill the requirements for ECE402
Department of Electrical and Computer Engineering
Colorado State University
Fort Collins, Colorado 80523
Project Advisors: Dr. Mahmood Azimi-Sadjadi, Dr. Ali Pezeshki
Dave Anderson, Sean Byers Page ii
Abstract
The audio industry has a large and dedicated interest in analog processing rather than digital.
Analog electronics are more expensive and tend to be fragile and large. This is why a recent
trend is emerging towards the modeling of analog electronics digitally. Vacuum tube amplifiers,
in particular, have a very sought-after analog sound. Every vacuum-tube amplifier sounds very
different, based on how the tubes are biased, how many gain stages there are, etc. We chose,
then, an amplifier with a single gain stage and a single gain tube made by Fender starting in the
late 1940s called the Champ to digitally emulate.
We first recorded signals in a recording studio, using both live guitar and pre-recorded signals
pumped through a 1960 Fender Champ. From here we were able to determine the amount of
harmonic distortion occurring at different frequencies and amplitudes. The simplest way of
modeling harmonic distortion, we decided, is using polynomials. Much of the project was spent
determining how to generalize these polynomials to the entire frequency spectrum. The main
obstacle we faced was that the harmonics were out of phase with respect to one another, which a
polynomial cannot replicate.
We determined that phase shifts in harmonics are not audible in a mono signal. What a human
hears in terms of a mono signal is uniquely determined by the magnitude spectrum of the signal.
By eliminating phase, a new waveform was created that sounded identical and that a polynomial
could easily be fit to. The algorithm required filtering to match the frequency response of the
amp, as well as the polynomial, which was programmed in Simulink along with a GUI.
Reactions to the sound produced were generally positive.
Dave Anderson, Sean Byers Page iii
Table of Contents Abstract ........................................................................................................................................... ii
List of Figures ................................................................................................................................ iv
List of Tables .................................................................................................................................. v
Chapter I.......................................................................................................................................... 1
Introduction ................................................................................................................................. 1
Motivation ................................................................................................................................... 2
Chapter II ........................................................................................................................................ 3
Background ................................................................................................................................. 3
Current Technology .................................................................................................................... 3
Chapter III ....................................................................................................................................... 5
Research ...................................................................................................................................... 5
Chapter IV ....................................................................................................................................... 8
Data Collection and Analysis...................................................................................................... 8
Alternate Model Derivation methods based on polynomials .................................................... 18
Graphical User Interface (GUI) for Simulink ........................................................................... 26
Chapter V ...................................................................................................................................... 29
Conclusions and Future Work .................................................................................................. 29
References ..................................................................................................................................... 30
Bibliography ................................................................................................................................. 31
Appendix A: Abbreviations .......................................................................................................... 32
Appendix B: Budget ..................................................................................................................... 33
Appendix C: Letters ...................................................................................................................... 34
Letter 1: Sponsorship proposal to Agilent Technologies .......................................................... 34
Letter 2: Response from Agilent Technologies ........................................................................ 35
Letter 3: Thank you to Agilent Technologies ........................................................................... 36
Appendix D: GUI Code ................................................................................................................ 37
Acknowledgements ....................................................................................................................... 46
Dave Anderson, Sean Byers Page iv
List of Figures Figure 1 - Guitars and Tube Amplifier Tested ................................................................................ 2
Figure 2 - Fender Champ Amplifier Schematic .............................................................................. 4
Figure 4 - Passive One-Port WDF Elements [1] ............................................................................. 5
Figure 3 - Tube vs. Transistor Output Characteristics .................................................................... 5
Figure 5 - Filter Bank Schematic on the left, and on the right are Analog Nobs to Vary
Implemented Filter Banks ............................................................................................................... 6
Figure 6 - Hamming Window with Transform [4] ......................................................................... 7
Figure 7 - base signal waveform produced for recording ............................................................... 8
Figure 8 - Fender Champ response to base signal showing amplitude scaling of different
frequencies ...................................................................................................................................... 8
Figure 9 - Audacity plot of the spectra of F3 frequency from base signal ..................................... 9
Figure 10 - Audacity plots of the spectra of amplifiers' responses to F3 sine wave portion of base
signal ............................................................................................................................................. 10
Figure 11 - Audacity plots of waveforms from various amplifiers at 5 different frequencies
(amplitude vs. time) ...................................................................................................................... 11
Figure 12 - Clipped Sine waveform in Audacity .......................................................................... 12
Figure 13 - Fig. 6 signal spectra in audacity ................................................................................. 12
Figure 14 - Response of Behringer clean to high amplitude sine wave showing clipping and
ripple ............................................................................................................................................. 12
Figure 15- Behringer clean impulse response ............................................................................... 13
Figure 16- Behringer clean response to low amplitude square wave (bottom) and square wave
convoluted with Behringer clean impulse response (top) ............................................................. 13
Figure 17 - base signal spectrogram (DFT size 4096) .................................................................. 14
Figure 18 - Champ base signal response spectrogram (DFT size 4096) ...................................... 14
Figure 19 - Base signal and Champ DFTs at F3 frequency .......................................................... 15
Figure 20- F3 waveform and spectra for Champ and 3rd order "Champ modeling" polynomial 15
Figure 21- Champ (blue) vs. 5th order "Champ modeling" polynomial (red) using polyfit method
....................................................................................................................................................... 16
Figure 22- Champ waveform (blue) vs. 5th order Matlab Fourier series fit (red) ........................ 16
Figure 23- Comparison of waveforms and spectra at F3 frequency for base signal, Champ,
Behringer clean and final "Champ Modeling" simulation using a Fourier series/ polynomial. ... 17
Figure 24-Even(top) and odd(bottom) parts of Champ response to sine waves at F3 frequency. 18
Figure 25-Even(top) and odd(bottom) parts of Champ response to sine waves at C4 frequency. 19
Figure 26-proposed block diagram for real-time processing ........................................................ 19
Figure 27-proposed processing block diagram for frequency sub bands ..................................... 20
Figure 28-polynomial fit for Champ data between 0 and 1kHz ................................................... 20
Figure 29-Polynomial fir for Champ data between 6 and 7kHz ................................................... 21
Figure 30- Waveforms collected from the second Champ at 4 different frequencies .................. 22
Figure 31-spectrogram of Champ response to linear chirp, showing odd harmonics .................. 22
Dave Anderson, Sean Byers Page v
Figure 32-comparison of original signal and spectra with a signal derived from only the
magnitude portion of the spectra................................................................................................... 23
Figure 33- Input-Output relationships for the Champ at 2 different amplitudes, showing the
amplitude dependency of the fits .................................................................................................. 24
Figure 34 - original signal, signal with roll-off, filtered roll-off signal ........................................ 25
Figure 35 - final block diagram for real-time processing ............................................................. 25
Figure 36 - Graphical User Interface for Simulink Model ........................................................... 26
Figure 37 - Simulink Model Identifying key GUI Functions ....................................................... 27
Figure 38 - GUI Identifying key Simulink Functions ................................................................... 28
List of Tables Table 1 - Budget Balance after spring 2012 Semester .................................................................. 33
Table 2 - Anticipated Budget Required for the Full Year ............................................................ 35
Chapter I
Introduction Vacuum tubes contain three terminals which are a cathode, plate, and grid. The vacuum tube
was invented in early 1900s and was used for all of the amplification required in circuits. The
ability to amplify signals enabled electrical guitar players to play for very big crowds for
increased sound projection capabilities. Having analog amplification is an inherent advantage of
vacuum tubes over transistor amplifiers which are digital. One thing that is required for live
performances is relatively no lag time between the musicians playing a chord and everyone at the
venue being able to hear the amplified chord. Replicating the tube sound is difficult because of
its nonlinear and dynamic frequency properties discussed in later in Chapters 3 and 4.
Transistor amplifiers were invented in 1950s, and slowly became more prominent with improved
efficiency of producing silicon wafers and the MOS transistor in 1960. The advantages of
transistor amplifiers having an increased lifespan, reliability, size, and cost just to name a few,
enabled transistors to replace the vacuum tubes’ role by storm. While transistors became the
main amplifying component, they did not have the ability the vacuum tube amplifier had to
distort signals by creating the “classic” rich tone that everyone was familiar with for music.
Replicating the desired sound with transistor amplifiers is the focus of this paper.
There are three different types of amplifiers compared to produce a higher quality and cheaper
device. The Marshall MG15 amplifier represents a transistor amplifier, Behringer TM300
represents a tube modeler, and the Fender Champ amplifier represents the best tube amplifier
base sound. In order to test the amplifiers, the signals produced were recorded at a recording
studio to try to get the purest sound possible. This means ideally blocking out all noises besides
the output signal.
The three amplifiers were tested at Wilson Recording Studio with 24 bit/sample for high
resolution and 96 samples/kHz to avoid antialiasing that occurs with vacuum tube amplifiers.
Musical notes ranging from 174.71Hz to 1318.51Hz were used which correspond to F3, C4, G4,
D5, A5, and E6 on the guitar. Each frequency that was put through the amplifiers had their
amplitude varied from -125dB to 0dB. The amplifiers were also tested with live playing of five
different guitars with the output signals of the amplifiers being captured by a large diaphragm
condenser and Old Shure 545 microphones. The five guitars used consisted of the Epiphone
Dot, 57 Telecaster, 71 Single-Coil SG100, 84 Kubicki, and Zia Guitar.
Dave Anderson, Sean Byers Page 2
Figure 1 - Guitars and Tube Amplifier Tested
In Chapter 2, the background of the project will be discussed giving more details into the
amplifiers available and their effects. Chapter 3 will discuss our research and Chapter 4 will
discuss the team’s decisions.
Motivation Many studio professionals still enjoy the sound of vacuum tube amplifiers over transistor
amplifiers when they need to create the best sounding music. Even though transistors are
cheaper to manufacture, the vacuum tubes’ distortion produces a higher quality sound that is
worth the higher price resulting in continued use by some studio professionals. In order to
produce the same sound quality as a tube amplifier, transistor amplifiers require techniques to
deliberately change the output signal discussed in Chapter 3.
Current silicon transistor technology produces relatively inexpensive amplifiers compared to
tubes; creating a transistor circuit to replicate a tube sound is worth investigating as this paper
shows because of its ability to reduce the cost to produce identical functioning product. The
main question this paper investigates is how to implement this idea practically to produce a high
quality product.
Dave Anderson, Sean Byers Page 3
Chapter II
Background Evaluating an output signal that passes through a system knowing the input will give insight of
how the system distorts a signal. The same idea was used on a vacuum tube when it produced a
signal. The signals produced from the tube amplifier are periodic and nonlinear. Since it is not a
linear signal the black box approach to take the input signal and output signal to define a filter
for all frequencies will not work. Nonlinear signals are signals that do not have outputs directly
proportional to their inputs. The main method for analyzing nonlinear signals is by using
waveshaping. Waveshaping can be done by using a lookup-table, filter bank, polynomials, and
Fourier Series. Using a lookup-table is the only method not utilized due to its infinite
possibilities for outputs.
Filter banks are used to implement different conditions to the input signal depending on the
frequency of the signal. The idea behind a filter bank is to account for the changing equations
depending on the input frequency that a vacuum tube inherently implements. With frequencies
between two filters there will be what is called a weighting of the filters depending on the
frequency to have one of the filters have a greater impact on the output signal’s characteristics.
Polynomials are similar to Fourier Series when the a sine input is plugged into the x(t)’s of
Fourier series differs because it says that for every periodic signal the Fourier Series is able to
represent the signal by a combination of sine and cosine inputs at different frequencies.
Current Technology Vacuum tube amplifiers like the Fender Champ amplifier are becoming very expensive as the
vacuum tubes required to replace the existing ones become increasingly difficult to obtain. The
schematic of the Fender Champ amplifier is shown in Figure 2. A transistor amplifier that
emulates a vacuum tube amplifier that is commercially available and is readily available is the
Peavey Vypyr which costs $100 and has terrible quality for its emulation. Transistor amplifiers
that emulate general tube amplifiers would be similar to the Behringer TM300 Tube Amp
Modeler. The problem with this product is that many if not all of its settings give poor quality
and even produces awful quality distortion when the amplification is increased. Specific tube
emulating amplifiers like the Boss FBM-1 costs around $300 which is relatively cheap for
recording studios, but still relatively expensive for your average person. This device emulates
the 59 Fender Bassman in specific.
Dave Anderson, Sean Byers Page 4
Software tube emulators are good at producing the tube sound that is desired, but is designed to
work in studios where the device can have time to process the information. Whereas a live
performance would require the device to immediately process the signal to be synchronized with
the rest of the band. This is the main reason why this project is avoiding software emulation.
Figure 2 - Fender Champ Amplifier Schematic
Dave Anderson, Sean Byers Page 5
Chapter III
Research
Triode vacuum tubes are similar to transistor amplifiers with their gate characteristics. The
difference that is apparent between them is the tube amplifier doesn’t have clean linear
characteristics with changes in the curves because of secondary emission from the tube itself.
This plays a key role when trying to emulate the tube amplifier because of this characteristic.
Wave Digital Filters (WDF) could be used to emulate tube amplifier sounds. The problem with
WDF is the modeling is meant for linear time invariant (LTI) circuits. There is a way of having
port resistances in the circuit to acquire the nonlinearities. This however takes a lot of
computation and is complicated meaning the processing would be slow and not plausible for our
goal to be able to use the device in live shows.
Figure 4 - Passive One-Port WDF Elements [1]
Figure 3 - Tube vs. Transistor Output Characteristics
Dave Anderson, Sean Byers Page 6
Waveshaping is a method of developing and computing nonlinear waveforms. The most
straightforward theoretical method of waveshaping is by using a lookup-table to produce an
output given an input. The problem this method has is that creating a high-resolution lookup-
table would take a lot of memory and if that were not used a low resolution table would have an
audible difference to an actual tube amplifier that it would sound bad. Oversampling of a signal
is many times required due to the nonlinear characteristics of the signal there could be aliasing
that exceeds the Nyquist frequency.
Another way of computing a nonlinear waveform would be to break the desired output into
multiple sections for frequency to break it up into more of a linear system. This would enable
the bands to dominate for certain frequencies and overlap with frequencies in the middle to give
a better blended output signal rather than having an abrupt change at the boundaries of
frequencies. This idea is known as customized waveshaping or using filter banks to create the
different outputs for various frequencies. This means that each frequency band would have some
sort of polynomial approximation to emulate the tube amplifier sound at that frequency and as
the frequency changes the polynomial would have less effect on the circuit when getting closer
to another frequency band until the previous polynomial ideally plays no part in the output
signal.
To analyze the signals that were produced required knowing information regarding waveform
properties that was already discussed, types of windowing methods and spectra analysis. The
type of window can have an effect on what is shown over an interval. The Hamming window
was predominately used in the project because it is a raised cosine shown in Figure 6 helps
represent audio signals giving the system a less than 1% error in the system.
Figure 5 - Filter Bank Schematic on the left, and on the right are Analog Nobs to Vary Implemented Filter Banks
Dave Anderson, Sean Byers Page 7
Figure 6 - Hamming Window with Transform [4]
Spectra analysis which is also shown in Figure 6 is important because the representation can give
the frequency domain’s characteristics. The characteristics involve the dominate frequency,
power, distortion, harmonics, bandwidth, and other spectral components that are not easily
detectable in the time domain waveforms. When using a hamming window along with the
frequency domain, the noise and dominate frequencies will be distinguishable with a high
enough amplitude.
Dave Anderson, Sean Byers Page 8
Chapter IV
Data Collection and Analysis The actual signal processing and analysis work started as soon as we went to the recording
studio. We went to Wilson studios in Longmont, CO and did nearly 7 hours of recording,
accumulating 18:35 of recordings at 96 kHz and 24-bit resolution, making for 187 MB of data.
The recording studio served several purposes for us. First, it allowed us to get very high quality
digital recordings using high quality equipment, like cables and microphones. Secondly, it
allowed us to spend quite some time talking with Chuck Wilson, our producer, who has spent
many years in professional audio and could lend us some very good advice as to where to take
the project.
We came up with a very thorough recording scheme prior to the session, with Chuck's help. We
knew that we were going to evaluate several amplification methods: the Fender Champ, the
Marshall MG15, the Behringer TM300 on four different settings (bypass, clean, hi-gain, hot),
and every signal recorded directly without any amplification. In order to do the recordings
effectively, there needed to be some kind of a standard signal driven the same way through every
amplifier. Therefore, just having a guitar played through every one of them would not work, as it
would be different every time and there would be no sort of control. We decided to go with a
standard signal made in Matlab that would contain sine waves with a range of amplitudes and
frequencies as well as guitar notes corresponding to the same frequencies as the sine waves. The
periodic sequence of a guitar string vibrating is very different than a sine wave but it also very
predictable, meaning that both portions of the base signal turned out to be very important. The
base signal is shown below in its amplitude vs. time graphical interpretation in Audacity.
Figure 7 - base signal waveform produced for recording
The first half of the signal shows 6 signals increasing in amplitude. The first is a sine wave
corresponding to the musical note F3 at 174.61 Hz. It increases from an amplitude of 0 to an
amplitude of 1 (or 0 dB). The following five sine waves follow the same amplitude increase
pattern but are notes corresponding to C4 (261.63 Hz), G4 (392.00 Hz), D5 (587.33 Hz), A5
(880.00 Hz), and E6 (1318.51 Hz). The second half of the signal has the same 6 frequencies
played on guitar. The picture below shows the signal produced by the Champ in response to the
base signal, which obviously resembles the base.
Figure 8 - Fender Champ response to base signal showing amplitude scaling of different frequencies
Dave Anderson, Sean Byers Page 9
We ended up doing several recordings for each amplifier, rather than just the standardized signal.
Since this is an audio application, the signal sounds are more important than whether it is
identical to what is recorded, we recorded with many different types of guitars in order to get a
very well rounded idea of what effect the amplifier was having. In addition to the standard
signal, we recorded with an Epiphone Dot guitar, a 1984 Kubicki guitar that had active pre-
amplified pickups, a 1971 Gibson SG with Single coil pickups, a Zia guitar with humbucking
pickups, and a 1957 Fender Telecaster. The Telecaster was particularly interesting for two
reasons. For one, it was the guitar that the Fender Champ amp was originally designed to
amplify, meaning that the signal distortion we get from the Telecaster would be the one worth
the most attention. Secondly, this particular guitar was used by the Saturday Night Live band for
a few years. When the guitars were played, a standard playing scheme was used that included
chords, single notes, and chopping, which is essentially playing notes and not letting them ring
out. Overall, we really feel that we got quite a wide range of recordings done which accurately
represent the way that all of the amplifiers are distorting the signals.
The first analysis done in finding what made the tube amplifier sound so much better than the
transistor amp and the modeling pedal was to look at the spectra of the signals collected at the
studio. We knew that the spectra of each signal should contain the base frequency, but that it
would certainly contain something different and that this is what probably gave the amplifier its
characteristic sound.
The spectra was first analyzed in Audacity, a free audio analysis program. This was initially used
rather than Matlab due to the ease of use of the program and the fact that it is able to graph the
spectra in a way tailored to audio, so that only the range of human hearing is on the graph and
that peaks actually have their corresponding musical notes written out. The program allows the
user to graphically select a section of data and compute the FFT of it. For the first set of graphs,
we did not necessarily choose any part of the signals, just made sure to get only the parts that had
a constant amplitude change. An example of the spectra plotted from a chosen part of a signal is
shown below as well as the spectra produced by Audacity.
Figure 9 - Audacity plot of the spectra of F3 frequency from base signal
Dave Anderson, Sean Byers Page 10
The gray area selected of the signal is the part which Audacity computes the spectra. We can see
that the spectra is what we expect: A single peak at 174 Hz with some side frequencies caused by
the windowing of the function. In this case, it can be seen on the spectra window that a Hann
window was used. This process was repeated for all of the frequencies and all amplifiers. It
would take far too much space to show all of the spectra here, so to save space only the spectra
for the F3 note similar to that above will be shown.
Figure 10 - Audacity plots of the spectra of amplifiers' responses to F3 sine wave portion of base signal
There are obvious differences in the spectra. The lower frequency spike in the two amplifiers is
due to AC power at 60 Hz, and is not present in the Behringer since it was powered by a battery.
However, it is very clear that all the amplifiers produce a large number of harmonics with
Dave Anderson, Sean Byers Page 11
varying amplitudes. This was not easy to mathematically analyze in Audacity so in the future we
used Matlab for spectra.
The additional focus was on the waveforms of the various signals. What was very interesting was
that all of the waveforms turned out to be very different. The waveforms are shown below for the
F3 frequency.
Base signal
Fender Champ
Marshall MG15
Behringer – bypass
Behringer – clean
Behringer – hi-gain
Behringer - hot
Figure 11 - Audacity plots of waveforms from various amplifiers at 5 different frequencies (amplitude vs. time)
Dave Anderson, Sean Byers Page 12
The signal distortion analysis always had to do with transforming the base waveforms into
whatever was created by the amplifier, and there are many different ways to have this occur. The
first investigations had to do with the Behringer pedal, from which it was obvious that there was
clipping happening. A program was written in Matlab that would clip the base signal. This signal
and its spectra are shown in the graphs below.
It is very reasonable that clipping will create harmonics, which matches the harmonics from the
Behringer pedal, at least for the first four above the base frequency. The waveforms from the
clipping program do not really match the Behringer waveforms, though. From here, it was
assumed that the Behringer had clipping mixed with an impulse response, which is why it shows
a slight ripple before flattening out, as shown in the figure below.
To test this assumption, we tested the response of the Behringer pedal to
impulses and to single amplitude sine waves and single amplitude square
waves. The amplitudes of these waves had to be scaled down until there was
no clipping happening. The impulse response of the Behringer is shown
below.
Figure 12 - Clipped Sine waveform in
Audacity
Figure 13 - Fig. 6 signal spectra in audacity
Figure 14 - Response
of Behringer clean to
high amplitude sine
wave showing
clipping and ripple
Dave Anderson, Sean Byers Page 13
The graph above shows the convolution of the Behringer's impulse response with the same
square wave that was driven through the Behringer, as well as the Behringer's response to it.
The two waveforms are so close to each other that we feel as though the Behringer's method has
been successfully determined as a mixture of clipping and an impulse response, to give a mix of
harmonics and waveshaping. However, after quite a bit of waveform and spectral analysis, we
began to think that the Behringer pedal was not really coming close to the actual Champ.
Therefore rather than using the Behringer's distortion methods as a building block for the
Champ, we attempted to show that our methods could come closer to the actual Champ than the
Behringer. The spectrograms of the Champ versus the base signal turned out to be very
informative. The spectrograms of the base signal and the Champ's base signal response are
shown below.
Figure 15- Behringer clean impulse response
Figure 16- Behringer clean response to low amplitude square wave (bottom) and square wave convoluted with Behringer clean
impulse response (top)
Dave Anderson, Sean Byers Page 14
Figure 17 - base signal spectrogram (DFT size 4096)
Figure 18 - Champ base signal response spectrogram (DFT size 4096)
Though it was difficult to obtain any real quantitative data from a spectrogram graph, it was very
apparent that the Champ was adding harmonics to the sine wave portion of the signal. These
harmonics were also determined to be integer multiples of the original frequency, which is what
a polynomial would do to a sine wave. When a sine wave is plugged in to a third order
polynomial, we derived that the output signal would be equal to either
A(sin(x))+B(sin2(x))+C(sin
3(x)) or (A + 3C/4)sin(x) + (B/2)sin(2x) + (C/4)sin(3x). By using the
magnitudes of these harmonics in the spectra as the coefficients of the equation with the
multiples of x, we could solve for the coefficients in the polynomial equation. The DFT that was
used to calculate the first polynomial is shown below.
Dave Anderson, Sean Byers Page 15
Figure 19 - Base signal and Champ DFTs at F3 frequency
By using the peaks' intensities relative to each other of base = 1, first harmonic = 0.171, second
harmonic = 0.116, we came up with the coefficients for the polynomial of A = 0.826, B = 0.342
and C = 0.232. The F3 sine wave can be plugged into this polynomial to obtain the waveforms
and spectra shown in the graphs below.
Figure 20- F3 waveform and spectra for Champ and 3rd order "Champ modeling"
polynomial
Dave Anderson, Sean Byers Page 16
It is very promising that the polynomial was able to so well approximate the first two harmonics
above the base frequency. This meant that a polynomial was certainly a step in the right
direction, since it could be quantitatively adjusted and fit to both the spectra and/or the
waveform. The next experiment was to use the Matlab polyfit function to match the input sine
waves used in the studio to the Champ waveforms using a least squares fit. The waveform match
up of the 5th order polynomial against the actual Champ signal is shown below.
It is clear that the polynomial can match the main waveform of the Champ, but there is a slight
hump before the main peak of the polynomial which cannot be matched, even with a high order
polynomial. Fortunately, Matlab also provides a curve fitting tool that can fit data with a Fourier
series. The 5th order Fourier series fit to the same section of data is shown below.
This 5th order Fourier series fit to the data is better at first glance because it is able to simulate
the hump that occurs before the main peak, and if it is at the same order as the original
Figure 21- Champ (blue) vs. 5th order "Champ modeling" polynomial (red) using polyfit
method
Figure 22- Champ waveform (blue) vs. 5th order Matlab Fourier series fit (red)
Dave Anderson, Sean Byers Page 17
polynomial it can have the same spectra. As a preliminary derivation, the difference between the
polynomial fit and the Champ waveform is found. The original sine wave is then filtered using a
digital derivative filter to create a cosine wave. Another Polynomial fit is done to find the best fit
between the remaining signal (the difference between the Champ waveform and the first
polynomial) and the cosine wave. In this way, a Fourier series fit for the original amplitude
varying signal was determined. We were able to obtain results that fit both the waveform and
spectra of the F3 frequency very closely, as shown below.
The actual polynomial derived by our program is an , where
The simulation shows both an improvement over the Behringer waveform and spectra when
compared with the actual Champ amplifier. Our original goal for the semester was to create an
algorithm that would model the champ with better results than the Behringer pedal and we can
say with confidence that we were successful in reaching this objective.
Figure 23- Comparison of waveforms and spectra at F3 frequency for base signal, Champ, Behringer clean and final "Champ
Modeling" simulation using a Fourier series/ polynomial.
Dave Anderson, Sean Byers Page 18
Alternate Model Derivation methods based on polynomials
The polynomial above worked fairly well for a post-processing algorithm, meaning that all the
information in the signal was already available. There are several different ways in which to
implement the pair of polynomials in real time. The first is using the original signal for one
polynomial and the derivative of the original signal for the second polynomial. This didn’t seem
to work as the derivative function would need to be optimized for a particular bandwidth to avoid
its amplitude exploding beyond our control, and we had not yet found an appropriate bandwidth.
The more obvious choice was to base one of the polynomials on the original signal and one on a
phase shifted version of the original signal.
There were several ways that these polynomials could be derived. The first was using a constant
90 degree phase shift in between the two input signals. The signals can be separated into even
and odd parts using the formulas below and a polynomial can be fit from a sine wave to the odd
part and a cosine wave to the even part
.
It is apparent, though, that the even and odd portions of the Champ’s waveforms vary
significantly with both amplitude and frequency. The graphs below show the even and odd
portions of the F3 and C4 note Champ outputs.
Figure 24-Even(top) and odd(bottom) parts of Champ response to sine waves at F3 frequency.
Dave Anderson, Sean Byers Page 19
Figure 25-Even(top) and odd(bottom) parts of Champ response to sine waves at C4 frequency.
These notes are only ~87 Hz away from each other and already differences in the
waveforms are apparent.
Based on the previous data, we decided to try a subbanding approach, where the signal
would be split up into frequency components with different polynomials. The data that was
obtained from the recording studio was not conducive to this sort of approach, since it stopped at
1318 Hz. Luckily, however, there was a lot of guitar data that had a full audio spectrum
bandwidth and this could be broken down into frequency components.
The next question to address was how coarse to make the subbands. Obviously, the waveforms
would be slightly different at every frequency along the spectrum, so any degree of coarseness
would be an approximation to the real distortion. One idea was that the Champ seemed to cut off
all frequencies above 12 kHz, and above 8 kHz there didn’t seem to be much harmonic
distortion. So breaking the range of 0-8kHz into 1kHz bands would give 8 fairly coarse bands.
The only way we had of fitting something to this data was to fit the guitar input to the guitar
output at these different bands.
It also became apparent that as it became difficult to break “random” signals like guitar into
consistent even and odd parts, more phase shifts would be necessary to better approximate the
waveforms.
The processing now broke into the following structure:
Figure 26-proposed block diagram for real-time processing
Dave Anderson, Sean Byers Page 20
Each “processing” block was a simplified version of this structure below.
Figure 27-proposed processing block diagram for frequency sub bands
The processing was now getting fairly complicated, at perhaps 8 subbands and 8 phase shifts,
with 5th
order polynomials. A few of the subband fits are shown in the graphs below.
Figure 28-polynomial fit for Champ data between 0 and 1kHz
Dave Anderson, Sean Byers Page 21
Figure 29-Polynomial fir for Champ data between 6 and 7kHz
The band from 0 to 1kHz actually has a fairly decent fit. The 6-7kHz fit is not very good at all.
This was the general trend of the fits: as the frequency increased the fit became less and less
accurate. By increasing the order of the polynomials we were able to get a slightly better fit. The
problem was that the coefficients started to become very large, which produced problems
generalizing to other amplitudes than the ones they were derived for.
At this time we were given access to another Champ amplifier by a friend, Steven Sandler. In
addition to more data collection across a wider frequency range, we wanted to test whether or not
the uneven wave shapes were due to acoustic reflections rather than the amp itself. Rather than
single frequencies for a period of time, chirps were used from 0-5kHz. Rather than recording the
amp with a microphone, a sampler was plugged directly in to the amp’s “line out” jack. Below
are selected waveforms from across the spectrum and a spectrogram showing the linear chirp as
well as its harmonics.
Dave Anderson, Sean Byers Page 22
Figure 30- Waveforms collected from the second Champ at 4 different frequencies
Figure 31-spectrogram of Champ response to linear chirp, showing odd harmonics
Interestingly, the answer seems to be that the wave shapes are still uneven, but that there are no
even harmonics present in the new data. The even harmonics are likely caused by acoustic
reflections. Therefore, our polynomial should only have odd powers. However, this did not help
us to match polynomials to the wave shapes, so a new method had to be determined.
We began to look now at the frequency spectrum rather than the waveforms. Doing some
research and experimentation, we decided that the phase information present in the data did not
affect the sound. Humans do hear phase information, but only in stereo signals. This information
is used to determine the location of the source of the sound. Since a guitar amp is a mono signal,
the phase information does not matter to the sound.
A new signal can be created by using the following equation:
Dave Anderson, Sean Byers Page 23
This new signal has a different waveform than the original, but an equivalent frequency
magnitude spectrum and, as determined experimentally, an identical sound. The graph below
shows this happen.
Figure 32-comparison of original signal and spectra with a signal derived from only the magnitude portion of the spectra
The new signal is 1-1, which eliminates the need for phase shifts. A single polynomial can be
shown to accurately describe the relationship from input to output. These new waveforms were
also fairly frequency-independent. Not completely, of course, but using a single waveform was a
decent approximation to the entire spectrum.
A new problem arose, however, which was that the waveforms were very amplitude dependent.
There was no single curve fit that could describe the distortion occurring at amplitude 0.5 and
1.0, as shown in the graph below.
Dave Anderson, Sean Byers Page 24
Figure 33- Input-Output relationships for the Champ at 2 different amplitudes, showing the amplitude dependency of the
fits
This anomaly occurs because the waveform that matches the sound of the original has a roll off
(saturation) on one side and a sharp peak on the other. Every waveform requiring a sharp peak
will need its own polynomial, which occurs at all amplitudes.
The work now involved coming up with some sort of dynamic range detection to tailor fit the
polynomial to the input amplitude. This was very effective in a post-processing algorithm but
Simulink was not able to process the information in real-time, so another solution had to be
found.
Taking inspiration from amplifier output stages, I purposely clipped the signal to force a
maximum amplitude and low-pass filtered what I got afterwards. The graphs below show this
transformation.
Dave Anderson, Sean Byers Page 25
Figure 34 - original signal, signal with roll-off, filtered roll-off signal
In this fashion the number of polynomials needed can be reduced. In fact, one polynomial now
fairly accurately approximates the distortion in the original signals.
The final block diagram for the Champ approximation is shown below.
Figure 35 - final block diagram for real-time processing
A problem we encountered with the processing is that there was a significant delay between what
was played and what came out of our algorithm. This was either due to the time it took to process
the information or due to the way Matlab interacted with the computer to obtain audio data. The
amount of delay between input and output that is audible and will affect instrumentation is
around 100ms [5]. Our FIR filters had a maximum of 1ms delay processing due to the inherent
delay in FIR filtering. We knew that this was not the cause of our delay. The decision was made
at this point to move away from modeling in Matlab and into the Max audio software from
Cycling ’74, a real-time audio algorithm development environment.
Dave Anderson, Sean Byers Page 26
Graphical User Interface (GUI) for Simulink A problem that we encountered with creating a software representation of a physical amplifier
was a way to change its settings as if it were built into hardware. A way to do this is to create
what is called a graphical user interface (GUI). With a GUI the user can change explicit settings
to get a desired output. This also gives the user a quick and easy to understand way to
manipulate a complicated program. With this goal in mind, we created a GUI that had main
features that a hardware device would include.
Since we were using Matlab’s Simulink, we had to create a GUI that would interface with it.
The best thing to do was to create a Matlab GUI since it has built in methods to enable the
function of GUIs. In order to create a GUI a basic layout of the interface has to be created which
can be seen below in Figure 36. This shows how a GUI is mapped out for the user to see.
Figure 36 - Graphical User Interface for Simulink Model
With this interface mapped out for the user’s benefit, it is still nothing more than a picture.
While the picture may seem basic, it is intended for exactly that reason. People don’t like it
when the device they are trying to control is hard to understand. That is why things like sliders,
pushbuttons, and checkboxes are distinct. Basic interfaces are a required design when dealing
with the public. While this sounds condescending, it is not because it is meant as a basic
functioning program. Programs that have higher levels of complexity require complex designs,
but with our design, we want the public to be able to take one look at the interface and
understand its functions.
Dave Anderson, Sean Byers Page 27
In order to give the picture in Figure 36 usability, we have to create parameters for the user to be
able to interface with it. We need to enable the “picture” to do different actions depending on
what the user manipulates with the keyboard or mouse and in what position they’re located. This
means that the program has to understand different parameters based on the keyboard or mouse
from the user. This does not mean you have to account for the different types of keyboards and
mice used, but instead their location and what is being typed.
The text that is mapped throughout the GUI has no function besides letting the user know what
the function is near its location. The boxes on the right-hand side of the GUI are meant to be
pushbuttons that a user can click to enable. The “Start Simulation” button will change to “Stop
Simulation” after it is clicked to let the user know that it is now running the simulation. Also,
the sliders on the GUI are meant to update the boxes below them labeled with “##” depending on
their value. The value in those boxes also has to change the slider functions to that correct
position depending on the number typed in.
Creating the simulation of the buttons would be a pain to create from scratch, because the person
creating the GUI would have to take into account that when someone clicks a button it should
look like it is being pushed in when clicked. Otherwise, the user wouldn’t know if the
pushbutton was pushed and would likely click it again. This is a problem because if the function
of the pushbutton was complex it could easily be called again and crash the program if it was
required to do a lot. Luckily, Matlab has built in functions for how the sliders, pushbuttons, and
checkboxes function so they do not have to manually be programmed.
Along with the interface being able to change itself depending on what is executed, it has to be
able to manipulate the actual Simulink model that was created. In order to do this, code was
written to change different “Gain” blocks in Simulink to achieve treble, bass, volume, gain, and
bypass/champ configuration. The main idea is shown in Figure 37 and Figure 38, which show
with colored boxes what is occurring in the model and the GUI respectively.
Figure 37 - Simulink Model Identifying key GUI Functions
Dave Anderson, Sean Byers Page 28
Figure 38 - GUI Identifying key Simulink Functions
The treble and bass sliders were implemented by taking the signal that was inputted from the
guitar and split into two different sub-bands depending on their frequency. The frequency
overlapping occurred at 1500Hz, because even though the frequencies go up to around 12kHz,
the bass is considered to be lower frequencies than just the half-way point of 6kHz. When the
two signals are split up, if the original sound without any changes is desired, the treble and bass
will both be set to one. If a different output is desired they can be changed with a range of zero
to one.
The gain is the amount the signal is amplified after it is inputted, and the volume is gain of the
signal right before it is outputted to the speakers. This difference is important, because the gain
allows the signal to be amplified very high, and get a high distortion while the volume simply
changes how soft or loud it is played. The volume can change from zero to ten and the gain can
change from zero to one hundred.
The “Champ Configuration” checkbox allows the user to play the sound that is produced from
the guitar and directly output it to the speaker, or have our model manipulate the guitar signal
and be able to change amplification, treble, and bass. This is done by simultaneously changing
two blocks (one from on to off and the other from off to on), this way the signal can only travel
through one path like a switch.
The coding for the GUI is shown in Appendix D.
Dave Anderson, Sean Byers Page 29
Chapter V
Conclusions and Future Work We are very satisfied with the results but there is undoubtedly more work that can be done on the
data. There is no simple way to recreate the signals we saw from the Champ amplifier, because it
is a nonlinear system that phase shifts its harmonics in a frequency-varying way. This means that
there are many different generalizations that can be made for the data and various optimization
techniques. What the ultimate goal of a project such as this is, though, is whether or not the
model sounds good.
As soon as the model fully works in real time, it would be fairly interesting to optimize it further,
perhaps using a sub band variation of the final model we derived and conduct a blind study with
a group of listeners and a real Champ amplifier. We are very confident that the sound can be
accurately represented using a variation of our model, but it is not clear which variation will
sound the best to a human ear.
The group learned quite a bit from this project, both analog and digital. We learned signal
analysis methods that enabled us to separate useful information from a sea of static and also how
amplifiers are created and what components create the “analog” sound. This project was a unique
and educational opportunity to combine passions with academics, and it has inspired us to
continue investigations in audio.
Dave Anderson, Sean Byers Page 30
References [1] J. Pakarinen and M. Karjalainen, "Enhanced Wave Digital Triode Model for Real-Time Tube
Amplifier Emulation," Dept. of Signal Processing and Acoustics, Helsinki University of
Technology, Helsinki, Finland, Digital Object Identifier 10.1109/TASL.2009.2033306, Apr.
2010.
[2] J. Pakarinen and D. T. Yeh, "A Review of Digital Techniques for Modeling Vacuum-Tube
Guitar Amplifiers," Dept. of Signal Processing and Acoustics, Helsinki University of
Technology, Helsinki, Finland, Center for Computer Research in Music and Acoustics, Stanford
University, Palo Alto, CA, Computer Music Journal, 33:2, pp. 85–100, Summer 2009.
[3] J. Pakarinen and M. Karjalainen, "WAVE DIGITAL SIMULATION OF A VACUUM-
TUBE AMPLIFIER," Dept. of Signal Processing and Acoustics, Helsinki University of
Technology, Helsinki, Finland, Rep. 142440469X, 2006.
[4] J. Smith, “Spectral Audio Signal Processing,” Center for Computer Research in Music and
Acoustics, Stanford University, Dec. 2011
[5] S. Cheshire, “Latency and the Quest for Interactivity,” Dept. of Computer Science, Stanford
University, Nov. 1996.
Dave Anderson, Sean Byers Page 31
Bibliography [1] U. Zolzer, Digital Audio Signal Processing, Hamburg, Germany: Wiley, 2008.
Dave Anderson, Sean Byers Page 32
Appendix A: Abbreviations DFT: Discrete Fourier Transform
FFT: Fast Fourier Transform
FIR: Finite Impulse Response
WDF: Wave Digital Filter
Dave Anderson, Sean Byers Page 33
Appendix B: Budget Event Money Spent/Received Budget Balance Beginning of Semester $300 $300 Donation from Agilent $100 $400 Behringer TM300 pedal ($26) $374 LCD Panel ($4) $370 Studio Time ($200) $170 Roland Duo-Capture ($90) $80 Extension Cable ($15) $65 Surge Protector ($7) $58 Impedance Matching Transformer ($15) $43
Table 1 - Budget Balance after spring 2012 Semester
In total, $357 of $400 was spent on the project.
Dave Anderson, Sean Byers Page 34
Appendix C: Letters
Letter 1: Sponsorship proposal to Agilent Technologies DSP for Audio Signals:
A digital modeling system for a wide variety of tube amp sounds.
October 15, 2011
Dan Ferguson
Agilent Corporation
Dear Mr. Ferguson,
I want to thank you in advance for considering sponsorship of student-originated Senior Design
projects at Colorado State University. It takes a lot of work and motivation to design a project
and learn to be your own boss, all the way from concept to implementation. We would like to
introduce our project idea and team members to you before beginning to discuss our proposed
budget.
Our project concept is the creation of a digital modeling system for old tube guitar amps. Ask
any guitar aficionado: tube amps have cleaner sound and warmer tone than solid-state amps.
Unfortunately, many of the original tone machines are either too expensive or too rare to make
them of much use to anyone who wants to play them live. Software and Hardware
implementations of modeling systems like this are common but most of them are very limited in
their use. Every tube amp sounds different, and so every modeling algorithm will produce a
different sound. Our idea is to work with recording studios to record an old tube amp, the Fender
Champ, that has never had a specific model made for it. We will also look at some algorithms
already in place in commercial hardware, in order to find general differences between those and
a real tube amp. Using these comparisons, we will create hardware that will simulate a wide
variety of tube sounds and have use in both an analog (eg. Live blues concert) and digital (eg.
Sampling software) worlds.
Our team includes Dave Anderson, Sean Byers, and professor Mahmood Azimi. Dave is an
electrical engineering student with a strong interest in computer programming, signal processing
and, above all, music. Sean Byers is also an electrical engineering student with an interest in
analog electronics. Professor Azimi works with signal processing at CSU.
Dave Anderson, Sean Byers Page 35
Type of expense Hourly Cost # of hours Total Cost
Studio Time $50 12-15 $600-750
Behringer TM300 pedal N/A N/A $26
Hardware Design and
Components
N/A N/A $400
Total Cost $1026-$1176
Money Raised so far $400
Money required $626-776
Table 2 - Anticipated Budget Required for the Full Year
We would like to request a $500 sponsorship from Agilent for the full academic year. We would
love to see our project fully realized, and with primarily student funding this just is not possible.
If you choose to sponsor our team and project, we thank you very much in advance for such an
exciting opportunity.
Letter 2: Response from Agilent Technologies Hi Dave, Thank you for submitting your proposal. After reviewing all the project submissions,
I’ve decided to award $100 to your team from Agilent Technologies. I will work with Olivera to
get those funds transferred to your project team, and we’ll keep you informed of that process. I
would also like to give some feedback to you and your project mates regarding the proposal:·
First of all, I enjoy any project that combines your engineering studies with personal
interests/passions. Your project seems to be a great example of that – modern implementation of
old school guitar amplifiers! Very interesting…· I know the time frame to create your
proposal was short, and I understand that creating a 1-2 page proposal is also tough. Having said
this, though, I have these comments: I’d like to see more about timelines and milestones for
your project. I have a high-level understanding, but would like to have seen a project schedule
that shows how you’ll converge towards your desired final outcome. With all the tools available
these days for creating documents, I’d like to have seen a more “visually attractive” proposal –
one that made use of color, or diagrams, or pictures, etc., to help convey the information. You
did include a table for your budget – that was important. But I’d like to have had more
information about the actual project, conveyed in an engaging format. You introduce your team,
which is important. I’d like to have known more about the specific roles of each member – what
subsystems each was involved with, what each person was accountable for, etc. This could have
been easily incorporated in a project milestone table, for example. In particular, I’d like to have
understood more about the actual “comparative study” you mention – a study to compare the
recorded sounds of the actual Fender Champ to the fabricated sounds of the algorithmic
implementation. That would seem to be very intensive – so many sounds to compare, so many
Dave Anderson, Sean Byers Page 36
combinations of sounds, etc. This seems to be a key element in your project, so would like to
have seen a little bit more information about that stage. Again, thanks for submitting your project
for funding. It seems a very interesting project, and I’ll look forward to hearing more about it as
you approach E-Days. Also, note that Agilent will have another funding round offered in the
Spring – it will be a bit more formal, but there will be another chance for you and your team to
apply for additional funding. Stay tuned… Dan Ferguson
Electronics Manufacturing Test
Americas Service & Support Manager
Agilent Technologies
(970) 679-3641
Letter 3: Thank you to Agilent Technologies Hi Dan,
Thank you very much for the award! We really appreciate not only the money but the
recognition of our project and of our hard work.
We would also like to thank you for the feedback on our proposal. We will undoubtedly be
writing more of these as the year goes on and it really helps us.
Thank you again. If you have any questions about the project or us please do not hesitate to let us
know. We will be sure to acknowledge this contribution on our website and in our
documentation.
Dave Anderson and Sean Byers
Dave Anderson, Sean Byers Page 37
Appendix D: GUI Code function varargout = ChampGUI(varargin)
% CHAMPGUI MATLAB code for ChampGUI.fig
% CHAMPGUI, by itself, creates a new CHAMPGUI or raises the existing
% singleton*.
%
% H = CHAMPGUI returns the handle to a new CHAMPGUI or the handle to
% the existing singleton*.
%
% CHAMPGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CHAMPGUI.M with the given input arguments.
%
% CHAMPGUI('Property','Value',...) creates a new CHAMPGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ChampGUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ChampGUI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help ChampGUI
% Last Modified by GUIDE v2.5 09-Apr-2012 21:23:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ChampGUI_OpeningFcn, ...
'gui_OutputFcn', @ChampGUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before ChampGUI is made visible.
function ChampGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to ChampGUI (see VARARGIN)
Dave Anderson, Sean Byers Page 38
% Choose default command line output for ChampGUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ChampGUI wait for user response (see UIRESUME)
% uiwait(handles.TUBEEditor);
% Get the value of the treble edit box and synch the GUI
value = get_param([bdroot '/Gain1'],'Gain');
set(handles.eTreble,'String',value);
% Set the treble slider and synch the GUI
NewValue = str2double(value);
set(handles.sTreble,'Value',NewValue);
% Get the value of the bass edit box and synch the GUI
value = get_param([bdroot '/Gain2'],'Gain');
set(handles.eBass,'String',value);
% Set the bass slider and synch the GUI
NewValue = str2double(value);
set(handles.sBass,'Value',NewValue);
% Get the value of the volume edit box and synch the GUI
value = get_param([bdroot '/Gain3'],'Gain');
set(handles.eVolume,'String',value);
% Set the volume slider and synch the GUI
NewValue = str2double(value);
set(handles.sVolume,'Value',NewValue);
% Get the value of the gain edit box and synch the GUI
value = get_param([bdroot '/Gain'],'Gain');
set(handles.eGain,'String',value);
% Set the gain slider and synch the GUI
NewValue = str2double(value);
set(handles.sGain,'Value',NewValue);
% Get the value of the gain to determine bypass status with GUI
set(handles.cbChamp,'Value',0);
set_param([bdroot '/Gain6'],'Gain',num2str(0));
set_param([bdroot '/Gain7'],'Gain',num2str(1));
% Assign gui, startstop, switch, and gain handles to the base workspace
assignin('base','testbench_handles',handles)
assignin('base','startstopBypass_hObject',handles.pbStart)
assignin('base','editTreble_hObject',handles.eTreble)
assignin('base','editBass_hObject',handles.eBass)
assignin('base','editGain_hObject',handles.eGain)
% --- Outputs from this function are returned to the command line.
function varargout = ChampGUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Dave Anderson, Sean Byers Page 39
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pbBehringer.
function pbBehringer_Callback(hObject, eventdata, handles)
% hObject handle to pbBehringer (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[y Fs]=wavread('beep.wav');
sound(y, Fs);
% --- Executes on button press in pbMarshall.
function pbMarshall_Callback(hObject, eventdata, handles)
% hObject handle to pbMarshall (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[y Fs]=wavread('beep.wav');
sound(y, Fs);
% --- Executes on button press in pbChamp.
function pbChamp_Callback(hObject, eventdata, handles)
% hObject handle to pbChamp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[y Fs]=wavread('beep.wav');
sound(y, Fs);
% --- Executes on button press in pbStart.
function pbStart_Callback(hObject, eventdata, handles)
% hObject handle to pbStart (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mystring = get(hObject,'String');
status = get_param(bdroot,'simulationstatus');
if strcmp(mystring,'Start Simulation')
% Check the status of the simulation and start it if it's stopped
if strcmp(status,'stopped')
set_param(bdroot,'simulationcommand','start')
end
% Update the string on the pushbutton
set(handles.pbStart,'String','Stop Simulation')
elseif strcmp(mystring,'Stop Simulation')
% Check the status of the simulation and stop it if it's running
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Stop')
Dave Anderson, Sean Byers Page 40
end
% Update the string on the pushbutton
set(handles.pbStart,'String','Start Simulation')
else
warning('Unrecognized string for pbByConfig') %#ok<WNTAG>
end
% --- Executes on slider movement.
function sTreble_Callback(hObject, eventdata, handles)
% hObject handle to sTreble (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% Get the value of the gain slider and determine what the gain value should be
NewValue = get(hObject,'Value');
value = num2str(NewValue);
% Update the model's gain value
set_param([bdroot '/Gain1'],'Gain',value)
% Set the value of the gain edit box
set(handles.eTreble,'String',value);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function sTreble_CreateFcn(hObject, eventdata, handles)
% hObject handle to sTreble (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function sBass_Callback(hObject, eventdata, handles)
% hObject handle to sBass (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
Dave Anderson, Sean Byers Page 41
% Get the value of the gain slider and determine what the gain value should be
NewValue = get(hObject,'Value');
value = num2str(NewValue);
% Update the model's gain value
set_param([bdroot '/Gain2'],'Gain',value)
% Set the value of the gain edit box
set(handles.eBass,'String',value);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function sBass_CreateFcn(hObject, eventdata, handles)
% hObject handle to sBass (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function sGain_Callback(hObject, eventdata, handles)
% hObject handle to sGain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% Get the value of the gain slider and determine what the gain value should be
NewValue = get(hObject,'Value');
value = num2str(NewValue);
% Update the model's gain value
set_param([bdroot '/Gain'],'Gain',value)
% Set the value of the gain edit box
set(handles.eGain,'String',value);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
Dave Anderson, Sean Byers Page 42
function sGain_CreateFcn(hObject, eventdata, handles)
% hObject handle to sGain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function sVolume_Callback(hObject, eventdata, handles)
% hObject handle to sVolume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
NewValue = get(hObject,'Value');
value = num2str(NewValue);
% Update the model's gain value
set_param([bdroot '/Gain3'],'Gain',value)
% Set the value of the gain edit box
set(handles.eVolume,'String',value);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function sVolume_CreateFcn(hObject, eventdata, handles)
% hObject handle to sVolume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function eTreble_Callback(hObject, eventdata, handles)
% hObject handle to eTreble (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of eTreble as text
% str2double(get(hObject,'String')) returns contents of eTreble as a double
Dave Anderson, Sean Byers Page 43
value = get(hObject,'String');
NewValue = str2double(value);
% Update the model's gain value
set_param([bdroot '/Gain1'],'Gain',value)
% Set the value of the gain slider
set(handles.sTreble,'Value',NewValue);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function eTreble_CreateFcn(hObject, eventdata, handles)
% hObject handle to eTreble (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function eBass_Callback(hObject, eventdata, handles)
% hObject handle to eBass (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of eBass as text
% str2double(get(hObject,'String')) returns contents of eBass as a double
value = get(hObject,'String');
NewValue = str2double(value);
% Update the model's gain value
set_param([bdroot '/Gain2'],'Gain',value)
% Set the value of the gain slider
set(handles.sBass,'Value',NewValue);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function eBass_CreateFcn(hObject, eventdata, handles)
% hObject handle to eBass (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
Dave Anderson, Sean Byers Page 44
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function eGain_Callback(hObject, eventdata, handles)
% hObject handle to eGain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of eGain as text
% str2double(get(hObject,'String')) returns contents of eGain as a double
value = get(hObject,'String');
NewValue = str2double(value);
% Update the model's gain value
set_param([bdroot '/Gain'],'Gain',value)
% Set the value of the gain slider
set(handles.sGain,'Value',NewValue);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function eGain_CreateFcn(hObject, eventdata, handles)
% hObject handle to eGain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function eVolume_Callback(hObject, eventdata, handles)
% hObject handle to eVolume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of eVolume as text
% str2double(get(hObject,'String')) returns contents of eVolume as a double
value = get(hObject,'String');
Dave Anderson, Sean Byers Page 45
NewValue = str2double(value);
% Update the model's gain value
set_param([bdroot '/Gain3'],'Gain',value)
% Set the value of the gain slider
set(handles.sVolume,'Value',NewValue);
% Update simulation if the model is running
status = get_param(bdroot,'simulationstatus');
if strcmp(status,'running')
set_param(bdroot, 'SimulationCommand', 'Update')
end
% --- Executes during object creation, after setting all properties.
function eVolume_CreateFcn(hObject, eventdata, handles)
% hObject handle to eVolume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in cbChamp.
function cbChamp_Callback(hObject, eventdata, handles)
% hObject handle to cbChamp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of cbChamp
% Update gain blocks to change from bypass to champ or vice versa
value = get(hObject,'Value');
if value == 1
set_param([bdroot '/Gain6'],'Gain',num2str(0));
set_param([bdroot '/Gain7'],'Gain',num2str(1));
else
set_param([bdroot '/Gain6'],'Gain',num2str(1));
set_param([bdroot '/Gain7'],'Gain',num2str(0));
end
% --- Executes during object creation, after setting all properties.
function cbChamp_CreateFcn(hObject, eventdata, handles)
% hObject handle to cbChamp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
Dave Anderson, Sean Byers Page 46
Acknowledgements We would like to thank:
Dr. Mahmood R. Azimi-Sadjadi for formulating the original idea for this project.
Dr. Ali Pezeshki for advising this project and helping us with mathematical signal processing.
Olivera Notaros for leading the senior design program in the college of Electrical and Computer
Engineering at CSU.
Chuck Wilson for recording us in his studio, lending us his many years of audio expertise and
suggestions, finding a 1960 Fender Champ for us to record and giving us a huge discount on
recording costs.
Agilent Technologies for supporting our project with a $100 donation.
The ECE department for giving us $300 of funding for our project.
Steven Sandler for allowing us to borrow and experiment on his Champ amplifier.