Handmade Hero»Forums»Code
Connor
52 posts
It's been so long ;)
Sound Issues
Edited by Connor on
I'm back with another sound issue, although this one is a lot different. I was following along with the code from day 8 and everything was going great. I wrote all the code out and the square wave sounded fine.

But when I came back the next day, the code didn't work. The square wave sounds all static-ey. I thought something must have changed with the code, but strangely I didn't edit any of the code. I went and checked the source code for that day, and I could see nothing different. So I just compiled the handmade hero code from day 8 and played it, same affect. Yesterday, I also compiled the handmade hero code and ran it. It didn't sound all staticy.

On further investigation I found that all other sounds on my computer work fine. I played pandora (music) and some wav files I had on my computer, they all sound fine. I am very confused about all of this.

Any ideas appreciated, thanks.

I skipped ahead to day 9 and everything sounds fine. I think my computer just did not like the square wave but once we switched to sine it was okay. Thanks for everyone's help!
- Connor
Jim R. Didriksen
63 posts
Sound Issues
Are you on a Laptop and either running other software in the background or have you changed the Power/Battery-save settings.

I remember my result being different from his, and I think it was the granularity on my PC not being correct, also I have wasted a lot of time checking for errors which where just difference in performance between his and my PC so unless you're passed the whole WAVE subject I wouldn't worry about it.

And another thing, if its a small thing you have missed you might find it as he progresses...

ANOTHer thing you can try if you have paid the pre-order thing is just try compiling his source code for where you are and see if the same issue exists. (if it isn't its probably really small oversight or operator-miss-match. */+ -/~ and so on.)
Mārtiņš Možeiko
2265 posts / 2 projects
Sound Issues
The sound code Casey wrote is not final. Couple people on stream and forum have already mentioned it doesn't work very well on their systems. Casey has mentioned that he'll take a look and improve that later when platform layer will be updated to be better.
Connor
52 posts
It's been so long ;)
Sound Issues
I actually already did compiled Caseys code today and it was all static. The strangest thing was that it worked fine yesterday.
Andrew Chronister
194 posts / 2 projects
Developer, administrator, and style wrangler
Sound Issues
The current sound code uses a very small sound buffer, just enough to last for the target frame time, so if the framerate ever misses, this causes the sound to "skip" while the game fills the buffer back up. If your framerate consistently misses, this can sound like some pretty bad static.

This may be what's causing your issue, so one thing you can try is to check to see if your game is making the framerate (shouldn't be anything particularly strenuous that early on, but the early platform code had some strangeness). If Casey hasn't covered frame timing yet, just push on through a couple more episodes.

Alternatively, it could just be an issue with that version of the platform layer on your system. You could try one of the later builds (maybe from just before he moves on to game-specific stuff or when he's adding individual sounds to the game) and see if you have the same issue.