我有一个运行Ubuntu Server 16.04的VM。我正在尝试使其通过UGreen USB音频适配器(特别是this)播放音频文件。目的是通过REST API使用它,但是我什至无法播放任何音频。设置了ALSA和PulseAudio。
运行aplay -l
返回:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 0: Generic Analog [Generic Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
我还使用pacmd
将USB音频设备设置为pulseaudio中的默认接收器:
$ pacmd stat
Memory blocks currently allocated: 1, size: 63.9 KiB.
Memory blocks allocated during the whole lifetime: 451335, size: 1.1 GiB.
Memory blocks imported from other processes: 0, size: 0 B.
Memory blocks exported to other processes: 0, size: 0 B.
Total sample cache size: 0 B.
Default sample spec: s16le 2ch 44100Hz
Default channel map: front-left,front-right
Default sink name: alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
Default source name: alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
Memory blocks of type POOL: 1 allocated/223545 accumulated.
Memory blocks of type POOL_EXTERNAL: 0 allocated/0 accumulated.
Memory blocks of type APPENDED: 0 allocated/0 accumulated.
Memory blocks of type USER: 0 allocated/0 accumulated.
Memory blocks of type FIXED: 0 allocated/193538 accumulated.
Memory blocks of type IMPORTED: 0 allocated/34252 accumulated.
使用mpg123以-o pulse
或-o openal
作为选项播放音频文件不会将音频输出到扬声器。我也尝试过其他球员。
但是,完全相同的配置在另一台我可以访问的机器上完成时,确实会将音频输出到扬声器。该机器正在运行Ubuntu Desktop 16.04(不在VM上)。我无法确定问题所在。任何见解都会有很大帮助。