3

I'm using the tool timidity to convert MIDI files to WAV using the timidity file.mid -Ow command. Unfortunately, the output wav file has a scratch sound at the beginning, e.g.

Short of installing a low-latency kernel on my machine, is there a simpler method to avoid those scratches?

(Edit: removed scratchy sound file from SoundCloud)

4
  • I had a similar problem that was affected by setting the bit-depth on the command line; but I don't remember the details maybe one of the --output-24bit flags or similar.
    – Dave
    Oct 20, 2016 at 2:48
  • If you have an "unreasonable" scratch sound at the beginning, as a workaround maybe you could insert a few dummy notes and then a second of complete silence at the beginning in your MIDI file, which you would strip in a wave editor (like Audacity).
    – dtldarek
    Oct 20, 2016 at 9:56
  • 3
    I don't have the link nor do I remember how to find it, but this is actually due to a bug in Timidity. There is patched version available somewhere or you can compile the latest version yourself. If I can find that information I'll update with an actual answer but maybe this can help you on your way in the meantime.
    – bfootdav
    Oct 20, 2016 at 16:34
  • Thanks @bfootdav! I compiled the source for timidity 2.14.0 and it removed the scratches. Problem solved :-)
    – infojunkie
    Oct 24, 2016 at 6:11

3 Answers 3

3

Compiling the latest version of TiMidity++ (version 2.14.0) solved the problem for me. Thanks @bfootdav for the hint!

3

The easy remedy while the fix makes it into Ubuntu (can't even see it upstream?!?) is to call it as

timidity --output-24bit

I haven't figured out a way how to do this in timidity.cfg though.

1
  • As of Oct 2020, this problem is still there in version 2.13.2 from Ubuntu 18.04. Using timidity m.midi -Ow -o m.wav, my .wav file was generated with bad scratching near the beginning. With timidity m.midi --output-24bit -Ow -o m24.wav it sounds great. The workaround in this answer is still needed.
    – Curt
    Oct 6, 2020 at 2:40
0

timidity -Ow is not running in realtime, so a low-latency kernel will not make a difference. There is actually little sense in that noise: either something in your processing chain is expecting raw input and misinterpreting the wav header, or your sound fonts have problems: try installing and configuring a different set (I think there are several). However, the music sounds as if it were having identical repeats (does it?) in which case it would make little sense if the noise occured only at the start.

So all in all, I can't really produce a sensible interpretation of your described results. Maybe the description is missing something, and maybe my ideas will help you figuring out something. I do seem to remember that I had similar noise problems with some music and changing the sound fonts (to "freepats" or the other way round) cured it.

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.