Sound isn't working

BlitzMax Forums/BlitzMax Programming/Sound isn't working

Blitzogger(Posted 2011) [#1]
I am working on getting sound into my game as well as a few other things. However for some reason my sound isn't playing despite knowing that it loaded successfully. I have check my sound card to make sure it is working by playing music on my pc and it works. I have posted a link to the latest source code below. Any assistance in this matter would be greatly appreciated.

Sincerely,

Blitzogger

link to source

Last edited 2011


Jesse(Posted 2011) [#2]
it works on my mac fine on my mac but I had to comment out the line with the setIcon. Active window doesn't work with mac.
sound plays fine here. maybe a little lag probably a bit of silence at the beginning of the sound file.

Last edited 2011


Midimaster(Posted 2011) [#3]
If you comment out...

?Win32
'Framework BRL.D3D7Max2D
SetGraphicsDriver D3D7Max2DDriver()
?


..it will work on Windows too. So I think it is a problem of a missing Import.

additional hint:

your sound starts to late, there are 500msec of silence at the beginning. Open the sound with the free "audacity" and trim the sound. This will bring more synchronization between making noise and displaying the crash.

Also at the end of the sound from msec=3300 there are 600msecs of silence: Cut it. The file will get 25% smaller.

Use ogg-files for sound. This will shrink the file to 10% of original size-

Last edited 2011


Blitzogger(Posted 2011) [#4]
Update:
The solution to this very common problem when using Ogg Vorbis for playback of .ogg files can be found here. I am leaving this post up in hopes that others can benefit from it.


If you comment out...

?Win32
'Framework BRL.D3D7Max2D
SetGraphicsDriver D3D7Max2DDriver()
?



..it will work on Windows too. So I think it is a problem of a missing Import.


Yikes, your right. I'm using the latest version of Framework assistant and it's producing the following output for the DirectX template:

Framework BRL.D3D7Max2D
Import BRL.Random
Import BRL.System
Import BRL.FreeAudioAudio
Import BRL.PolledInput
Import BRL.Retro
Import BRL.Stream
Import BRL.FileSystem

' modules which may be required:
' Import BRL.PNGLoader
' Import BRL.BMPLoader
' Import BRL.TGALoader
' Import BRL.JPGLoader
' Import BRL.WAVLoader
' Import BRL.OGGLoader


SetGraphicsDriver D3D7Max2DDriver()

I tried the folloeing to no avail:
Framework BRL.D3D7Max2D

'import required libraries
Import BRL.FileSystem
Import BRL.FreeAudioAudio
Import BRL.PNGLoader
Import BRL.PolledInput
Import BRL.Retro
Import BRL.Random
Import BRL.Stream
Import BRL.System
Import BRL.OGGLoader

SetGraphicsDriver D3D7Max2DDriver()

Could Framework Assistant be missing imports and need to be updated for the new BlitzMax 1.42 update?


additional hint:

your sound starts to late, there are 500msec of silence at the beginning. Open the sound with the free "audacity" and trim the sound. This will bring more synchronization between making noise and displaying the crash.

Also at the end of the sound from msec=3300 there are 600msecs of silence: Cut it. The file will get 25% smaller.

Use ogg-files for sound. This will shrink the file to 10% of original size-


Done.

Sincerely,

Blitzogger

Last edited 2011


Midimaster(Posted 2011) [#5]
I can not confirm any problems with OGG-files. We are entirely focusing on producing software with music content and never had problems in using OGG-files. They are working reliable and of high quality.

But we never shrink the code with "framework" commands. In larger projects there is nearly no reduction effect, because nearly all moduls are used at least once. Because we include all data files with incbin the size of the EXE often is more than 5MB. At the end you could save max 200k with framework technique. This is not worth the trouble you will have with it.

My suggestion: Do not use Frameworks.


SLotman(Posted 2011) [#6]
The delay has nothing to do with the sound files. The Freeaudio driver has this delay. Just use DirectSound or OpenAL, and the delay is gone.


matt!(Posted 2011) [#7]
Thanks for this.