Been using music.playInstructions with custom sound buffers in tests with sound and music. I’ve noticed that playing chords with notes composed of many waves leads to strange results, like a lot of the sound is missing.
I’m not sure if it’s because of something like phase cancellation or something else on the audio side of things, or just playing too many sounds at once. Lowering the number of sound instructions per note seems to fix the issue, and singles note with too many sounds didn’t work properly either, leading me to believe that it’s music.playInstructions ignoring some of the buffers.
It also isn’t too many in a single ms, since offsetting the calls didn’t work. It seems to be amount of sounds concurrently playing. From testing, the limit seems to be between 40 and 50 before things start breaking. This could definitely be a problem with my sound synth and not makecode though. Thanks!
1 Like
@chembot yes, there is a limit of 20 concurrent sounds in the browser (link to source). on hardware, there is a limit of 8 concurrent sounds (link to source)
can you share your code? i’d be interested in looking at it. the limit in the browser is kind of arbitrary, so i could raise it if you have a compelling reason
Ahh thanks for the info, that explains it.
I’ve been working on an extension + external tool combo to play midi files in makecode with custom instruments. It works well enough for simple instruments made from a handful of waveforms, but I was working on some more advanced ones. Specifically violin, guitar, and piano. Although the limit isn’t very hard to hit playing simple instruments, like a 5 note chord on a 4 wave piano, or having 6+ instruments of a couple waves each play at once.
Here’s the link to the test project where I’ve defined a few instruments and songs to test with.
Here’s the link to the extension repo, although the code and comments are still pretty messy and there’s a lot to work on.
Not sure this counts as compelling, but thanks again for the info and hearing me out!
Also, would putting it somewhere like in the userconfig namespace be possible instead of modifying it outright? Like screen width/height, having a default that can be changed?
1 Like
Also, would putting it somewhere like in the userconfig namespace be possible instead of modifying it outright? Like screen width/height, having a default that can be changed?
that’s not a bad idea… will look into this.
1 Like