pouët.net

Music playback stuttering

category: general [glöplog]
Problem: I am running an effect with a heavy pixel shader and the music playback (BASS, but this seems irrelevant) stutters and plays approx. at 50% speed.

This happens when I run in fullscreen with vertical sync turned on.

It does not matter whether I manually update the sound buffer or let be threaded and automatically updated. (e.g turning off automatic updating and letting the buffer play in a loop produces the same distortion in the sound) I have tried various buffer sizes, giving lower priority to the demo window and inserted sleeps in the main loop. The latter works if i sleep(40) but this is ... emmm.. unacceptable ;)

If I run with vsync off, I get normal playback.

I suspect a driver issue, but the latest update did not help me either. My sound card is some crappy integrated soundmax card mounted on an asus circuit.

One year ago, I got a bug report on our previous demo that sounded more or less like what I am experiencing myself right now. In both cases it involves a pixelshader-heavy effect that make the music crumble. I used fmod back then, but I'm using BASS now and have upgraded my hardware so it seems to be a general problem.

Question: Have any of you experienced this problem and know a solution?

First poster to post any random images will be dealt with at BP.
added on the 2008-02-13 00:16:06 by Hyde Hyde
although this may not be of any real help to you but I have a similar problem with my maudio delta 1010lt soundcard.. Music playback stutters when the gfx card is under load. I suspect this to be some kind of iRQ sharing problem
(in my case, the problem only occurs the first time the machine is booted, after a reboot the problem is gone..)
must be the drivers..

added on the 2008-02-13 00:32:40 by xyz xyz
BB Image
I had to.
added on the 2008-02-13 00:33:51 by kusma kusma
The music playing at half the speed is some fucked up bug. Normally it would start breaking... you probably know how it works.

Do the wise thing and test it on someone else's pc :)
added on the 2008-02-13 01:20:53 by xernobyl xernobyl
Hyde: Yeah, this sometimes happens with broken sound drivers and more often with broken video drivers (for whatever reason). Do you create any resources while the demo runs? The fr-025 party version had a bug that caused it to call CreateVertexBuffer once per frame (and release it later), which caused a similar problem.
added on the 2008-02-13 01:28:26 by ryg ryg
just optimize your code lol
added on the 2008-02-13 01:32:24 by kusma kusma
Just have dramatic silence for the GPU-hungry part. Is this helpful?
Hyde: You should try it with different sound card configuration. At least few M-Audio sound cards notably has these kinds of bugs from time to time. Note that if you have a Creative sound card or any plain old Soundblaster equivalent and compatible model this would be a rare bug then.

...So the demo is coming to Breakpoint? :)
added on the 2008-02-13 05:59:02 by waffle waffle
Oh, and iirc EMU sound cards are also sometimes causing these kinds of problems.
added on the 2008-02-13 06:05:01 by waffle waffle
thanks for feedback everyone. I should perhaps clearify the description of the bug: the sound is continuously distorted and plays slowly. It's like there's a filter somwhere.

hermes, xernobyl: it happens on my machine every time regardless of reboot, and none of my friends have reported have this bug at their computers.

ryg: I am 95% certain that i'm not creating any resources, but that's an interesting point.

waffle: thanks for the info, and yes: If I can avoid wasting more time on this thing ;)

But this is what I don't understand: If heavy workload on the gpu causes the problem, why does it help to turn OFF vsync? I would expect the vsync-wait to give the system some time to relax once in a while.
added on the 2008-02-13 07:27:05 by Hyde Hyde
kusma :DD
added on the 2008-02-13 08:17:27 by el-bee el-bee
just turn of vsync and don't tell anybody about it. leave the checkbox in the startup dialog. only preacher will notice, and nobody believes him anyway.

(oh and solo2, "music, 3d fire effect, zoomer, no vsync")
added on the 2008-02-13 08:46:31 by skrebbel skrebbel
just call it "Crazy Low-Fi Tearing Effect" or hide it behind Hypnoglow.
added on the 2008-02-13 09:02:04 by kusma kusma
hyde: strangely enough, following from ryg - some people reported this bug before with some of our demos, and it was fixed by "upgrading their videocard drivers". did you try that? could be some odd starving issue in a certain driver version.
added on the 2008-02-13 09:03:11 by smash smash
I have no experience from a programmers perspective, but some experience from a user perspective.

If you have a newer soundcard with lots of "features", ie SB X-Fi or a soundcard meant for audio production, they all consume a lot of bandwidth. If your videocard wants to consume a lot of bandwidth at the same time, you might run into trouble.
Also, soundcards that use a lot of bandwidth also provoke other errors when coupled with high bandwidth usage from a gfx card. This could be anything from IRQ-sharing problems (I suggest you check it, there's no reason why this shouldn't be a problem after every boot),bugs in the motherboard's chipset or bugs with the soundcard in combination with specific chipsets for motherboards.

I've had the same problem with games, more specifically with Battlefield2. Using the "very high" option for sound, my computer would typically crash after some time, freezing the system and looping the audio buffer.

Sometimes updating drivers help, sometimes it don't. My "solution" to the problem was to enable the motherboard's onboard soundchip, and using that for anything else than audio production.

What soundcard are you using, and what graphics card do you have?
added on the 2008-02-13 10:49:48 by lug00ber lug00ber
Quote:
just turn of vsync and don't tell anybody about it. leave the checkbox in the startup dialog. only preacher will notice, and nobody believes him anyway.


Preacher : You can count on me to notice it as well :)

Quote:
My sound card is some crappy integrated soundmax card mounted on an asus circuit


What model exactly ? I could give it a try at work, we have dozens of different configs.
added on the 2008-02-13 17:13:42 by keops keops
Random shot in the dark:
Check that the driver settings for your sound card do not have any stupid effects or filters enabled. I had a very similar problem with my M-Audio card on graphics heavy applications (sound would slow down and then go choppy) until I discovered there was some stupid fake 3D effect enabled. Got rid of that and everything suddenly worked (driver bug...?)
added on the 2008-02-13 18:48:17 by nagato^ nagato^
the other option is making the musician compose the tune in such a way that it seems that the stuttering is supposed to be there.
added on the 2008-02-13 19:54:53 by skrebbel skrebbel
nvidia7800gt
SoundMAX Integrated Digital HD Audio
ASUS P5B-VM main board.
intel core2 cpu

I upgraded the soundcard drivers without success.

smash, lug00ber: It would be very comforting to be able to blame it on lousy drivers. I'll try update any other driver in sight and see. Thanks.

keops: That would be helpful, thanks.
skrebbel: the bug only occurs on my machine :) (so far)
added on the 2008-02-13 21:13:48 by Hyde Hyde
I had a look back through my emails, as I saw this issue on the last andromeda demo. It was on a vista laptop, with a 7600 card and a basic sound card of some sort (it was a work laptop so nothing fancy). I can track down the laptop if a sound card model would help.

The issue went away if I turned the screen res down. I'm not sure what that means, but I'd think at higher res the framerate should drop, and irq conflicts and the like should be less likely, making me think it could have been lack of bandwidth somewhere causing the sound buffer to empty. Maybe that's totally wrong though :) Or perhaps the sound is in some way tied to the frame rate?
added on the 2008-02-14 08:10:47 by psonice psonice
hyde, come on, are you a man or what? add some completely machine-specific code and fail otherwise. claim that it works everywhere except the compo machines, and that it must be because of german hardware. be nice and patient, though. they'll let you drag your box upstairs. ryg will make the video. nobody will notice. (except preacher) (not keops, he's not even coming)
added on the 2008-02-14 08:38:25 by skrebbel skrebbel
add some wierd visuals and tell them "You need to listen!" ;)
added on the 2008-02-14 09:29:43 by raer raer
Quote:
If heavy workload on the gpu causes the problem, why does it help to turn OFF vsync? I would expect the vsync-wait to give the system some time to relax once in a while.


that all depends on how the vsync wait is implemented (driverside) and if said implementation causes something to flail off the handle

how's the framerate when this happens? because it sounds like your whole system is stalling (including the os scheduler)

i'd seriously check exactly what you're doing in those frames, perhaps unleash pix and have a close look at your command buffers and corresp. stats (things might happen implicitly)
added on the 2008-02-14 09:47:24 by superplek superplek
(i haven't programmed anything serious on pc for at least 5 years so, yes, "spikes? congestion?" really is the best i could come up with right now)
added on the 2008-02-14 09:48:52 by superplek superplek
why don't you send a video of the effect in question ? :-P
added on the 2008-02-14 10:00:06 by Navis Navis

login