flew Posted October 16, 2020 Share Posted October 16, 2020 Hi there, I have been using the Stella emulator for coding/playing a couple of demos on Atari 2600, and that's been great so far. Thanks for that ! However, when running the binary provided in attachment (I wrote a code to illustrate the lag) in Stella 6.3 (Stella 6.0.2 as well), I experience a lag between the picture and the sound (Rough estimate about 50-100 ms). When running the same binary on the real hardware I don't see/hear any lag. As I don't notice any lag when playing videos (on youtube) on my machine, I don't think my OS (Ubuntu 20.04) introduces it. It feels like it comes from the Stella emulator (Even though I selected "Ultra Quality, minimal lag", in the Audio Mode options). The source code of `main.bin` is there: https://github.com/FlorentFlament/stella-lag Just wondering if this has been noticed already ? Or is it my setup that is broken ? main.bin Quote Link to comment Share on other sites More sharing options...
+stephena Posted October 16, 2020 Share Posted October 16, 2020 There will always be some lag; it's unavoidable due to how emulation works. But it shouldn't be noticeable in most cases. Certainly if you hook up stuff to some measuring equipment (scope, etc) you will see it is there. But in practice is shouldn't be too bad. But I suppose it could depend on hardware/settings, and how sensitive you are to such issues. Quote Link to comment Share on other sites More sharing options...
+stephena Posted October 16, 2020 Share Posted October 16, 2020 Also, in the sound settings, try 'Custom' and then set 'Fragment size' as low as possible, before you start getting crackling in the sound. I can get down to 256 on my system, and sometimes 128 depending on the ROM (Linux, KDE Neon 20.04 with pretty fast hardware). But on other systems, 256 is too low, and I have to increase it. Quote Link to comment Share on other sites More sharing options...
flew Posted October 17, 2020 Author Share Posted October 17, 2020 Thanks for your reply @stephana, Indeed, with a 128 samples fragment size, I barely notice the delay between image and sound! And yes, you're right about the delay being unnoticeable in most cases. I guess it could be feasible to delay the image by the same duration than the sound to have them in sync, but we would introduce lag between user input and the software being emulated... Emulation compromises ... Quote Link to comment Share on other sites More sharing options...
+stephena Posted October 17, 2020 Share Posted October 17, 2020 I guess you could edit the code to use 64 byte or even 32 byte samples. The lower you go, the lesser the lag. But most non-realtime systems can't keep up at extremely low fragment sizes, and other issues pop up. I just tried modifying the code, and could get down to 16! At that point I didn't see any lag. Tried 8, but Stella locked up. But 32/64 may be possible on some systems. Perhaps we'll add an option to go lower than 128. Quote Link to comment Share on other sites More sharing options...
flew Posted October 17, 2020 Author Share Posted October 17, 2020 Nice, why not let users enter any value they wish ? Quote Link to comment Share on other sites More sharing options...
+stephena Posted October 17, 2020 Share Posted October 17, 2020 Because only certain values are supported, and if we allow arbitrary values, we need to deal with the possibility of invalid input. Easier to restrict to what we know will work. Quote Link to comment Share on other sites More sharing options...
flew Posted October 17, 2020 Author Share Posted October 17, 2020 Fair enough. From the values I have seen so far, I guess you support powers of 2. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.