[Bug] PlaySound can't play more than one note at the same time while PlayNote can.
Extamov opened this issue ยท 8 comments
Version: 1.80pr1 build 04
MC Version: 1.12.2
peripheral.wrap("right").playSound("minecraft:block.note.harp",1,1.1892071)
peripheral.wrap("right").playSound("minecraft:block.note.bass",1,0.59460354)
If you will try to run this code, it will not play both sounds
peripheral.wrap("right").playNote("harp",1,15)
peripheral.wrap("right").playNote("bass",1,3)
But this one works.
Why is that?
@SquidDev I guess I would not be able to use playSound for creating music.
Not sure why playNote and playSound("minecraft:note") is that different.
I can use sleep(0) for playSound but I can hear that they are not playing at the same time.
That not a good idea to limit sounds to one per tick.
Not sure why playNote and playSound("minecraft:note") is that different.
The issue is that we know that notes don't last a long time, and so it's OK to have a lot going on at once. However, there's no way of knowing if an arbitrary sound lasts a fraction of a second or 5 minutes, and you definitely don't want people spamming the latter!
I guess we could look into a config option for maximum number of sounds in a tick, but I think the current setup is at least a good default.
@SquidDev Requiring a delay for playSound wont fix the problem.
Using a delay to spam is possible too for 5 minute sounds.
I suggest you to just make it act like playnote and not require a delay
Better add an option in config for playsound
@ExtendLord would an 'orchestra' of computers work for you in your current situation. I think that will get around this limitation.
To quote the original PR (#237):
To prevent sound pollution, sounds are limited to once per tick. However, up to 8 notes can be played per tick to allow for chords. If a note is played, then this will not allow a sound to be played in the same tick as well.
It's worth noting that some sounds last substantially longer than notes (most notably jukebox songs) and so you definitely don't want people starting more than one of these in a tick!
What about a boolean in config (enforceable server-side) to disable the sound per tick limitation (perharps with a warning on description telling the server admin about the unwanted consequences)?
Removing the limit would be Very Bad. This is because if you spam sounds too fast you can crash Minecraft or freeze it really badly. A config option could be added.