Hi guys...
Got the Amp+ to work on 5/5/2015 Fresh Raspbian.
A sample MP3 is playing with success with "mplayer" in the Speakers.
Now that i know the Pi and AMP+ are working together, i went back to my project ("Music on hold" audio player)
This project is coded in Python using Pygame as an Audio Module.
When i started the Python App (that was working properly with the Pi standard 3.5mm audio connector prior to the AMP+ Install)
The Python app react properly on screen, but faint static is heard in the Speakers.
When i Kill the Python App, the Static stops.
Here is the result of aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_amp], device 0: HifiBerry AMP HiFi tas5713-hifi-0 []
Subdevices: 0/1
Subdevice #0: subdevice #0
The (simplified) python code is:
import pygame
pygame.mixer.init()
pygame.mixer.music.load("123.mp3")
pygame.mixer.music.play()
**Loop while playing**
pygame.mixer.stop()
pygame.mixer.quit()
I have a visual progress bar that follows the playback speed, but only faint static is heard in the speaker.
The Python App would not run until i deleted the /etc/asound.conf
It was complaining it was old or currupted (deleted it and rebooted)
Any ideas?
Thanks
NJ
Date
Votes
8 comments
-
HiFiBerry team Hi NJ,
unfortunately I don't have any idea what could be the problem here. Somebody from the pygame developers have to look into this as I don't know anything about the internals of this software. I recommend contacting then, maybe they have an idea where to look and what to change.
Best regards
Daniel -
Nicolas Jacques Ho! i just realized Pygame is initialized at 22k by default and HifiBerry works at 44.1K.
Let me test that again while forcing at 44.1k... -
HiFiBerry team This could be the reason for the problem.
BTW: I wonder why anybody would use 22k sample rate by default.
Best regards
Daniel -
Nicolas Jacques Hi again,
Tried initializing Pygame Mixer at 44.1K with no change in behaviour.
I will try to contact them.
in the mean time:
-Can you propose a python audio library that is known to properly outputs MP3 files to HifiBerry AMP+?
-I am trying to find/create a 'mplayer' (in Slave mode) python control wrapper so that the Python app just send command to a known working HifiBerry AMP+ media player.
i'll keep you posted...
NJ -
HiFiBerry team Many distributions use mpd as player backend. It can be remotely controlled. However, I don't know if there is a Python library for it.
Best regards
Daniel -
Nicolas Jacques Hello Again!
Looked into mpd that i did not know about.
Got mpd (server) installed. Confirmed functionality with shell command trough mpc (client).
Then, using python-mp2 library, I was able to control mpd properly, using python Scripting.
I think it will be a better implementation than my previous Pygame attempt.
And all this works properly with a really nice sound on the HifiBerry AMP+
Thanks to all!
NJ -
HiFiBerry team Good to hear this.
Enjoy your sound and let us know about your final implementation. It could be also interesting for other users.
Best regards
Daniel -
Alex Bjørlig Hi Nicolas Jacques.
I'm trying to setup the Amp+ to play mp3 files with Python.
Can you maybe share the code you used with the python-mp2 library?
Thanks in advance.
Please sign in to leave a comment.