3
$\begingroup$

I am making a digital sound mixer and get this wav file (200kb, Wetransfer)

I looked through the waveform using Audacity. It uses 20% of its maximum amplitude and I see no sudden changes in the waveform.

Yet it repeatedly clicks.

It is composed (not maxed) sine waves, first 1, later 4. But the waveform looks like I avoided constructive interference (by reducing volume).

Interestingly when combined with other sounds (music, ambience), the clicking is almost removed.

$\endgroup$
9
  • 1
    $\begingroup$ Can you post the code how this is generated? Could be all sorts of things: dropped samples, phase or amplitude discontinuity in one of all of the oscillators. This can be reverse engineered but it's a rather tedious process. I'm guessing it's related to the amplitude management, which looks too smooth to me. How exactly do you "reduce volume" ? $\endgroup$
    – Hilmar
    Apr 16 at 16:59
  • $\begingroup$ @Hilmar thank you. Can not be dropped samples, see the waveform. Oscillators: don't worry about that, this mixer is not even intended for that but arbitrary tracks. Too smooth: I did not know that that is a thing. Reduced volume by multiplying a constant (there are no artifacts, as you can see in the waveform) $\endgroup$ Apr 16 at 17:10
  • 1
    $\begingroup$ Can you post your code? Guessing blindly is not going to work here. $\endgroup$
    – Hilmar
    Apr 16 at 17:31
  • $\begingroup$ @Hilmar sorry, can not do that and it is unlikely that it would show you something that the waveform does not $\endgroup$ Apr 16 at 17:35
  • 1
    $\begingroup$ Well, there is obviously something wrong with the code otherwise it wouldn't be clicking $\endgroup$
    – Hilmar
    Apr 16 at 18:12

4 Answers 4

4
$\begingroup$

There is clearly something wrong but it's not easy to tell what it is. In order to analyze I ran the signal through a bandstop filter which should ideally eliminate the entire signal.

It can be clearly seen that there strong spikes in the band-stopped signal which are a strong indicator of out of band energy, i.e. they happen where the clicks are. So the location of the clicks can easily be identified this way but there isn't anything obviously wrong with the waveform, so further analysis is required.

Without more details on how exactly the signal is generated, this is difficult to do. You would probably have to manually build the individual sine waves and subtract them out, which is rather tedious to do.

enter image description here

$\endgroup$
3
  • $\begingroup$ Thank you for analyzing the waveform! I will try to work with this to find the problem $\endgroup$ Apr 16 at 18:58
  • $\begingroup$ By zooming in on the waveform, it clearly has periodic discontinuities that have an unusually large jump in the samples, as if there was a sample missing. $\endgroup$
    – Justme
    Apr 16 at 21:02
  • $\begingroup$ Such a situation could occur, for example, if you generated a sine wave with a certain number of samples that isn't a multiple of the period, then extended it to a longer duration by repeating this fragment instead of generating more of the wave $\endgroup$
    – user253751
    Apr 17 at 9:51
14
$\begingroup$

There are discontinuities in the waveform.

Please open the file in a program that allows you to zoom in on the waveform.

There is a visible click at 0.9404 seconds, after sample number 20735.

Screenshot from Audacity, showing a sudden change in amplitude at timestamp 0.9404 s.

It looks like a sample has been skipped.

On the other hand, when somewhere else a sample was skipped, it looks like exactly 128 samples before there is a problem where a sample has been doubled.

So whatever algorithm is producing the waveforms, it has a bug generating continuous waveforms, and instead sometimes a sample is doubled or skipped.

$\endgroup$
1
  • $\begingroup$ +1 but I saw that someone else -1'ed this earlier. I will check this too, thank you $\endgroup$ Apr 17 at 4:25
-1
$\begingroup$

Plotting the WAV file shared, it looks like the signal is clipped.

Yes, it only goes to 20% of the full-scale value, but the fact that it's pretty much ALL limited to 0.2 (20%), suggests that the value is clipped.

Plot of shared WAV file.

Such clipping will cause clicks.

The reason the clicks disappear when adding other signals is probably because those other signals have the effect of aurally smoothing them out. That doesn't mean they are gone, just that they're not as easily heard.

$\endgroup$
7
  • $\begingroup$ Thank you, but zoom in! Zoom in by a lot until you can see the waveform. The wave is perfect, not clipped. $\endgroup$ Apr 16 at 15:52
  • $\begingroup$ The waveform is not clipped and it is not perfect either. $\endgroup$
    – Justme
    Apr 16 at 21:00
  • $\begingroup$ @BerndElkemann If it were "perfect" there would be no clicks. Can you share how you created the signal? $\endgroup$
    – Peter K.
    Apr 17 at 1:15
  • 2
    $\begingroup$ Or it's just a computer-generated waveform that always has the same amplitude by design $\endgroup$
    – user253751
    Apr 17 at 9:50
  • $\begingroup$ @user253751 Possibly! But we don't have enough information from the OP to be sure. $\endgroup$
    – Peter K.
    Apr 17 at 21:58
-1
$\begingroup$

A suggestion of something to check... do all your sine waves have the same phase?

Adding sine waves with same phase will result in constructive spikes in signals.

$\endgroup$
1
  • 1
    $\begingroup$ This is not the issue (it's clear from simply listening to the file that something else is wrong) $\endgroup$
    – Edward
    Apr 17 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.