Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Wavetable Synthesis question

Status
Not open for further replies.

vogels

New Member
Hi everyone, I'm new here. I've been researching the use of wave-table synthesis for part of a senior design project. Conceptually it is simple. I know for efficiency to store the tables in memory. Visually I picture a wave-table as a 2 dimensional gridded plane, where different pitches can be achieved by incrementing through the table values at different speeds. I would appreciate some clarification on what exactly is in the wave table. I want to generate complex waves composed of a fundamental freq and harmonic freq's. Is it custom to read from several wave-tables at once and sum the output? Or read the different components of the tone from one wave table?
Any input would be greatly appreciated,
Thanks
 
I would think you just need one sine-wave table of radian (or degree) position versus amplitude. The number of entries depends upon the precision (number of bits) you need. For a sine-wave you just cycle through all the numbers in sequence with the sample rate determining the output frequency.

If you want a sine-wave with harmonics then you just need to determine the phase, frequency, and amplitude of the harmonics, read them from the table at the appropriate time, and add them to the output.
 
There is no custom at all, it depends entirely on what you need to do. If you need to control each of the tones separately then yes you'll need to mix several different signals, if you want the core frequency and harmonics to change as a whole then you simple write the wavetable data of the desired signal and step through it at the required rate. A wavetable is nothing more than raw data stepped through at a desired rate it can be a sine wave table or any complex signal, I think you might be overthinking it, it's really very simple.

If you could explain in greater detail the type of signal you're trying to generate and what components of it need to be changeable it will help in suggesting what to do.
 
Hi,

If you have to generate multiple frequencies that are harmonics then one way would be to use one single table and read the values you need, perform the required additions, then store the sequence into memory. This way when you go to generate the wave you'll be reading from one memory only and that should be pretty fast. You'll need memory to store at least one cycle of the fundamental. This way you dont have to do much work in real time, just a single table lookup.
Alternately you'll have to keep pointers and increment values for each wave and use the pointers to access the lookup table, adding the results in real time. This of course wont be nearly as fast.
 
Last edited:
The signal is from an optical guitar pickup we've built/building. I'd like to envalope filter the amplitude for dampenning in real time. I think you guys have cleared up the majority of my confusion, my programming experience is in VHDL and I've been having trouble imagining how a C++ program could read out the different freq components from a WT at one time. However it seems like I could either read them out and add them storing the results in a buffer for output, or the perhaps each value of the sample in the table could contain it's fourier components. Hmm, thanks. I really want to get going on the program, I've downloaded TI's trial code compressor studio, once it's working I'll start trying to optimize it.
 
What you're doing is actively processing a waveform filtering it and generating your own components, this has NOTHING to do with wave-table synthesis whatsoever.
 
I was planing one sampling one cycle of the input signal and using the value to point to the correct table/read rate. The envelope filtering is to be preformed on output of the wavetables to resemble a stringed instrument. Perhaps there is a better way I should do this, but I don't see how it does not relate to wavetable synthesis?
 
Because you're real time processing an active instrument sample, or are you trying to detect the tone the guitar is playing and play back the wavetable at the same frequency? What you're doing is not very clear.
 
Sorry, I wasn't being very clear. I'm trying to detect the tone of the guitar and playback the wave table at that frequency. Initially I was going to make a MIDI pickup, after talking with my professor I decided to make a synthesizer type pick up. He suggested I look into how digital keyboards generate tones. Wavetable synthesis seems like the most feasible way for me to do this with a guitar. What I want to work toward is designing a system for customizing/creating tones, I'm thinking this should be a good introductory project.
Thanks, any input would be valued.
 
Sorry, I wasn't being very clear. I'm trying to detect the tone of the guitar and playback the wave table at that frequency. Initially I was going to make a MIDI pickup, after talking with my professor I decided to make a synthesizer type pick up. He suggested I look into how digital keyboards generate tones. Wavetable synthesis seems like the most feasible way for me to do this with a guitar.

So what I think you're doing is this (please correct me if I'm wrong):

You're using the input signal from the guitar simply as a time base, or a frequency reference. You're not really interested in the waveform of that signal. Once you've determined the frequency of the guitar note (how? I'd be curious to know), you're going to generate your own signal from a wavetable at that same frequency, and then perhaps do some other processing (envelope shaping, etc.) on your synthesized signal. Am I close?
 
Last edited:
vogels there are hordes of information available and even wavetable samples of virtually any instrument natural or un-natural that you could think of available easily from a simple Google search.

The part of your project that is complicated is recognizing the tone coming from the pickup with extremely low latency, without an extremely low latency frequency detector to start with it will be useless as a musical instrument and you have no place to start from.

So your core question has nothing to do with wave table synthesis itself, that's easy. The hard part is detecting the primary frequency or chosing a harmonic or bandpass range from the pickup that will be what will modulate the wave table signal.

Latency (audio) - Wikipedia, the free encyclopedia

Might help. Understanding what latency means in the processing portion of your project will be sink or swim for the practicality of it. If this will be purely post processing from a recorded performance the concern for latency is not a problem, it's very important if it's meant for live use.
 
The signal is from an optical guitar pickup we've built/building. I'd like to envalope filter the amplitude for dampenning in real time. I think you guys have cleared up the majority of my confusion, my programming experience is in VHDL and I've been having trouble imagining how a C++ program could read out the different freq components from a WT at one time. However it seems like I could either read them out and add them storing the results in a buffer for output, or the perhaps each value of the sample in the table could contain it's fourier components. Hmm, thanks. I really want to get going on the program, I've downloaded TI's trial code compressor studio, once it's working I'll start trying to optimize it.

Not an expert here, but if you've saved arbitrary waveforms in RAM as samples, and you read out those samples, D/A convert them, filter, amplify, etc, then the frequency components you want are simply a product of the original waveshape samples, and you specified that when you originally saved the waveform. If you want to mix/match frequencies to create a waveform "on the fly", then that's another whole ball of wax. It can be done either way, however.
 
Last edited:
Hmmm, i think i've heard this before :)

Hi,

If you have to generate multiple frequencies that are harmonics then one way would be to use one single table and read the values you need, perform the required additions, then store the sequence into memory. This way when you go to generate the wave you'll be reading from one memory only and that should be pretty fast. You'll need memory to store at least one cycle of the fundamental. This way you dont have to do much work in real time, just a single table lookup.
Alternately you'll have to keep pointers and increment values for each wave and use the pointers to access the lookup table, adding the results in real time. This of course wont be nearly as fast.
 
Thanks, yes carbonzit, that's correct. Although I wouldn't say I don't care about the original signal per-say. I'd like to 'process' each of the six strings individually and sum the output, in which case I think I may have to use a DSP chip. For determining the frequency I'm considering a few different methods right now.The first is, After the ADC:
the signal will be sampled and held=> then another sample and hold circuit begins while signal is processed=>an offset correction is computed on the first sample=> the zero crossing points are counted against a clock signal to find the cycle time.

I have been considering latency, thanks for the info. I'll post some more details later
 
Do you really need to process all this audio coming from the strings? It sounds like you want a digital guitar, so skip the strings and just tap the frets like they were a matrix keypad, all you'd need from the string itself then would be a basic amplitude signal. That'd be a few hundred times easier to process =)
 
Thanks, yes carbonzit, that's correct. Although I wouldn't say I don't care about the original signal per-say.

Usually spelled "per se", but never mind.

I'd like to 'process' each of the six strings individually [...]

So I'm curious as to some of the details. Are you trying to use a regular guitar (i.e., an actual playable instrument, as opposed to a digital phoney-baloney one)? Electric, with magnetic pickup? With a 6-channel pickup w/individual outputs?

BTW, your frequency-finding method sounds as if it might just work. Will be interesting to see your progress on this project.
 
Last edited:
I think I may have to use a DSP chip. For determining the frequency I'm considering a few different methods right now.The first is, After the ADC:

I have been considering latency, thanks for the info. I'll post some more details later

If you're working in FPGA technology, the DSP can be programmed into the device, and modern devices have fast multply/accumulate for this purpose. If you're working with a uP, the DSP can be realized programmatically. Another way is to just use a zero-crossing converter and counting for the frequency, and a seperate A/D for the Amplitude. That way you can get frequency and amplitude without needing DSP. Note that the FPGA can process each string simultaneously, while a DSP/Processor would process the strings sequentially.

Either way should be sufficiently low latency.
 
Last edited:
I am using an actual guitar, we've put together an optical pick up which has one photo-transistor per string. Yea, my instinct initially was to go for FPGA, I have a DEV board..hmm
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top