Comments (16)
I'm running this on an AML-S905X-CC which is roughly equivalent to a Pi 3b+. It works but maxes out the cpu at all times. Try running the top
command and see if there are multiple Python processes running near the top of that list. If so, try connecting a move controller, it should light up white, even if you have no sound. If that works, I have a workaround if it's only a sound issue.
from joustmania.
A couple chunks of the log file
fatal: detected dubious ownership in repository at '/home/pi/JoustMania'
To add an exception for this directory, call:
git config --global --add safe.directory /home/pi/JoustMania
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
fatal: detected dubious ownership in repository at '/home/pi/JoustMania'
To add an exception for this directory, call:
git config --global --add safe.directory /home/pi/JoustMania
Ran
sudo git config --global --add safe.directory /home/pi/JoustMania
as instructed, which resolved the above error. Is this for auto updates?
Press CTRL+C to quit
logname: no login name
Process Process-4:
Traceback (most recent call last):
File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/JoustMania/piaudio.py", line 132, in audio_loop
format=alsaaudio.PCM_FORMAT_S16_LE, periodsize=PERIOD, device='default')
alsaaudio.ALSAAudioError: Device or resource busy [default]
ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred
And the audio error. I have tried installing pulse, but it dosen't seem to resolve the issue.
Without the game installed, pushing sound to alsa works just fine. Le potato uses I2S rather than PCM for control (but not transmission?) of audio sent to the 3.5mm jack codec. Testing wav files included with the game works fine when the game isn't running, so I don't think its a PCM_format issue.
from joustmania.
So I'm trying to see if there are 2 sound operations happening at once when starting the program.
It appears that piaudio.py
def InitAudio():
pygame.mixer.init(47000, -16, 2 , 4096)
does initialize the audio settings. Changing these values changes the output to the soundcard.
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 4160
buffer_size: 12480
I've experimented using different settings such as using 48000 or 44100. Both settings result in RW_INTERLEAVED being output instead of MMAP. It appears that the InitAudio is started from both update.py and piparty.py.
from joustmania.
Interesting work! There might be some settings that could improve performance, the period might also work, Joustmania did used to run on a pi3, but the modules have been updated since then too. One way that could also work is to have a setting in the yaml settings that disables the audio changing speeds, thus reducing the load on the cpu.
from joustmania.
Thanks! I've commented out all calls to update.py and all references to performing updates. It does not appear to be an issue with the update.py conflicting with piparty. But I'm still not sure I completely understand everything.
I'll try messing with the audio speed change, but cpu seems to be maxed out even in the menu before those speed changes would happen.
from joustmania.
So I've messed with audio a bit, voices are now working while background audio is not. Still getting
alsaaudio.ALSAAudioError: Device or resource busy [default]
Are the voices and the music given to separate mixers? (simultaneously trying to grab exclusive access)
Also, now when starting a match and then ending it, the system drops to only 80% CPU usage in the main menu and one of the 3 heaviest python3 processes disappears. Sometimes on game exit, things hang and a python process gets left running, killing it manually throws a piaudio error. It seems to confirm that the background audio is malfunctioning and is chewing up the CPU. Maybe preprocessing of audio?
from joustmania.
I have tried running pulseaudio in system-wide mode and now /proc/asound/card0/pcm0p/sub0/hw_params reads
MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 44096
buffer_size: 88192
This is consistent with what I would expect from pulseaudio. However, I still see the "Device or resource busy" error.
The strange thing is that if I set device = alsaaudio.PCM(device='null')
in piaudio.py, the busy error goes away as expected HOWEVER, the narrator and sound effects STILL PLAY. How can this be if I have set the sound device to null? Are the sound effects and voices using different code (sound mixer) than the background music?
from joustmania.
The sound effects and narrator are using pygame to play them, that's probably why you are seeing that I would think!
from joustmania.
I tried using system libraries instead of venv, with varying results. I tried feeding pygame.mixer.init(47000, -16, 2, 4096, devicename='null')
but couldn't get it to accept any device names I threw at it when in the virtual env. It will accept some names when using system libraries, but it doesn't seem to make changes (system libraries are up to date). This would be the elegant solution if I could get it to work.
Eventually I tried just forcing dmix systemwide via /etc/asound.conf. This works!!, but narration is a little scratchy. Now that I understand what is happening, I'll test out some different configs to see what performs best.
EDIT: I got everything working on my fork.
from joustmania.
Interesting work! There might be some settings that could improve performance, the period might also work, Joustmania did used to run on a pi3, but the modules have been updated since then too. One way that could also work is to have a setting in the yaml settings that disables the audio changing speeds, thus reducing the load on the cpu.
Does this mean it will no longer work on the Pi 3? I've been trying to run it on one, and it reboots after install, but nothing happens.
from joustmania.
I don't think there is anything theoretically stopping it from running on a pi3, I have only tested on pi4s since they launched. @DrDecagon may have the closest solution. The cpu is usually maxed on a pi4 as well.
Also recently the price of pi4s has started to decrease! Hopefully this is a trend
from joustmania.
I noticed the prices had dropped too, so I picked up a pi4 since it seemed like it would run better there anyway.
I'm able to run the ./setup.sh command and it successfully reboots, however it doesn't reboot into the game, and controllers don't pair.
Is there another command I should be running to get the game to run?
from joustmania.
You can try sudo ./joust.sh to run joust in a terminal and see if there are any issues(this also could be why it's not running on the pi3 at the moment)
from joustmania.
That did it thanks! Now to fix the sound issue. I've got controllers paired, but no sound yet.
from joustmania.
A simple solution that might work, is making sure that the audio output is through the headphone jack(usually the top right corrner of the screen there is a sound option) and that you have headphones plugged in too.
from joustmania.
That did the trick! Thank you so much.
from joustmania.
Related Issues (20)
- use python3
- Missing dependencies:
- Error on pygame.mixer.init HOT 10
- Audio Documentation HOT 2
- Bluetooth failing to start on debian due to SAP (sap-server: Operation not permitted) HOT 1
- pygame.error: mixer not initialized HOT 2
- kill_processes.sh and reset_bluetooth_connections.sh not working as expected. HOT 7
- PS4 Move controller not fully pairing. HOT 2
- CPU at 100% during game
- Auto - exclude charging controllers HOT 2
- try upgrading to python 3.12
- Joust Mania python install error HOT 3
- Trying to start a game with controller charging throws error HOT 9
- Update to raspberry pi 5 HOT 1
- PS3 Controller pairing not working correctly HOT 4
- set asound.conf to the headphones on joustmania startup HOT 1
- update location of disabling internal bluetooth for bookworm HOT 1
- kill game on webui is broken
- Update joustmania to switch bonded config to false HOT 1
- Music stopped changing speeds HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joustmania.