Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound buffer issue and possble lag? #3

Open
ThatRetroGuy opened this issue Apr 11, 2022 · 20 comments
Open

Sound buffer issue and possble lag? #3

ThatRetroGuy opened this issue Apr 11, 2022 · 20 comments

Comments

@ThatRetroGuy
Copy link

The software work's great in the start and seems alright, but if there come's multiple instruments's, it will eventually crackle and pop in the audio, is that being worked on? it could be a memory issue in likely plausible cause.

I know somebody on discord who would gladly aid with a real sc 55.

@skjelten
Copy link
Owner

What OS are you using? I just noticed that this problem is especially problematic on Windows. Since all development is done on Linux it can be weeks or even months between each time I check the windows build.

My first guess is that we for some reason get buffer underruns in the audio output driver when multiple tones are played at the same time. This problem might have been there all the time and just become more noticeable now with longer tones due to the volume envelopes that was just added. I will have a look at it and see if I can figure out a solution.

@ThatRetroGuy
Copy link
Author

ThatRetroGuy commented Apr 11, 2022

Hello! im using windows, its my main daily driver system, would there need to be a separate dev build going for window's? wish I could help on that occasion, but yes, on window's audio start's to lag badly, I'm open we can discuss further on discord, the issue at hand.

a good bunch of the instruments are also out of tune, but you are getting that fixed to?

@skjelten
Copy link
Owner

I'm pretty sure we won't need any separate build environment for Windows. I also think I have the information I need to work on this particular issue, so I'll give an update when I have figured out something.

@ThatRetroGuy
Copy link
Author

thats great to hear on the issue being worked about, did you know somebody on here has worked on some sound canvas screen simulation?

@ThatRetroGuy
Copy link
Author

Also here's an recording from a native windows 10 machine I did not to long ago, performance is a bit choppy in some place's
mario express.zip

@Kappa971
Copy link

Kappa971 commented Apr 12, 2022

thats great to hear on the issue being worked about, did you know somebody on here has worked on some sound canvas screen simulation?

I'm not an expert, but for me it is already fantastic that this emulator is able to emit sounds (considering that until now nobody has ever worked in a Roland SC-55 emulator) and, according to my ears, I'm sure they are still missing all effects like reverb and chorus and who knows how much other stuff, in addition to the wrong "tone" of many instruments (I don't know the technical name). As already said, it is comforting that someone is working on it and maybe in a few years we will finally have an accurate and fully functional emulator. Thanks @skjelten

@ts-korhonen
Copy link

ts-korhonen commented Apr 12, 2022

It seems to be a problem when building 32bit executable (msys2, i686-w64-mingw32) while with the 64bit build (x86_64-w64-mingw32) the problem is not present.

edit: clarification; the problem being popping sound. The "lag" is still present, though to my ear it sounds like imprecise timing so maybe the timer method needs to be different on Windows etc.

@Kappa971
Copy link

It seems to be a problem when building 32bit executable (msys2, i686-w64-mingw32) while with the 64bit build (x86_64-w64-mingw32) the problem is not present.

edit: clarification; the problem being popping sound. The "lag" is still present, though to my ear it sounds like imprecise timing so maybe the timer method needs to be different on Windows etc.

Try Duke Nukem 3D midis and you'll hear the pops even with the 64-bit build. However, I think the emulator is still incomplete, the project is very recent, so it seems obvious to me that there are problems... we could probably define it as an alpha.

@ts-korhonen
Copy link

you'll hear the pops even with the 64-bit build

Ok. But the build architecture still has significant impact on my end. With Roland SC demo midis they go from very prominent to unnoticeable.

the emulator is still incomplete, the project is very recent, so it seems obvious to me that there are problems

Of course. I'm not complaining, only trying to provide extra information to help diagnose the problems 😃

@ThatRetroGuy
Copy link
Author

It seems to be a problem when building 32bit executable (msys2, i686-w64-mingw32) while with the 64bit build (x86_64-w64-mingw32) the problem is not present.
edit: clarification; the problem being popping sound. The "lag" is still present, though to my ear it sounds like imprecise timing so maybe the timer method needs to be different on Windows etc.

Try Duke Nukem 3D midis and you'll hear the pops even with the 64-bit build. However, I think the emulator is still incomplete, the project is very recent, so it seems obvious to me that there are problems... we could probably define it as an alpha.

I think your talking about the old post, in its latest update the synth works really well, even with duke nukem 3d midi's, the popping is gone as well.

@Kappa971
Copy link

Kappa971 commented Apr 12, 2022

I think your talking about the old post, in its latest update the synth works really well, even with duke nukem 3d midi's, the popping is gone as well.

It is strange because it seems to me that no changes have been made since yesterday. Placebo effect? 😅
I tried this emulator today and, considering how young the project is, it is very promising but far from perfect, many instruments sound bad, as well as pops in some midi like those of Duke Nukem 3D, perhaps because they are among the most complex and that make perfect use of the real SC-55. I think some effects like reverb are still missing as well.
It is currently not ready, let @skjelten work in peace (and who will join him) 🙂

There are these forums for any discussions:
https://www.doomworld.com/forum/topic/118828-trevor0402s-sc-55-soundfont/?page=5

https://www.vogons.org/viewtopic.php?f=62&t=76613&start=340

@ThatRetroGuy
Copy link
Author

it was my soft synth player which had changed to default midi player for some reason, lol.

@skjelten
Copy link
Owner

Hi, could you guys test the latest code update for whether you still have issues with crackle and pop in the audio?

I have not been able to figure out how to recover in windows when you have a buffer underrun situation, but I did find two memory bugs that gave wrong sample data. If you now can play MIDI files correctly also in windows, we'll just close this issue for now.

@ThatRetroGuy
Copy link
Author

Hello, i''l get to the code testing when i can eventually, will post further when gotten it compiled.

@ThatRetroGuy
Copy link
Author

ThatRetroGuy commented Apr 18, 2022

Its definitely an improvement over the previous compile,, it doesn't struggle playing some midi's now it had trouble playing a while back, now the instruments just out of tune, it just needs the echo and chrous, then should be complete. but I get this note limit error on the prompt line, I'm guessing that's a issue going to be fixed eventually.

@ts-korhonen
Copy link

I think the 64bit build is now as functional as can be assumed in this stage.

The 32bit build no longer does the popping and crackling, but a complex song will make it stutter and lag.

@Kappa971
Copy link

Kappa971 commented Apr 18, 2022

Thanks @skjelten, I haven't had the chance to test the new build on Windows yet, I will do it as soon as possible.

I tested it on Debian 11, no crackle or pop here (as before). I would recommend you test this emulator with Duke Nukem 3D midis, as they are quite complex and I have noticed that some songs push the polyphony of the original SC-55 to the limit: Duke3D_MIDI.zip.

For example 08 - Episode 1 - Ah, Geez! [Lee Jackson].mid, EmuSC displays: New note on ignored due to SC55 voice limit (24).
17 - Episode 2 - Alfred H. (My Family's Plot) [Lee Jackson].mid instead displays: Illegal program for drum set (1)
I haven't tried them all.

it just needs the echo and chrous, then should be complete.

@ThatRetroGuy, I'm neither an expert nor a programmer or musician, but I don't think it's that simple. I noticed, thanks to this emulator, how much the SC-55 processes the samples of the instruments contained in the ROM. I have absolutely no idea what the SC-55 does to make those instruments sound right, but without any processing, you notice how bad they can sound, and this I think is not just the lack of the reverb or chorus effect.

@ThatRetroGuy
Copy link
Author

@ThatRetroGuy, I'm neither an expert nor a programmer or musician, but I don't think it's that simple. I noticed, thanks to this emulator, how much the SC-55 processes the samples of the instruments contained in the ROM. I have absolutely no idea what the SC-55 does to make those instruments sound right, but without any processing, you notice how bad they can sound, and this I think is not just the lack of the reverb or chorus effect.

Im not saying its reverb or chorus that's gonna do the job, I noticed how strange it makes the fretless bass sound, but I'm sure there gets figured a progress out.

@Kappa971
Copy link

Kappa971 commented Apr 19, 2022

The problem of crackles and pops seems solved on Windows, I happened to hear pops but only in some instruments that have a completely unbalanced volume and are probably "cropped" (in fact EmuSC displays Warning - audio clipped (too loud)). However, I notice that with some midi it seems that the emulator "stutters", it loses the rhythm of the music. There is this Duke Nukem 3D midi (28 - Episode 3 - Urban Jungle [Lee Jackson].mid) that literally puts him in crisis. Even in grabbag (intro music) it seems to miss "a few hits"

@skjelten
Copy link
Owner

Three weeks ago I finally managed to improve the WIN32 audio output (see 1bcbec9) so that if we get a buffer underrun situation, EmuSC will automatically recover as soon as it manages to feed enough audio data again.

The other issue of EmuSC limiting the number of simultaneous sounds (polyphony) is related to the TVA (volume) envelopes being too long. When sounds stay too long in sustain / release phase you quickly end up with too many simultaneous sounds for MIDI files that pushes the maximum polyphony of the SC55. The fix here is to correctly calculate to TVA envelope times for each phase, but that is harder than it sounds like 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants