0

I have a series of extremely short clips I'm trying to merge together (typically only 1/10th of a second). This works fine when joining them with the += operator, but the .append() method, regardless of what argument is passed for crossfade, will return the error: ValueError: Crossfade is longer than the original AudioSegment (Xms > 0ms), with X being whatever the crossfade is.

Here's the code that I'm using;

sound=AudioSegment.from_wav(r"\sound.wav")
print(len(sound))
song.append(sound,crossfade=11)

The print statement gives me the length of the AudioSegment--which is clearly greater than 0, and usually ranges from 88ms to 170ms. However, applying crossfade always returns the error, which makes it seem as if pydub has issues getting the length of the clip.

Looking at the source code though, this shouldn't be happening:

elif crossfade > len(self):
    raise ValueError("Crossfade is longer than the original AudioSegment ({}ms > 
        {}ms)".format(crossfade, len(self)

The same len() function is being used, but somehow the results are just different? How can I make crossfades actually work?

rllysleepy
  • 52
  • 7

0 Answers0