Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Sound extreme latency and glitchy playback  (Read 2919 times)

0 Members and 1 Guest are viewing this topic.

David82

  • Newbie
  • *
  • Posts: 4
    • View Profile
sf::Sound extreme latency and glitchy playback
« on: July 01, 2014, 01:49:59 pm »
Hi ! We have decided to use sfml audio in our project , however on our older machine (3 ghz singlecore 1gb ram with WinXP SP3) all sounds effects are glitchy (i can't explain this really... its like playing an old scrached CD in the mp3 player)  and there's a very big latency before the sound actually starts playing...

From the other hand, on the newer machine (dualcore 4g ram... WinXP SP3) it works fine no glitches no latency...

The sound effects are small 2-3 scond wav files..
We're using :
- SFML-2.1 32bit (Dynamic libs)
- visual c++ 2008
- WindowsXP SP3

Any help appreciated ! Thanks

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sf::Sound extreme latency and glitchy playback
« Reply #1 on: July 01, 2014, 01:57:17 pm »
You could try updating drivers on the XP machine, especially the audio drivers.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #2 on: July 01, 2014, 01:57:24 pm »
Whenever you run into an issue that might be traced back to SFML, you should go grab the latest version and build SFML from that, just to make sure nothing got fixed in the mean time.
Before or after that make sure your audio driver is up-to-date.

As for the big latency before it starts playing, could you attach a profiler and look where the time is being spent?
Also make sure the OpenAL version that ships with SFML is used and you don't have another version for example in the system32 directory.

For me it however largely sounds like a driver issue.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

David82

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: sf::Sound extreme latency and glitchy playback
« Reply #3 on: July 01, 2014, 04:09:46 pm »
Updated the drivers , now the latency is gone , but that "scratched cd" effect is still there...
We use openal32.dll shipping with sfml. No idea what causes this.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #4 on: July 01, 2014, 04:12:40 pm »
What if you playback sounds from the media player or similar, does it have the same effect to it?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #5 on: July 01, 2014, 04:29:46 pm »
Could it perhaps be related to this: https://github.com/SFML/SFML/issues/310 ?

David82

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: sf::Sound extreme latency and glitchy playback
« Reply #6 on: July 01, 2014, 04:43:03 pm »
Media players gives correct result.
The issue i'm having is  like "shooting a machine gun" .The sound freezes and keep stuttering.
i came to the conclusion that this might be a hardware malfunction or something related to openAl
i will try tomorrow on an another old PC...



Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #7 on: July 01, 2014, 04:48:20 pm »
If a media player works then surely the hardware is OK.
Still sounds to me like it could be related to the non-normalized sample issue I linked to above.
Have you tried re-encoding the file in such a way that samples are normalized an then playing that?

Edit: scratch that. You say it works on another machine, which makes what I said unlikely.
« Last Edit: July 01, 2014, 04:51:08 pm by Jesper Juhl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #8 on: July 01, 2014, 04:51:43 pm »
Still sounds to me like it could be related to the non-normalized sample issue I linked to above.
Have you tried re-encoding the file in such a way that samples are normalized an then playing that?
Doesn't this only apply to OGG files? He's using WAV files.

But still, did you try WAVs from a different source?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Sound extreme latency and glitchy playback
« Reply #9 on: July 01, 2014, 05:01:15 pm »
Quote
Doesn't this only apply to OGG files?
It applies to files with float samples, so it doesn't apply to WAV files for sure.
Laurent Gomila - SFML developer

David82

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: sf::Sound extreme latency and glitchy playback
« Reply #10 on: July 01, 2014, 05:23:18 pm »
Hmmm. i tested it with my old DirectSound based sound library and the same wav file plays perfectly , no glitch no latency.