Difference between revisions of "WM8960 Audio HAT"
(→FAQ) |
|||
Line 1: | Line 1: | ||
+ | <div class="tabber"> | ||
{{Infobox item | {{Infobox item | ||
|img=[[File:WM8960-Audio-HAT-1.jpg|300px|alt=WM8960 Aydui HAT|link=https://www.waveshare.com/wm8960-audio-hat.htm]] | |img=[[File:WM8960-Audio-HAT-1.jpg|300px|alt=WM8960 Aydui HAT|link=https://www.waveshare.com/wm8960-audio-hat.htm]] | ||
Line 10: | Line 11: | ||
|interface2=I2S | |interface2=I2S | ||
}} | }} | ||
− | == Introduction == | + | <div class="tabbertab" title="Introduction"> |
− | WM8960 | + | {{WM8960 Audio HAT Spec}} |
− | + | </div> | |
+ | <div class="tabbertab" title="User Guides"> | ||
+ | {{WM8960 Audio HAT Guide}} | ||
+ | </div> | ||
+ | <div class="tabbertab" title="Resources"> | ||
==Resources== | ==Resources== | ||
===Documents=== | ===Documents=== | ||
Line 22: | Line 27: | ||
===3D Drawing=== | ===3D Drawing=== | ||
*[https://www.waveshare.com/w/upload/b/b3/WM8960_Audio_HAT_drawing.zip WM8960 Audio HAT 3D Drawing] | *[https://www.waveshare.com/w/upload/b/b3/WM8960_Audio_HAT_drawing.zip WM8960 Audio HAT 3D Drawing] | ||
+ | </div> | ||
+ | <div class="tabbertab" title="FAQ"> | ||
==FAQ== | ==FAQ== | ||
{{FAQ| For systems with different kernels, how should I download the corresponding drivers? | {{FAQ| For systems with different kernels, how should I download the corresponding drivers? | ||
Line 47: | Line 54: | ||
</pre> | </pre> | ||
}} | }} | ||
− | + | </div> | |
+ | <div class="tabbertab" title="Support"> | ||
==Support== | ==Support== | ||
{{Service00}} | {{Service00}} | ||
+ | </div></div> |
Revision as of 13:18, 19 January 2022
| ||
This is a sound card HAT designed for Raspberry Pi, low power consumption, supports stereo encoding / decoding, features Hi-Fi playing / recording, what's more, it can directly drive speakers to play music.
Features
- Standard Raspberry Pi 40PIN GPIO extension header, supports Raspberry Pi series boards
- Integrates WM8960 low power stereo CODEC, communicates via I2S interface
- Integrates dual high-quality MEMS silicon Mic, supports left & right double channels recording, nice sound quality
- Onboard standard 3.5mm earphone jack, play music via external earphone
- Onboard dual-channel speaker interface, directly drives speakers
- Supports sound effects such as stereo, 3D surrounding, etc.
Specifications
- CODEC: WM8960
- Power supply: 5V
- Logic voltage: 3.3V
- Control interface: I2C
- Audio interface: I2S
- DAC signal-noise ratio: 98dB
- ADC signal-noise ratio: 94dB
- Earphone driver: 40mW (16Ω@3.3V)
- Speaker driver: 1W per channel (8Ω BTL)
Dimension
The guides can only be used with Raspberry Pi OS
Install Driver
Update system:
sudo apt-get update sudo apt-get upgrade
:Clone driver
git clone https://github.com/waveshare/WM8960-Audio-HAT
Install WM8960 driver:
cd WM8960-Audio-HAT sudo ./install.sh sudo reboot
Check if the driver is installed
sudo dkms status
[email protected]:~ $ sudo dkms status wm8960-soundcard, 1.0, 4.19.58-v7l+, armv7l: installed
Note: If the WM8960 Audio HAT has a noise problem, please reinstall the driver and test it again. 。
If the 3.5mm jack has no audio output, please run the following command to restart the service.
sudo systemctl restart wm8960-soundcard.service
Check the Soundcard
- Test playing:aplay -l
[email protected]:~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
- Test recording:arecord -l
[email protected]:~ $ arecord -l **** List of CAPTURE Hardware Devices **** card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
Test record/play
record and play
sudo arecord -f cd -Dhw:0 | aplay -Dhw:0
After running the command, you can hear the sound recorded by mic from earphones or speakers. Note that the speaker should be away from the mic to void from noise
Record
sudo arecord -D hw:0,0 -f S32_LE -r 16000 -c 2 test.wav
test.wav is the file name outputed
Play
sudo aplay -Dhw:0 test.wav
Play the audio
Adjust the volume
The default volume is small, and you can install the alsamixer to adjust it
sudo alsamixer
If WM8960 is not the default sound card, you should press F6 to choose an audio device.
mpg123 palyer
aplay command can only support wav file, if you want to paly MP3 file, you can install mpg123 tool.:
sudo apt-get install mpg123 sudo mpg123 music.mp3
You can replace the music.mp3 with the actual file name.
smplayer for GUI controlling
Note that this software can only work for :
sudo apt-get install smplayer
Right click and set the wm8960-soundcard as default device
Open the smplayer software in Menu, choose a audio fiel and play
Examples
We prvide examples for testing
- Install ibraries
sudo apt-get install libasound2-dev git clone https://github.com/larsimmisch/pyalsaaudio cd pyalsaaudio sudo python3 setup.py build sudo python3 setup.py install
- Download examples
wget http://www.waveshare.com/w/upload/1/19/WM8960_Audio_HAT_Code.tar.gz tar zxvf WM8960_Audio_HAT_Code.tar.gz sudo chmod 777 -R WM8960_Audio_HAT_Code
- Play
sudo python playwav.py music.wav
- Record
sudo python recordwav.py out.wav
Resources
Documents
Codes
3D Drawing
FAQ
- Check the kernel version first
uname -a
- If the kernel version of your system is lower than 5.0 (that is, the Raspberry Pi system version is before 2020-05-27), please download the following driver:
git clone -b rpi-4.9.y https://github.com/waveshare/WM8960-Audio-HAT.git
- If the kernel version is higher than 5.0, please download the following driver:
git clone https://github.com/waveshare/WM8960-Audio-HAT
【Note】Please do not run both of the above two commands!
{{{5}}}
sudo systemctl restart wm8960-soundcard.service
{{{5}}}