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

Author Topic: Static/popping noises on Raspberry Pi 3  (Read 5002 times)

0 Members and 1 Guest are viewing this topic.

DojoMike

  • Newbie
  • *
  • Posts: 9
    • View Profile
Static/popping noises on Raspberry Pi 3
« on: October 25, 2018, 05:11:59 am »
Hey guys, what's up? :)

I've been messing with the Raspberry Pi a lot lately, and I found it supports SFML, so I've been having a lot of fun with that (lol).  Anyway, I notice when I use the audio API, there is a sort of static / popping type noise in the background when sound is playing.

Here are some details on my system: it's a Raspberry Pi 3, purchased in March/April of this year (so it's running a relatively new version of Raspbian, though I'm not sure how to get an exact version number).  I'm also using a USB headset, and I haven't connected an HDMI monitor (getting sound to play on HDMI was another rabbit-hole of obscure config files and random forum posts, lol - I did eventually crack it, so chances are there's some related setting in some equally obscure config file, but for now that should not be a factor since I'm not using HDMI at the moment).
And here's an example of my code:
sf::SoundBuffer buff;
buff.loadFromFile("/home/my_username/Desktop/test.wav");
sf::Sound test(buff);

// Then in my event loop, on key press
test.play();
What's interesting is if I just do
system("play /home/my_username/Desktop/test.wav");
the sound plays with no popping/staticky sounds.  So I know it's not my headset or the Pi.  Maybe it does ".ogg" or some other format better?  idk... anyway, I've Googled myself stupid and created several useless config files, and nothing seems to work.  Has anyone else hear dealt with this?  Thanks in advance.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static/popping noises on Raspberry Pi 3
« Reply #1 on: October 25, 2018, 05:28:20 am »
There was a wav bug a while back. It was about a pop/ear destroying at the end for some wav files due to reading metadata (like what program made it) as samples.

1. What version of SFML is this? Did you build it itself or install it from repo or download it from somewhere?

2. Can you attach the wav?

3. Does it happen with other formats?

4. Can you describe the popping/static a bit better (all the time vs. at the end is most important to me right now)?
Back to C++ gamedev with SFML in May 2023

DojoMike

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Static/popping noises on Raspberry Pi 3
« Reply #2 on: October 25, 2018, 05:45:35 am »
Wow, thanks for the quick response!  I will try to answer your questions:

1. I installed SFML from the package manager ("sudo apt-get blah blah blah" lol).  I only did this a couple days ago, so I'm pretty sure it's the current version (though again, I'm not sure how to stick an exact number on it).

2. I will see if I can get it off the Pi and send it to you; but unfortunately, there is no way to send the version with the noises (it would just be the original one I downloaded).

3. I just tested it with a ".ogg" file and had the same problem.  So I think we can rule out the wav bug.

4. The noises happen during playback at seemingly random intervals (not just at the end).  The only thing I can compare it to is the sound you would hear if you unplugged the headphones.

By the way, I also found some text being printed to stdout that I wasn't seeing before, that might be useful:
Setting vertical sync not supported
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::JackShmReadWritePtr - init not done for -1, skipping unlock
JackShmReadWritePtr::JackShmReadWritePtr - init not done for -1, skipping unlock

This of course means nothing to me, apart from random things I can guess from the text (obviously, some component is trying to connect to some other component, with a client/server model, and some pointer for reading and writing something has some other mysterious problem.  I'm sure the SFML dev team would understand it, whatever it means. :)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static/popping noises on Raspberry Pi 3
« Reply #3 on: October 25, 2018, 06:03:44 am »
I meant the original wav file, yes. But if it's not a wav specific bug then don't bother, it's not the problem with the file.

SFML just wraps OpenAL, it doesn't do much special things other than some threading with Music and reading few audio formats and uploading it to OpenAL, but maybe there is a problem with how it calls OpenAL. I've heard the name JACK (and ALSA and PulseAudio) before but I've no idea what these error means.
Back to C++ gamedev with SFML in May 2023

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static/popping noises on Raspberry Pi 3
« Reply #4 on: October 25, 2018, 06:23:13 am »
By the way, there is a user config fix mentioned (I Googled for it) and exploiter (he's on the team and mostly on top of things) even referenced it for inclusion on the website later: https://github.com/kcat/openal-soft/issues/53

You can try it. I'm not sure if it's these failed jack attempts causing these cracks or if there's something else wrong.
Back to C++ gamedev with SFML in May 2023

 

anything