# Phase information

I am quite new to MATLAB and I am currently trying to do some Fourier synthesis. In order to do the Fourier synthesis I need the phase information of the harmonics as a fraction of the period of the fundamental frequency. I am a bit lost on how to do this. Also I am trying to do a Fourier synthesis using the equation

$$y[i] = y[i-1] + p[j]\cdot \cos\left[2\pi f[j]\left(t- \dfrac{\gamma[j]}{f[1]}\right)\right]$$

Is this correct?

• Can you tell us more about source of this equation? – jojek May 13 '14 at 15:16
• Hi I came across it on a music website where fourier synthesis was being used to recreate a wav file. I think it is the real part of the fourier series – BranH May 13 '14 at 15:33
• Can we have a link to that site? Because this is definitely not an equation for Fourier Transform. It more looks like some kind of time-variant filter. – jojek May 13 '14 at 15:43
• amath.colorado.edu/pub/matlab/music – BranH May 13 '14 at 15:51
• Oh thank you of ryour feedback I didnt realise How would I go about doing a fourier synthesis of a signal given I knew the amplitude of the fundamental frequency and amplitudes of the harmonics. Any advice is greatly appreciated – BranH May 13 '14 at 15:52

Well, you task is basically about synthesising some given sounds - this is very broad question. The function you are using: synthesize_fp.m takes the arguments you need to play with, but two most important ones are:

• f - vector of frequencies that you must specify. If you provide only one, then you will obtain sinusoid. Adding more frequencies will produce more complicated waveforms. You can refer to this site for some fundamental waveforms: Geometric Waveforms. For musical synthesis widely used is sawtooth wave, so you can start with it. Please notice that also very important are:

• p - amplitudes for each frequency you are providing. Changing them will affect your sound very much. Please notice that rectangular and sawtooth wave differ only with amplitudes of their harmonics.

Last parameter is gamma, that defines the phase shift with respect to fundamental frequency. Personally I suggest you to set it to zeros on the beginning. This shouldn't do very much difference when you are trying to play with this synthesis task. By doing that your equation becomes simply sum of the cosines: $\cos\left(2\pi f[j]t \right)$. There is really no need to bother with phase for now.

Mostly you would want to mimic natural spectral content of the instruments. Therefore you might want to download some instrument recordings (flute/pipe organ), analyse their spectrum and feed a given harmonics with their amplitudes to your script.

• Hi well my signal is not sound is if for gestures using a motion sensor but I want to recreate my signal by fourier synthesis so that I have a more exact one. My other option is cleaning up my signal for noise. I used the pwelch to do this in matlab but now I dont know how to get back to the time domain. It is easier with fft cos you simply use ifft. How do you do this for a signal that has been put through pwelch? – BranH May 13 '14 at 16:46
• @BranH: Now I totally do not understand why you are using these scripts for music ;) If you have your PSD estimate and want to go back to the time domain representation, then it is impossible. First of all you've averaged many segments, and secondly you probably lost your phase information. I wonder how do you de-noise your signal with using pwelch? Can you elaborate your task more in your question and state clearly what do you want to do. Otherwise we will end up again with synthesis of ocarina. – jojek May 13 '14 at 16:52
• I have a noisy signal from a motion sensor and I wish to denoise it and turn it into an 'ideal'. I have read that sometimes due to averaging the Pwelch will produce a less noisy spectrum. I did pwelch and so i could easily pick out the fundamental frequency and harmonics. I would like to use fourier synthesis to get a singal in my time domain that is more 'ideal' Although these methods are for music I thought they may work for me too as it is basically something similar to what I want to do. – BranH May 13 '14 at 16:56
• @BranH: It's impossible to do it that way. Averaging of PSD will indeed produce better separation between noise and signal itself. Although this is procedure used for spectral analysis, not for de-noising of your signal! For your task you need different techniques. You can start with smoothing (Moving Average / Savitzky-Golay), but I suggest to read: link1, link2. – jojek May 13 '14 at 17:02
• What about foruier synthesis if I know my fundamental frequency and harmonics? The only thing I am stuck with is the forumla as most things seem to deal with square or saw waves – BranH May 13 '14 at 17:46