BlitterStudio / amiberry

Optimized Amiga emulator for Linux/macOS
https://amiberry.com
GNU General Public License v3.0
651 stars 87 forks source link

Garbled Sound #365

Closed annomatik closed 5 years ago

annomatik commented 6 years ago

Describe the bug Hi! I'm running Amiberry 2.12 on a Raspberry Pi 3B+ on RetroPie 4.4 / Raspbian Stretch.

Every Amiga game I run works fine in general, graphics look good, speed is right, etc. But there's one problem: Every Amiga game I run on my setup has garbled sound. The sound sounds totally chopped up and just terrible.

I'm running various emulators, including NES, MAME, SNES, PCEngine, Atari 800, Commodore 64, etc. -- there, the sound is fine. Only in Amiberry, I seem to be out of luck.

Tested games include: -rw-r--r-- 1 pi pi 1595499 Oct 6 22:26 AlienBreed1_v2.3a_0998.lha -rw-r--r-- 1 pi pi 2826399 Oct 6 22:27 AlienBreed2_v1.4_AGA_0044.lha -rw-r--r-- 1 pi pi 1638904 Oct 6 22:28 AlienBreed3D_v1.2_AGA_0624.lha -rw-r--r-- 1 pi pi 2954097 Oct 6 22:29 Banshee_v3.3_AGA_0633.lha -rw-r--r-- 1 pi pi 228666 Oct 6 22:29 BetterDeadThanAlien_v1.1_0462.lha -rw-r--r-- 1 pi pi 863676 Oct 6 22:30 BloodMoney_v1.5a_0302.lha -rw-r--r-- 1 pi pi 135167 Oct 6 22:30 BubbleBobble_v1.1_2518.lha -rw-r--r-- 1 pi pi 1553045 Oct 6 22:32 CannonFodder1_v2.0_0860.lha -rw-r--r-- 1 pi pi 1435113 Oct 6 22:32 CannonFodder2_v1.12_0104.lha -rw-r--r-- 1 pi pi 1686523 Oct 6 22:33 ChaosEngine1_v1.2_AGA_1324.lha -rw-r--r-- 1 pi pi 2467240 Oct 6 22:34 ChaosEngine2_v2.1_AGA_0173.lha -rw-r--r-- 1 pi pi 373943 Oct 6 22:34 CrazyCars1_v1.2.lha -rw-r--r-- 1 pi pi 328250 Oct 6 22:34 CrazyCars2_v1.1_0311.lha -rw-r--r-- 1 pi pi 918976 Oct 6 22:34 CrazyCars3_v2.1.lha -rw-r--r-- 1 pi pi 713334 Oct 6 22:40 DefenderOfTheCrown_v3.1_0317.lha -rw-r--r-- 1 pi pi 1038933 Oct 6 22:41 DeluxeGalaga_v1.1_AGA.lha -rw-r--r-- 1 pi pi 386905 Oct 6 22:41 DeluxePacMan_v1.0_AGA.lha -rw-r--r-- 1 pi pi 2525592 Oct 6 22:42 Dune2_v1.1_1548.lha

and many more, the sound is always chopped up for Amiberry and fine for all the other emulators.

To Reproduce Steps to reproduce the behavior:

  1. Launch any game from the ones above
  2. Sound is broken

Expected behavior Ok sound, not chopped up, just right.

Screenshots Can't screenshot sound.

Desktop (please complete the following information):

Additional context Crossposted here: https://retropie.org.uk/forum/topic/19528/broken-amiberry-sound

midwan commented 6 years ago

@annomatik Do you have the audio out from the Audio Jack, or the HDMI port? Have you tried the other?

annomatik commented 6 years ago

Hi! HDMI, no, haven't tried the other one. Should I just try connecting headphones to the audio jack? Or do I have to change some configuration for that?

midwan commented 6 years ago

@annomatik You'll have to switch the audio-out option in raspi-config (or the /boot/config.txt file) first, then just connect something there (headphones, speakers) and test if that is any different.

I would suspect that it would, since most people (including myself) are using that as audio-out and have not seen this problem. Perhaps it's related to the HDMI-out somehow, we'd just need to make sure.

annomatik commented 6 years ago

Hi midwan, just tried it with the audio-jack output and headphones. Sounds exactly the same, is also garbled.

Some googling resulted in audio problems happening sometimes, if the cpu load is too high, the status indicator shows around 70 % which should be fine. Anything else I can try?

midwan commented 6 years ago

@annomatik OK, at least we can rule that out now :) You mentioned you're running Amiberry v2.12. Could you try updating to the latest, to see if that helps? The latest stable version is currently 2.19 (in the master branch but also as binary releases).

You should be able to upgrade directly from within RetroPie, using their RetroPie-Setup script. Choose either upgrade binary or upgrade from source.

annomatik commented 6 years ago

Hi! Just did a binary update, it updates to 2.18.2 (not 2.19). The sound is still garbled, in addition to that, my config seems to have gone. The screen is no longer the full length, instead, the image is on the top part and the bottom part is black. Also, the control-settings have been deleted, so port 0 no longer has mouse and port 1 no longer has joypad -- no control is configured.

Should I try the source update?

midwan commented 6 years ago

@annomatik If you were using an older config, that might need to be recreated as new options have been added and some of the old ones renamed/removed. I'd recommend you create a new config from scratch for testing this issue at least.

Try updating from source, you should get 2.19 then. But the sound problem still sounds strange to me, considering nobody else has had this (even with 2.12 or older versions). If you have it now, I'm afraid you might still have it after the upgrade (but please test it!).

I suspect it's caused by something else in your system, but I can't guess what at the moment. If we could recreate this it would help a lot.

annomatik commented 6 years ago

Well , another posting with sound problems just popped up: https://retropie.org.uk/forum/topic/19580/amiberry-whload-sound-slow-and-games-laggy

Will try updating from source.

annomatik commented 6 years ago

As expected, updating to 2.19 (via source update) kept the sound garbled. But my config is back :-)

My setup is pretty straight forward: Output: Raspberry PI 3B+ --> TV (Panasonic) --> Soundbar (Sony) Input: Raspberry PI 3B+ <-- Blutooth (External) <-- Controller (8bitDo) and Raspberry PI 3B+ <-- Logitech Unified Dongle <-- Logitech Mouse + Logitech Keyboard

One thing might also be interesting. For a while now, after an update, I keep getting the message "lvl0: VolumeControl::init() - Failed to find mixer elements!" on the console. Could it be that Amiberry is the only emulator affected by that?

Also, I have seen a "SDL2" version of Amiberry, there's also a "SDL1" version, right? Can I find out, which version I'm using? And how it outputs the sound (PCM, ALSA, ...)?

CypherXG commented 6 years ago

Sry. I can not say that the sound is garbled or somthing else. Sound runs with Alsa Mixer. The only thing that i know is: The sound slows down when you use the CPU-Turbo option, because the frames slow down. But with all other CPU options i have no problems. Hey, i'm looking Videos or hear MP3 Files with amiberry. It does no matter which port i'm using. HDMI or Ear Jacket....all of these runs fine. So it must be your System or Midwan said..delete old configs.

annomatik commented 6 years ago

Where can I find old configs?

CypherXG commented 6 years ago

In your amiberry directory you find your configs

midwan commented 6 years ago

Regarding the old configs: This shouldn't really cause bad audio issues, but just in case, you can test it like this:

If the audio problem remains, then the config is not related to this.

annomatik commented 6 years ago

CypherXG: Thanks midwan: Yes, Audio-Problem remains. Also, what I've noticed: If I change the retroarch.cfg, most emulators are affected by that. For example, if I change audio_sync to false, everything runs a lot faster, almost unplayable. The only exception: Amiberry. Even though there is a soft-link of retroarch.cfg to the Amiberry-Directory, it does seem to ignore that configuration?

midwan commented 6 years ago

@annomatik Yes, currently Amiberry only uses retroarch.cfg for picking up the controller configuration, nothing else. This might change in the future, of course. ;)

annomatik commented 6 years ago

Ok, understood. It would be very interesting for me to see the actual used Amiberry configuration compared to the one in Retroarch itself.

HoraceAndTheSpider commented 6 years ago

Have you checked that frameskip is not enabled in your host Config settings ?

midwan commented 5 years ago

@annomatik in case this is still ongoing (and if not, please let us know so we can close the issue!), it might be worth checking the relevant FAQ entry I recently added:

https://github.com/midwan/amiberry/wiki/FAQ

Q: Audio is noticable distorted when playing back with USB audio device instead of 3.5mm audio jack

A: Check if you're using a GPIO kernel module, which imposes some latency. Normally there shouldn't be any difference in audio latency from Amiberry, regardless if you're using the 3.5mm audio jack, HDMI-out, or a USB audio card.

midwan commented 5 years ago

Closing this due to lack of feedback. If it's still an issue, please come back and we'll take another look.

annomatik commented 5 years ago

Hi! I'm not using USB, I'm using Audio via HDMI. The Sound works in the NES Emulator, C64 Emulator, Genesis Emulator, SNES Emulator, Odyssey 2 Emulator, Turbografx-16 Emulator, Kodi, in Chrome and in pretty much everything except Amiberry.

CypherXG commented 5 years ago

More info about your System? Normally there are no Sound issues with amiberry. I'm using HDMI, and 3,5mm also.

annomatik commented 5 years ago

Please see first line: "Hi! I'm running Amiberry 2.12 on a Raspberry Pi 3B+ on RetroPie 4.4 / Raspbian Stretch."

What other information can I provide?

Punisa1 commented 5 years ago

I'm having the EXACT same problem as Annomatik. My observations: 1) It was running fine, but after some time (me updating, installing all kinds of stuff to my Raspberry Pi 3B+) sound became "garbled" 2) What does it sound like? As if you would slow down a YouTube video to 0.25 speed - distortion, echo, reverb... really bad. BUT it does run at full speed and video runs great (can't notice any skipping in video/frames) 3) All other emulators run great regarding the sound, this problem occurs only with Amiberry 4) I tried whload and ADF files: same problem 5) I tried many different Amiga games: same problem 6) Tried various BIOS files: same problem 7) Tried with headphones, HDMI, different audio setups (TV, sound system): same problem 8) Tried all options in Amiberry configuration panel (sound frequencies etc): same problem 9) After doing all I could, and researching all the forum entries (seems that there are indeed very few people with this problem - or they don't speak up), I made a clean install: problem went away... for some time. Again, I went on with Raspberry experimenting and 2 days later problem came back. Unfortunatly I wasn't playing games all the time so I can't pinpoint when/why the problem arose again. 10) I tried updating everything (RetroPie, EmulatioStation, Amiberry - binary and source): same problem

Possible reasons:

I'll try another backup of my SD card and will report further. Hopefully we can get to the bottom of this.

CypherXG commented 5 years ago

Amiberry 2.12 is really old. There are many changes, also audio changes after 2.12. Try to update to latest version.

Punisa1 commented 5 years ago

Amiberry 2.12 is really old. There are many changes, also audio changes after 2.12. Try to update to latest version.

Hello CypherXG, Already updated, my version is v.2.24 (2019-01-14).

midwan commented 5 years ago

@Punisa1 This doesn't look like an emulator-specific issue, but rather something happening/changing in the system, in combination with how Amiberry outputs sound. It doesn't look like the version of the emulator is relevant also, from what I understand.

We use SDL(1/2) for sound output, so it's nothing special and unique for Amiberry. Other applications using the same method should experience the same problem - this excludes Libretro cores for example.

It may be related to something getting configured/installed in the background, that causes this. It's hard to know for sure, since we cannot recreate it and have very few (basically I've only heard of two so far, including yours) reports of this happening.

We need to isolate this, and discover what is causing it. To do that, we'd need someone who can recreate it (since we cannot) to track down each step from a clean installation until the point where the problem starts happening.

midwan commented 5 years ago

I'm closing this for now, since we did have any further activity, and nobody I know can recreate it. Feel free to come back with more details that might help if it's still an issue.

Zibo99 commented 3 years ago

I had the same Problem on my Pi 4 with Retropie. All other emulators were fine but Amiberry. At the end i found out that Amiberry runs only with 30FPS on my Samsung TV. I enabled 4Kp60 resolution on HDMI0. Now the Sound is perfect.

piotrorlowski commented 3 years ago

@midwan

Connected Bluetooth speakers in Pi OS, tested and in terminal, I can play some wav file.

When running amiberry (specifically PiMiga on my Pi 400) there is no sound.

How can I output sound in amiberry to my Bluetooth device?

I've tried many things already and I managed to make a successful connection in Linux with my speakers by Bluetooth and play some music, but after running PiMiga there's no sound at all.

Is this only limited to HDMI and USB output?

P.S.

Sorry to put this here, if there's a need I can create another issue.

midwan commented 3 years ago

@piotrorlowski Amiberry outputs sound using whatever the system is using, it doesn't do anything special in that regard. If SDL2 can use it, then Amiberry can use it also. You might get more help regarding this from the Pimiga people however, as it's not related to Amiberry itself.

piotrorlowski commented 3 years ago

@midwan ok, thanks for explaining though I thought that PiMiga is generally only a modified classic workbench with pre-installed stuff and it runs on the Amiberry emulator. I hoped that there might be some settings responsible for sound input/output in Amiberry :) I'll ask somewhere else then. :)

midwan commented 3 years ago

It's a modified distro as well, so anything related to the operating system should be checked with them first... ;)

zenrael commented 1 year ago

Hey, just FYI - the issue is that the bluetooth speaker is not available when pimiga boots. Once the bluetooth is connected, you need to quit pimiga, then restart it, then select the bluetooth speaker in amiberrys sound options. Hope that helps.

@midwan

Connected Bluetooth speakers in Pi OS, tested and in terminal, I can play some wav file.

When running amiberry (specifically PiMiga on my Pi 400) there is no sound.

How can I output sound in amiberry to my Bluetooth device?

I've tried many things already and I managed to make a successful connection in Linux with my speakers by Bluetooth and play some music, but after running PiMiga there's no sound at all.

Is this only limited to HDMI and USB output?

P.S.

Sorry to put this here, if there's a need I can create another issue.