LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

making guitar distortion

I'm trying to create a VI that will make a distortion from a guitar signal. Any suggestion on how to make it? Im using the acquire sound vi to obtain the signal then trying to process it and outputs the distorted signal. I will post my VI as soon as possible. its not yet done

0 Kudos
Message 1 of 16
(4,183 Views)

@TedMosby wrote:

I'm trying to create a VI that will make a distortion from a guitar signal. Any suggestion on how to make it? Im using the acquire sound vi to obtain the signal then trying to process it and outputs the distorted signal. I will post my VI as soon as possible. its not yet done


In it's "purest" sense, guitar distortion is simply an overdriven signal.  You'll have to simulate clipping on your signal - that is, squaring up the sine waves.  Anything over (or under it's opposite) a certain value will be coerced to that value, simulating the limits of the amplifier.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 16
(4,158 Views)

If you want to simulate tube-driven distortion, you want something a bit softer than a hard clip, which will sound very harsh due to the large high frequency content.  You can do this by creating a "response curve" for your signal.  At lower levels, it is linear; at higher levels, it approaches an asymptotic value.  This clips, but gives you rounded edges instead of square edges.  There are lots of possible functions, so experiment until you find something you like.  If you need help with this, let us know.

 

Good luck!  Sounds like fun.

0 Kudos
Message 3 of 16
(4,117 Views)

hi guys, thanks for the reply.. I manage to create a simple distortion using the Bandpass filter VI.. It sounded fine, I think I'll stick with it.. But I'm still experimenting 🙂

0 Kudos
Message 4 of 16
(4,066 Views)

If you like the sound, then OK.  But be aware that a bandpass filter normally does NOT introduce any distortion. Distortion requires the signal to be passed through a nonlinearity.

 

The spectrum of a distorted signal will contain components which do not exist in the undistorted input.  In the simplest case the input would consist of one sine wave at a constant frequency. With a bandpass filter the output will still be one sine wave at the same frequency. Its amplitude (and phase) will be changed depending on where the frequency is with respect to the passband of the filter. With a non-linear system the output will contain harmonics and possibly a DC component in addition to the original frequency. The amplitudes and phases of all the components, including the original may be changed.  If the original signal contains several frequencies (as when you play a chord), the non-linear system will produce harmonics of all the frequencies as well as combinations of sums and differences of the input frequencies.

 

Lynn

0 Kudos
Message 5 of 16
(4,046 Views)

im sorry I kinda lost you there can you explain in a different way? In terms of what to do in LabVIEW perhaps, I'm very much grateful for the replies 🙂

0 Kudos
Message 6 of 16
(4,025 Views)

Well, I will try.

 

I have created a little VI which shows some of the difference between filtering and distortion.   A filter is like a tone control or an equalizer on an audio system. The simple tone control cuts or boosts bass or treble.  No tones which were not present in the original signal will be present in the output, although some or all the tones may have been changed in amplitude (and phase) relative to other tones. Distortion is caused by a non-linearity such as overdriving a speaker. You get new tones which were not present in the original. In an audio system this may sound like buzzing, or scratching or may be very harsh harmonics and other frequencies.   The ear/brain system can detect some knids of distortion at fairly low levels but is not very good at defining exactly what changed.

 

The VI attached generates a sine wave at 10 Hz with 10 cycles. The VI contains an event structure set to respond to changes in the controls to the right of the graphs. When it first starts it will show the original signal only. The upper graph has the time domain signal and the lower graph has the magnitude of the frequency spectrum. You may want to set the scales on the spectrum graph with Autoscale off so you can adjust the scales to see the portions of interest.

 

The filter is a simple low pass filter. The cutoff frequency can be changed to various values above and below the nominal 10 signal frequency. Note that except for a transient on the first cycle the filter output is a sine wave at the same frequency as the input but with different amplitude and phase.

 

The distortion uses a clipper. Any values instaneously greater than the upper limit or lower than the lower limit are coerced to those limits. This is a hard clipper. As Dr. Gray suggested you probably do not want that for your guitar. You can make other distorters by using almost any non-linear function.

 

I saved the VI back to LV 2009 but did not test it in earlier versions.  There were no warnings so it should work.

 

Lynn

0 Kudos
Message 7 of 16
(4,007 Views)

Distortion is the effect of the amplifier not being able to increase the signal enough, it's hitting the roof. A simple solution is to amplify your signal until this happens (assuming you output through sound card, as a theoretical signal it wont happen). As mentioned it has the effect of cutting signals over a certain value which can be achieved with e.g. "in range and coerce".

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 16
(3,986 Views)

Hi, I'm back again. Sorry for the late reply. I'm now trying the in range and coerce function but sadly im getting a rough time converting the dynamic data. I'm now using a DAQ hardware to acquire the guitar signal. I tried converting your example and created a simple VI using the DAQ assistant. But I gut stuck at the part where the input data is from the DAQ. I manage to run the VI but i did not hear any sound. I think my process of converting data is way off. Can you help me? My main problem is converting data types from the DAQ and converting in back to a waveform. I looked at the waveform graphs and sadly there's no output at the output graph. 

0 Kudos
Message 9 of 16
(3,881 Views)

Let's separate the problems. Look at the DAQ examples. Find an analog input example which displays the data on a graph.  Get that running with your guitar.  Even if it is not what you really want, it will verify that you have all the hardware connected properly and that the hardware and software are communicating.

 

Then open the block diagram of the example and look to see how they did the acquisition.  The examples generally do not use the DAQ Assistant and its associated (evil) Dynamic Data Type.  The DAQmx Read VIs allow you to select Waveforms or arrays as the output data types.

 

Lynn

0 Kudos
Message 10 of 16
(3,868 Views)