https://github.com/mcuadros/go-tsunami
Sparkfun Tsunami serial control library for golang
https://github.com/mcuadros/go-tsunami
Last synced: 9 months ago
JSON representation
Sparkfun Tsunami serial control library for golang
- Host: GitHub
- URL: https://github.com/mcuadros/go-tsunami
- Owner: mcuadros
- License: mit
- Created: 2022-12-27T02:34:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-27T05:46:33.000Z (over 2 years ago)
- Last Synced: 2025-03-20T04:37:54.474Z (9 months ago)
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-tsunami [](http://godoc.org/github.com/mcuadros/go-tsunami)
==============================
Sparkfun Tsunami serial control library for golang
[Tsunami](https://www.sparkfun.com/products/18159) is a polyphonic Wav file
player with 4 stereo (or 8 mono) outputs. Wav files can be triggered using the
16 onboard contacts, via MIDI, serial connection or Qwiic to a PC or other
microcontroller.
This library is a manual transpilation from the official library
[Tsunami-Arduino-Serial-Library](https://github.com/robertsonics/Tsunami-Arduino-Serial-Library).
Installation
------------
The recommended way to install go-tsunami
```
go get github.com/mcuadros/go-tsunami
```
Example
-------
```go
ts, err := tsunami.NewTsunami("/dev/ttyUSB0")
if err != nil {
panic(err)
}
defer ts.Close()
if err := ts.Start(); err != nil {
panic(err)
}
trackNum := 1
ts.TrackGain(trackNum, -70) // muted
ts.TrackPlaySolo(trackNum, 0, false) // track = 19 (aka "19.WAV"), output = 0 (aka "1L")
ts.TrackFade(trackNum, 0, time.Second*5, false) // track 19, fade to gain of 0,
// fade time = 5000ms, stopFlag is false = do not stop
fmt.Println("Fading IN track 19 right now...")
time.Sleep(time.Second * 5)
fmt.Println("Gain set to unity (0)! Playing for 5 seconds...")
time.Sleep(time.Second * 5)
ts.TrackFade(trackNum, -70, time.Second*5, true) // track 3, fade to gain of -70,
// fade time = 5000ms, stopFlag is true = stop track when fade is done
fmt.Println("Fading OUT track 19 right now...")
time.Sleep(time.Second * 5)
fmt.Println("Track 19 stopped.")
```
License
-------
MIT, see [LICENSE](LICENSE)