Problem combining music and sounds in µpython


There is a problem when combining music from sd with a sound effect: everytime the sound effect plays, the music is interrupted.
If you would like to check for yourself:
During the game, everytime ‘A’ is pressed, the sound effect is played
ufo.bin (167.1 KB)
ufointro.snd (230.8 KB)

It seems something is wrong with the mixing.


Source please ?



In fact I have discussed this already with @Hanski.
He noticed the same effect in his frogitto game
It is more noticeable here because the sound effect has a longer duration.


Found the reason for the bug in mixing sfx and streaming music.

@jonne : Do you remember reason for this?

            ifdef PROJ_SDFS_STREAMING
                int32_t s = (int32_t(output) + int32_t(sfxSample)) - 128;
                int32_t s = (127 + int32_t(sfxSample)) - 128;

Music streaming is normally using PFFS, not SDFS.


Actually the PROJ_SDFS_STREAMING was intended to just signify that output is an actual value coming from data read from SD

If not, and as you can see, output is replaced with value of 127. This was to allow the uPy games to stream from flash memory, without needing a value in the variable output