Hallo liebe Maker,
Zuerst mal mein Setup:
- Raspberry Pi 3 Model B ARM-Cortex-A53
- Raspberry Pi 7-inch touch screen display
- HiFiBerry Amp+
- WiFi USB 802.11n
- LEICKE Netzteil 60W 12V 5A
Der Sound funktioniert soweit -> "mplayer http://hi5.death.fm" spielt mir schöne Lieder. Alsamixer funktioniert auch.
Ich möchte aber nette sounds in meiner LCARS-Oberfläche ausgeben (https://github.com/StowasserH/pylcars) Das mache ich wie folgt:
Python
import pyaudio
import wave
class Lcars(QtGui.QMainWindow):
def sound(self, file):
CHUNK = 256
wf = wave.open(file, 'rb')
# define callback (2)
def callback(in_data, frame_count, time_info, status):
data = wf.readframes(frame_count)
return (data, pyaudio.paContinue)
# open stream using callback (3)
stream = self.wav.open(format=self.wav.get_format_from_width(wf.getsampwidth()),
channels=wf.getnchannels(),
rate=wf.getframerate(),
output=True,
frames_per_buffer=CHUNK,
stream_callback=callback)
stream.start_stream()
def __init__(self, parent=None):
self.wav = pyaudio.PyAudio()
Display More
Das funktioniert auch auf meinem Desktop. Allerdings bekomme ich auf dem PI folgende Fehlerausgabe:
Code
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: Datei oder Verzeichnis nicht gefunden
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: Datei oder Verzeichnis nicht gefunden
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: Datei oder Verzeichnis nicht gefunden
ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: Datei oder Verzeichnis nicht gefunden
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=Datei oder Verzeichnis nicht gefunden)
attempt to connect to server failed
Traceback (most recent call last):
File "kueche.py", line 31, in menu_click
self.sound('Sounds/computerbeep_9.wav')
File "/home/pi/kueche/pylcars/pylcars/lcars.py", line 54, in sound
stream_callback=callback)
File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
IOError: [Errno -9996] Invalid output device (no default output device)
Display More
Weiß jemand wie ich die Karte auch unter Python zum laufen bekomme?
Ach ja. Aplay sagt übrigens folgendes:
Bash
pi@Kuechenbox:~/kueche $ aplay Sounds/computerbeep_9.wav
Wiedergabe: WAVE 'Sounds/computerbeep_9.wav' : Unsigned 8 bit, Rate: 22050 Hz, stereo
aplay: set_params:1299: Sample-Format nicht unterstützt
Available formats:
- S16_LE
- S24_LE
- S32_LE
Währe cool wenn mir jemand helfen könnte.