https://github.com/aerth/playwav
play a wav file using Golang, ALSA
https://github.com/aerth/playwav
alsa audio linux sound wav
Last synced: about 1 year ago
JSON representation
play a wav file using Golang, ALSA
- Host: GitHub
- URL: https://github.com/aerth/playwav
- Owner: aerth
- License: mit
- Created: 2017-03-23T02:21:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-11-17T18:32:01.000Z (over 1 year ago)
- Last Synced: 2025-06-09T11:11:18.274Z (about 1 year ago)
- Topics: alsa, audio, linux, sound, wav
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# playwav
## play a .wav file
* stuck with FormatS16LE for now (Little Endian 16, 2 bytes per sample)
* compilation adds requirements: CGO and some c libraries (ALSA)
## playwav command
```go get -v github.com/aerth/playwav/cmd/playwav```
if not build because cant found 'alsa/a ... .h"
try it:
```
sudo apt-get install libasound2-dev
```
## playwav library
```
import "github.com/aerth/playwav"
// from file
playwav.FromFile("example.wav")
```
## cool test with playwav command
```
for i in $(find /usr/ -name '*.wav'); do ./playwav $i; done
```
## output of ldd for playwav command:
```
linux-vdso.so.1 (0x00007fff27fcf000)
libasound.so.2 => /usr/lib64/libasound.so.2 (0x00007f418a496000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f418a278000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4189eb2000)
libm.so.6 => /lib64/libm.so.6 (0x00007f4189ba9000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f41899a5000)
librt.so.1 => /lib64/librt.so.1 (0x00007f418979b000)
/lib64/ld-linux-x86-64.so.2 (0x000055ab41acf000)
```