Mirror App Garbled Audio and slow fps Error

Iv just learned that our game like some others garbles the audio when running through mirror app.
A work around i found for now is install the playdate sdk which comes with the simulator app, load the pdx folder(not the zip) Plug the playdate in and press Device> Use device as controller option. The sounds seem to work in the simulator. We will look into a fix but this could help capturing other games in the mean time.
You can also use the Boot to dada disc to grab the files from the season 1 to play on sim as i hear "Echoic Memory" also has this mirror error.

Hope this is yourful and saves you some debuging while recording footage.

The question now is why dose it get garbled in the first place. we use wav files but assumed they were converted to pda at build time?

I heard a couple peoepl talk about garbled audio though mirror but this is the tweet

He then went on to say he changed the cable out and it worked fine s this may be a non issue

Been doing some more testing with device and mirror,
dose it try and cap the fps to 30 for recording purposes?
as soon as i plug the came in it drops from 48 fps down to around 30fps.

Hey Alastair!

Thanks for reaching out about this again, I hope I can answer some of your questions.

To start, I'll point out that the issue in the thread linked in your original post above was actually resolved, the problem being the ports on the user's computer case, and not actually a cable issue: https://mobile.twitter.com/HelloPlaydate/status/1532453763595878411

That said, we are sending a lot of data and hitting limits to what we can send reliably over USB from Playdate -- and it is quite sensitive to USB-cables as well as how you're plugged in to your computer. If you're going through a USB hub, it's best to remove it out of the equation. If you're going to an externally-wired port (eg. pc case front-panel), it might be worth giving other ports a shot.

All of our testing and development for Mirror is done using the bundled usb-a-to-c cable plugged directly into either a Macbook or a PC motherboard. When I'm testing, I try to ensure that we work with the boxed cable so we're not sending people to the store to replace something we've already sent them.

Mirror doesn't actually do any hard-capping at all, it's simply limited to how quickly the Playdate can push the data out and how much data the game is trying to send. There's a lot of data to be sent for a game doing full-frame updates @ 48fps, especially with audio running as well. To try and provide the best experience for most games, Mirror tries to make the best effort it can to send all the data down, but this can result in small video or audio drops. If I recall correctly, it prioritizes getting video data over when space is tight, but it's been a while.

So what can be done about it?

As a user, right now you can try making your experience better by reducing audio quality to Mono in the "Audio" menu of Mirror, or disabling audio completely. Make sure you're plugged in directly to your PC's motherboard / laptop, with no Hub or anything in-between. Cutting audio out isn't ideal if you're streaming or trying to record, but if you're using it as an accessibility or controller tool it's great because you can still use your Playdate's speaker / headphone jack without issue.

As a developer, there are some other things you can do to make a game more Mirror-friendly:

  • Update as little of the screen as possible per-frame! The Mirror protocol currently works on a per-row basis, so if you can eliminate dirty rows as much as possible (ie. don't redraw the full screen every frame), you'll see massive improvements.
  • Cap your frame rate. 48 fps isn't unreasonable for most games, but if you absolutely need to do full-frame updates on every frame, capping in the mid 30's will be a huge improvement.

I realize that neither of these things are possible / ideal in all cases, so here's a few things I've added to my Mirror priority list, which I'll hopefully be able to get to soon:

  1. Automatic audio quality adjustment: Drop to mono / disable audio when we have a lot of audio data and a lot of data being dropped.
  2. Investigate the addition of a throughput test, which could allow users to one-click assess if their connection (cable, usb port, etc) is "good enough" for Mirror's needs.
  3. See if I can improve the Mirror protocol to reduce overhead on large frame updates.

Of course, one thing to keep in mind is that as long as developers continue pushing Playdate to the absolute limit of its performance capabilities, there will always be some games that simply won't play nice with Mirror.

I'm sorry this grew into a book-length response, but hopefully this covers it decently well for you and others. I'm happy to answer more questions if you have them!