-
Notifications
You must be signed in to change notification settings - Fork 4
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
Popping/crackling sound #24
Comments
We should close the other issue I raised for this same problem as this one has more information. |
Oh, darn. yes, I didn't pay attention and just opened a new one. |
This is the better ticket though. |
I've seen some commits around this issue but haven't pulled any upstream stuff yet. Do we know how the audio parameters were chosen? The playback rate is around 8kHz. A packet of 200 samples is therefore about 25ms. At a refresh rate of 50Hz, that's 1.25 frames. On an aside, it has always bothered me that the audio engine is so restricted. Software mixing of fixed rate samples shouldn't be too taxing for a faster 68K. I used to run OctaMED soundstudio at 56kHz with 16 channel 14-bit output on my 040 powered A1200 with RTG. I'm not saying it should be that rate but maybe 16kHz with full 8 bit sample resolution might be nice. |
I tried a workaround here: 0a1fc4e But it didn't have the desired effect; the invalid-memory-accesses did not go away. I guess I need to dig some further to understand the mixing code. |
An update on this. I don't know if it impacted the original game, but my mod had a sample that was not a multiple of 200 bytes. I have corrected this but I still get what sounds like early truncation of some sound effects. |
The 8 channel stereo mixing seems to introduce a lot of popping/crackling sound.
One potential issue could be that the mixing routine is overrunning the sample's buffer when mixing.
This happens in part here:
https://github.com/mheyer32/alienbreed3d2/blob/main/ab3d2_source/hires.s#L10816
a0 and a1 point at two sample's data. To save on processing power, the mixing routine chooses the "louder" one of the samples
at full volume (the channel's volume will be adjusted for it) in a0, while the other sample's data in a1 gets mixed in (multiplied via a volume table).
This loop runs straight through 50*4 = 200 samples. But its causing "Accessing invalid memory" issues in WinUAE, hinting that it overruns the end of the sample occasionally.
I think there are two options to solve this
The text was updated successfully, but these errors were encountered: