Tics in generated wave files

• Nov 7, 2010 - 09:18
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Sometimes, high frequency and high energy tics are generated in wave files.

This problem can be produced by attached file, using FluidR3_GM.sf2

With provided capture, you can see the problem is numerical overflow. Clipping should be added.

I added the wav file generated by: musescore overflow.mscz -o overflow.wav

This bug has been marked as critical because this problem is dangerous for ears and sound reproduction system.

Attachment Size
overflow.mscz 1.58 KB
overflow.png 86.48 KB
overflow.zip 1.77 MB

Comments

Thank you for looking in to this.

It is difficult to see which lines you changed. It looks like the indentation was changed on every line and a few extra returns were added so a diff. comparison of the two files highlights every line.

I noticed the following code around line number 169.

    gain = double(32760) / double(32768) / peak;
    delete synth;

As opposed to the following line from the current 0.9.6 branch:

gain = 0.99 / peak;

Are there other changes? In the future Diff or Patch files are the preferred method of sharing fixes. Feel free to ask if you have any questions.

Sorry for the indentation modification.
Here is the diff against 0.9.6.3

The problem is subtle and I changed much more than just the gain computation.
The short story: create a new synth in the loop. So, some blocks have been moved.

This fixes the problem.

39a40
> static const int sampleRate = 44100;
51,72d51
< static const int sampleRate = 44100;
<
< Synth* synth = new FluidS::Fluid();
< synth->init(sampleRate);
<
< if (soundFont.isEmpty()) {
< if (!preferences.soundFont.isEmpty())
< soundFont = preferences.soundFont;
< else
< soundFont = QString(getenv("DEFAULT_SOUNDFONT"));
< if (soundFont.isEmpty()) {
< fprintf(stderr, "MuseScore: error: no soundfont configured\n");
< delete synth;
< return false;
< }
< }
< bool rv = synth->loadSoundFont(soundFont);
< if (!rv) {
< fprintf(stderr, "MuseScore: error: loading sound font <%s> failed\n", qPrintable(soundFont));
< delete synth;
< return false;
< }
92a72,93
>
> Synth* synth = new FluidS::Fluid();
> synth->init(sampleRate);
>
> if (soundFont.isEmpty()) {
> if (!preferences.soundFont.isEmpty())
> soundFont = preferences.soundFont;
> else
> soundFont = QString(getenv("DEFAULT_SOUNDFONT"));
> if (soundFont.isEmpty()) {
> fprintf(stderr, "MuseScore: error: no soundfont configured\n");
> delete synth;
> return false;
> }
> }
> bool rv = synth->loadSoundFont(soundFont);
> if (!rv) {
> fprintf(stderr, "MuseScore: error: loading sound font <%s> failed\n", qPrintable(soundFont));
> delete synth;
> return false;
> }
>
168c169,170
< gain = 0.99 / peak;
---
> gain = double(32760) / double(32768) / peak;
> delete synth;

chun lung, MIDI files do not contain sound signals (only information about which notes to play, how loud, etc) so any tics you hear are the result of your MIDI player (or computer).

Thanks David.

I just said that incase the loudness chosen had gone beyond the peak allowed by players (or whatever). Perhaps it is the computer, headphones or the player.