How to change the harmonics of a sinwave

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Change Harmonics
Click For Summary
To change the harmonics of a sine wave and achieve a more realistic sound, it's essential to understand the role of harmonics and their amplitudes in sound synthesis. The discussion highlights that simply adding harmonics can lead to a "boring" sound, as a pure sine wave lacks the complexity of real musical notes. Users are encouraged to experiment with different waveforms, such as square or sawtooth waves, and to consider using filters and modulation techniques to enrich the sound. Issues like clipping due to high amplitude and the importance of buffer length in relation to frequency are also discussed, emphasizing the need for a clean sine wave before adding complexity. Ultimately, achieving a more interesting sound requires a combination of proper synthesis techniques and an understanding of the underlying principles of sound generation.
  • #31
Baluncore said:
You seem blind to the fundamentals needed before processing sampled data. You question and doubt your computer hardware and FFT code, but you should not be leaping to conclusions and blaming others for the failure of your code implementation. You should be testing your code as you gradually increase the complexity until you are certain you understand the principles, it's capabilities and limitations.

You need to understand the difference between indexing and counting, along with the Fourier transform and spectral analysis. http://en.wikipedia.org/wiki/Frequency_spectrum#Spectrum_analysis

You then need to understand window functions. http://en.wikipedia.org/wiki/Window_function so you realize why you should analyse the FFT of full cycles, not partial cycles.

Without understanding the fundamentals and having a proven and stable code platform, you will be unable to progress. I'm afraid that you are so confused about what is relevant that you cannot answer our questions. That makes it very difficult to help you.
I answered all your questions... but I a new to this. The fft does seem to for work for most cases ... but it just seem to be too noisy which I do not understand. Also, about window functions, if you have a signal coming in and you do not know the Frequencies in the signal you can't really do a window function right ?
 
Engineering news on Phys.org
  • #32
btb4198 said:
Also, about window functions, if you have a signal coming in and you do not know the Frequencies in the signal you can't really do a window function right ?
Wrong.
 
  • #33
btb4198 said:
I answered all your questions... but I a new to this. The fft does seem to for work for most cases ... but it just seem to be too noisy which I do not understand. Also, about window functions, if you have a signal coming in and you do not know the Frequencies in the signal you can't really do a window function right ?
Why are you not taking his advice? You need to know far more about this than you seem to, in order to use a DFT process. Do you realize that the DFT assumes that the sequence you are analysing, actually repeats for ever? If you take an arbitrary number of samples from your signal then the result of a DFT will contain harmonics of the repeat rate, beating with the signal you have sampled. You are not in a position to complain that your FFT is 'broken' as you have no evidence that it is. You are just not using the tool correctly. You must learn more and stop complaining, I think.
 
  • #34
sophiecentaur said:
Why are you not taking his advice? You need to know far more about this than you seem to, in order to use a DFT process. Do you realize that the DFT assumes that the sequence you are analysing, actually repeats for ever? If you take an arbitrary number of samples from your signal then the result of a DFT will contain harmonics of the repeat rate, beating with the signal you have sampled. You are not in a position to complain that your FFT is 'broken' as you have no evidence that it is. You are just not using the tool correctly. You must learn more and stop complaining, I think.

I am looking into window functions. I watched a view you tube videos on them. From what I learned you zero out part of the signal, so when you do the FFT, you will have a complete cycle and not half a cycle nor part a cycle: This reduces leaking power into other bins. Am I right about this ?

What I do not understand is that when you zero out part of the signal you are changing it, and there for you are losing information, I would think that would be bad in communications... like cells phones they have DSP chips in them right ?

Also, using Audacity I played with the FFT and Hanning window function. I generate a pluck of middle C and with a sampling size of 16384 and Hanning window is seem to work good. not too noisy :

Untitled.png


right?
 
  • #35
If you are trying to analyses a "pluck" of middle C, you are not analysing a continuous waveform - the pluck is a transient and, by doing a DFT, you are assuming the pluck is repeated ad infinitum. Why would you want to do that? Surely the thing to do - to make sure you are getting the right result from what you are doing - is to produce a burst (widowed section) of pure sine wave at your wanted frequency and then check the DFT outcome is what you expect. One cannot run before one can walk. This is a topic that does not reveal much from a superficial approach.
 
  • #36
/sophiecentaur i was just looking at how hanning workes. Beside a pluck have more than one frequency in it. And it looked like it work, right ?
 
  • #38
Baluncore said:
I believe this thread displays a good example of the Dunning-Krugger effect.
http://en.wikipedia.org/wiki/Dunning–Kruger_effect

Dude, that is not cool. I never said, I was stilled or good at DSP. I have always said I am new to this. I have said that in all my threads. I do not believe that I know more that I really do.
I am just trying to learn.
 
  • #39
Ok the hanning window function seems to be working well.

however I do have two questions :

1) When I play the sine wave like sin(445) : there are two Frequencies but when I just put the values in an array and just went the array to the fft there are only one Frequency?
is it because when I am playing the sine wave, I am using two channels ?
so the two Frequencies i would get would be 445Hz and 445 * 2 = 890 Hz

2) are window functions used in cell phone communication? because it really seems like you would lose information . but I do know that cell phones have DSP chips. does anyone know how that works ?
 
  • #40
btb4198 said:
Dude, that is not cool. I never said, I was stilled or good at DSP. I have always said I am new to this. I have said that in all my threads. I do not believe that I know more that I really do.
I am just trying to learn.
That was a bit harsh, of him, I admit, but his point is well made. You seem to want to "learn" this without involving theory and graft. There are no simple answers once you are in the realms of convolutions and transforms. There is little point in numerical 'suck it and see' with this business and that approach is too specific to yield anything useful.
 
  • #41
Sophiecentaur,
When I play the sine wave like sin(445) : there are two Frequencies but when I just put the values in an array and just went the array to the fft there are only one Frequency?
is it because when I am playing the sine wave, I am using two channels ?
so the two Frequencies i would get would be 445Hz and 445 * 2 = 890 Hz
This is the only things that seem like it would make sense right?
does that sound right to you?
 
  • #42
btb4198 said:
Sophiecentaur,
When I play the sine wave like sin(445) : there are two Frequencies but when I just put the values in an array and just went the array to the fft there are only one Frequency?
is it because when I am playing the sine wave, I am using two channels ?
so the two Frequencies i would get would be 445Hz and 445 * 2 = 890 Hz
This is the only things that seem like it would make sense right?
does that sound right to you?
I'm sorry, I really don't know what you mean here. Do you?
 
  • #43
sophiecentaur said:
I'm sorry, I really don't know what you mean here. Do you?

ok never mind... while testing i learned amplitude vs frequency is important. before I had the amplitude too high.
so I think I got it now...
Thanks for everyone who help me!
 

Similar threads

  • · Replies 18 ·
Replies
18
Views
3K
Replies
21
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
2
Views
1K
  • · Replies 15 ·
Replies
15
Views
5K
Replies
5
Views
2K
Replies
3
Views
1K