- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 PyGame 在带有 python3 的 Raspberry Pi4 上播放旧的音频 cd 收藏。
据我所知,cd audio 的数据结构与声音或流媒体不同,并且音频 CD 不像数据 CD 那样安装在文件系统中,因此需要特殊处理。
以下非常简单的程序在 Windows 10 下从 Python 的命令行以及 PyCharm IDE 中运行:
PS C:\Users\manfr> python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pygame import cdrom
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> import pygame
>>> import time
>>> pygame.init()
(6, 0)
>>> cdrom.init()
>>> cdrom.CD(0).init()
>>>
>>> i = 0
>>> while i == 0:
... cdrom.CD(0).play(5)
... time.sleep(10)
... i = 1
... cdrom.CD(0).stop()
...
>>>
from pygame import cdrom
import pygame
import time
pygame.init()
cdrom.init()
cdrom.CD(0).init()
i = 0
while i == 0:
cdrom.CD(0).play(5)
time.sleep(10)
i = 1
cdrom.CD(0).stop()
D:\Python-Programme\gui-beispiel\venv\Scripts\python.exe "D:/Python-Programme/gui-beispiel/CD-Project/Thread Test 10 PyGame playlist vereinfacht.py"
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Process finished with exit code 0```
And now the same code starting in the 'Python Console' of PyCharm.
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> #!/usr/bin/python3
... import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> from pygame import *
>>> from pygame import cdrom
>>> import time
>>>
>>> pygame.init()
(6, 0)
>>> cdrom.init()
>>> cdrom.CD(0).init()
>>>
>>> i = 0
>>> while i == 0:
... print('cdrom bussy, but I hear no music')
... cdrom.CD(0).play(5)
... time.sleep(20)
... i = 1
... cdrom.CD(0).stop()
... print("no idea what's went wrong :-(")
...
cdrom bussy, but I hear no music
no idea what's went wrong :-(
>>>
pi@raspberrypi:~ $ speaker-test -t wav -c 2
speaker-test 1.1.8
Playback device is default
Stream parameters are 48000 Hz, S16_LE, 2 channels
WAV file (s)
Rate is 48000 Hz (requested: 48000 Hz)
Buffer size from 480 to 32768
Period size from 480 to 32768
Use maximum buffer size 32768
Periods = 4
set: period_size = 8192
set: buffer_size = 32768
0 - Front left
1 - Front right
pi@raspberrypi:~ $ omxplayer /home/pi/test.wav
Audio codec pcm_u8 channels 1 samplerate 11025 bitspersample 8
Subtitle count: 0, state: off, index: 1, delay: 0
have a nice day ;)
pi@raspberrypi:~ $ omxplayer /home/pi/song1.mp3
Audio codec mp3float channels 2 samplerate 44100 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
have a nice day ;)
alsamixer
显示,vlc 与 ALSA 成功通信。例如。我可以改变响度。
┌────────────────────────────── AlsaMixer v1.1.8 ──────────────────────────────┐
│ Gerät: bcm2835 ALSA F1: Hilfe │
│ Chip: Broadcom Mixer F2: System-Informationen │
│ Ansicht: F3:[Wiedergabe] F4: Aufnahme F5: Alle F6: Soundkarte auswählen │
│ Element: PCM [dB-Änderung: -9,58] Esc: Beenden │
│ ┌──┐ │
│ │ │ │
│ │▒▒│ │
│ │▒▒│ │
│ ├──┤ │
│ │OO│ │
│ └──┘ │
│ 59 │
│ < PCM > │
└──────────────────────────────────────────────────────────────────────────────
最佳答案
PyGame 仅控制音频 CD(播放、暂停、停止等)。音乐本身必须取自 CDROM 的音频输出!较旧的设备确实有这样的输出,但我从未见过具有这种音频输出的新 USB 驱动器。所以我不能在我的项目中使用 PyGame。希望我的错能帮助其他人不要落入同一个陷阱。
关于python-3.x - 使用 ALSA 在 RaspBerry Pi 4+ 上使用 PyGame 的音频 cdrom 没有声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61759327/
我怎样才能让 Linux 在不弹出 CDROM 的情况下更新它对 CDROM 大小的想法?换句话说,如何在不先弹出的情况下安装新刻录的 CDROM? 我正在对 CDROM 进行无人值守的增量备份。 m
有谁知道在 Windows 2000 或更高版本上以编程方式关闭 CD 托盘的方法?打开 CD 托盘存在,但我似乎无法关闭它,尤其是在 W2k 下。 如果可能的话,我特别想从批处理文件中寻找一种方法来
我尝试使用 DeviceIoControl 函数(Win32 API 函数)弹出我的 CDROM 驱动器,当我的 CDROM 驱动器没有磁盘时它工作正常,但是在插入磁盘后,Marshal .GetLa
我需要在 Linux 上用 C 语言编写函数来访问所有安装的 CDROM 并执行一些操作。 我可以在 BSD 上使用 count = getmntinfo(&buf, 0); 并在所有设备上循环并检查
我正在构建一个 docker 镜像,其中还涉及一个小的 yum install .我目前在防火墙和访问控制使docker pull 的位置。 , yum install等非常慢。 在我的例子中,它是一
当用户在 Linux 平台上插入或取出 CD 时,是否有一种干净的方法来检测或接收事件? 最佳答案 udev 监控硬件并将事件转发给 dbus。你只需要一些 dbus 监听器。使用 dbus-moni
我正在尝试使用 Python 模块(准确地说是 python-dvdvideo)来克隆 ISO 镜像。如果我将我的计算机上已有的 ISO 文件的文件路径传递给它,所提供的类工作正常,但如果我尝试将我的
我正在寻找一个在 Linux 上运行的 C++ 中创建的函数,如果 CDRom 媒体是 DVD,则返回 true,如果是其他任何媒体(例如音频 CD),则返回 false。 我一直在使用 ioctl
在 Linux 中检测 CDROM 介质移除和插入的最简单方法是什么?我想写一些简单的代码来处理这个问题。例如,只需为媒体插入绑定(bind)一个事件并实现处理程序。 谢谢! 最佳答案 尝试man u
2017 年 10 月 4 日更新:请参阅下面我的回答。感谢 DanielB,因为如果没有 Daniel 的帮助我无法解决问题,所以我将接受他的回答而不是我自己的回答。 我是 libvirt 和系统管
我尝试使用 PyGame 在带有 python3 的 Raspberry Pi4 上播放旧的音频 cd 收藏。 据我所知,cd audio 的数据结构与声音或流媒体不同,并且音频 CD 不像数据 CD
我是一名优秀的程序员,十分优秀!