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

Author Topic: Disable automatic attack with Sound.play() ?  (Read 2747 times)

0 Members and 1 Guest are viewing this topic.

Plento

  • Newbie
  • *
  • Posts: 2
    • View Profile
Disable automatic attack with Sound.play() ?
« on: March 05, 2023, 03:55:06 am »
Hello, I've been using sfml to play raw audio data and I found that using Sound.play() automatically adds a small attack (around 4 ms) to the sound (I assume to prevent clicks and pops). Is there any way to disable this feature? If this isn't what's going on, is there a reason this is happening?

The attached image, shows two sine waves played back to back. You can see where one ends and the other starts because its "ramping up" the volume over a short time, which I'd like to remove.
My code simply fills an audio buffer with a sine wave. No attack code on my end.

Thank you!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11008
    • View Profile
    • development blog
    • Email
Re: Disable automatic attack with Sound.play() ?
« Reply #1 on: March 05, 2023, 06:17:10 pm »
Hmm there was a discussion once, but unfortunately I could find it (only found this one), which I believe tracked it back to an issue in OpenAL-soft, as such I'd recommend to try and update openal-soft to the latest version (consider rebuilding SFML) and see if the issue persists.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Plento

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Disable automatic attack with Sound.play() ?
« Reply #2 on: March 06, 2023, 07:12:26 am »
I rebuilt SFML from source which didn't change anything unfortunately. I'm unfamiliar with openal-soft, how would I go about updating it for SFML?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11008
    • View Profile
    • development blog
    • Email
Re: Disable automatic attack with Sound.play() ?
« Reply #3 on: March 06, 2023, 09:53:27 am »
You can grab the source and build it from source as well and then replace the files in extlibs (for Windows or macOS): https://github.com/kcat/openal-soft
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/