Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DBC Sound Problem

Author
Message
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Feb 2008 17:44
Writing Ulitimate Pong for another thread I had a problem with very bad crackling noise when playing back sounds - both MP3's and WAV files.

I've never had this problem since I started using DB years ago.

Thinking it was something in my program, I created a new project with Load Sound, Play Sound and Wait Key in it and it still crackled like crazy.

But, every single file sounds perfect in Winamp or any other Windows software I've tried - but go back to DBC and the crackling returns.

I then restarted my computer and after that the crackling was gone!

Today, it's back again and I've realised what the problem is.

Fairly recently, I've started using Standby mode rather than turning my PC off when I've finished with it.

When my machine boots up normally it takes quite a while before you can start using it. If I hit the sleep button instead of the off button last thing at night, when I start up the next day, coming out of Standby mode takes around 10-15 seconds!

This I like...

But, can anyone else confirm that doing this screws up the sound playback in DBC please?

If it's only my machine then I know that with a bit of work, I can fix the problem as I've got used to the quick start-ups.

Or, if you have a way to solve this already, I'd be grateful to hear it.

TDK_Man

Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 5th Feb 2008 00:23
i never turn y pc off

Your signature has been erased by a mod. Reduce the size!
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Feb 2008 01:07 Edited at: 5th Feb 2008 01:57
At the time of writing this I tested your pong program with Standby and DBC using version 1.13 enhanced.
Though I don't experience the problem you described when I went into standby, maybe this will help:

Hardware:
I experienced a similar problem with all sound in general (not even related to DBC) when I set up a dual boot machine for windows and linux. The problem was due to having a sound card installed on a board that had a built in sound card. It had to do with what IRQ either windows or linux tried to use for the sound card. On windows I'd get major distortion (when not cold booting), on linux I'd get no sound at all. One solution was to disable the built in sound card completely in the BIOS. On windows, in the System > Device Manager, I had to remove all references to the built in sound card (assuming I wanted to use my installable one). This was for a more modern machine.

On a more ancient one, where I ran into the same problem, I couldn't disable the built in sound card through the bios, however, the sound card I had was quite old and I could "Hard Code" it's IRQ with jumpers or toggle switches. This way, I could make windows or linux not have to worry about the IRQ of the built in one but always use the hardware IRQ forced on the sound card.

My suspicion in mentioning this approach is that after standby mode, windows does a minor IRQ check at best and uses the first available resources that it finds, unlike a restart which loads drivers and system info matching it to BIOS settings.

Software:
Make sure your sound card drivers are up to date.

I believe as of DirectX 8, DirectSound was deprecated and sound playing abilities were moved to DirectMusic for the most part. Try using load music and play music to see if that makes any difference.

I'm not sure if DBC uses Windows Media (winmm.dll) to play it's sound and midi files, or the directx api (Direct Sound, Direct Music). I think it's winmm.dll. Try running this dll call. I guess I'm trying to prove if DBC's sound commands (after standby) are causing the problem, or if it's the media dll (that I suspect DBC uses) that gets screwed up when DBC is launched and makes the call to play sound. Change <filename> to the name of the wave file you want to play



[EDIT]
Just thought of 1 other thing:
Check your sound card settings. If it is set to play or record at anything higher than 44khz, lower it. Also check that 16 bit is the highest sound resolution. It could be that DBC (as old as it is) can't handle those higher sampling/frequency rates and when windows starts from standby, windows may not do any necessary adjustments for older software in relation to the sound card rates.

Enjoy your day.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 5th Feb 2008 04:29
Quote: "i never turn y pc off"

Me too! I rarely turn my computer off. Normally I only turn my computer off if I download/install something that prompts me to restart my computer.

Seriously, how do you make the little blue text come up below your message?
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 5th Feb 2008 06:29
Just another suggestion to throw into the mix, check the drivers you're running for your sound system. Stuttering/crackling after a sleep/hybernate can also sometimes be attributed to driver problems. Because of DBC's possible higher overall processing needs, a problem like that could just be more apparent in a DBC app. Doesn't always fix it, but updating sound drivers has usually resolved such problems on the few systems running into it that I've provided tech support for.

Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 5th Feb 2008 08:41
this is a common problem , it has to do with resources (windows resources speciffically) - since dbc uses windows decoder/encoder it uses these windows resources, so to keep it simple if your using higher sampling rates, and dont have a fresh start you may have problems with drop-outs. the solution is fairly simple, just reboot to recover the resources. now as to why winamp isn't effected is because it uses its own resources

Login to post a reply

Server time is: 2025-06-04 02:11:32
Your offset time is: 2025-06-04 02:11:32