Old fashioned way if you don't want to use an achievement code (source : VidGamiacUnlocked)
EDIT: Found another Realm code, this is for The Ultimate Achievement World (honestly this one is amazing): hYEbyVTi82w
This one confused me for a while (okay... still confuses me)
Spawn an Allay (blue bird thing). This is how I think it works and what I did to finally get it to work. I gave the Allay a cake. Then I dropped a cake (a bunch actually) then played the note block. The Allay freaked out picked the cake(s) and started throwing them all around the note block. So it seems you need to give the Allay a cake AND drop a cake, then hit the note block.
There are a lot of options for achievements worlds. You can join a realm, download an achievement world, or join an achievement server.
I used both of the following worlds, one realm and one downloaded:
I was able to get this on The Button King's realm.
https://open.minecraft.net/pocket/realms/invite/uZKDJV4SOpEPersonally, my favorite world is the Ultimate Achievement World. So easy to find what you are looking for. Here is updated version (1.19)
https://drive.google.com/drive/folders/1kf1Ln_ejxexg3j6SFBGB...