# Basic pitch processing

I am using matlab to construct a simple synthesizer, starting from fundamental sin waves. When playing two successive pitches their is a "tick" noise appearing at the junction which I would like to remove. I have tried to correct the phase angle of the second pitch in order to adjust the junction between the two sin waves but this doesn't get rid of the noise.

(I have also tried to shape the sequence by damping at junction, which works, but also gives an annoying "staccato" feeling.)

My question's are:

what is causing this behavior?

How could (and should) I remove it?

Is there good introductory literature to fundamental sound processing (I am quite new to sound design but have some background in mathematics)?

Thanks a lot for you help.

• What you're hearing is technically correct, and what you're expecting might be a very fast cross-fade or something of the sort. Sep 7, 2015 at 9:08

What is causing this behavior?

The tick sound is caused by a discontinuity in the derivative of your signal, producing a noisy sound at this very moment.

How could (and should) I remove it?

To keep your sound clean when changing frequency, you should avoid the discontinuity in the derivative of the sine wave before the change and the sine wave after the change. The only easy solution is to take advantage of the zero derivate on every local extrema of a sine wave.

So, when a new note is played, your synthesizer algorithm should save its frequency but not apply it straightaway. It should rather wait for the next maximum/minimum of amplitude to switch frequency.

By the way, if you add a velocity feature to your synthesizer, the amplitude change will have to be done when the sine wave is crossing zero.

Update:

By velocity, I mean the intensity of the note. In musical terms we would say piano, pianissimo, forte, fortissimo... In your case you just have to change the amplitude of the sine wave.

• Ok fantastic, thanks a lot maxime !! (sorry I cannot vote you up as a guest) I am not sure to understand what you mean by velocity feature, is it related to a change in sampling frequency?
– user16305
Sep 7, 2015 at 10:10
• Also, as John AM says, You should use the restart or 'sync' feature so that the phase of the wave is synced with every key press event. Adjust the phase so the wave starts on a zero crossing angle(for every wave). If not; just turn up attack from an envelope module and it should solve it.
– n00dles
Sep 13, 2015 at 4:13

The click is produced by the discontinuity of the signal and is easily heard with sine waves. Use an envelope to amplitude modulate the signal and raise the attack a bit so to smooth the attack phase of the sound.