Skip to content

Commit

Permalink
move to modules, add audio packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrodriges committed Feb 16, 2019
1 parent dff068c commit a6aaf22
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 23 deletions.
23 changes: 23 additions & 0 deletions audio/effects/effects.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package effects

type Effect string

const (
Hamster Effect = "hamster"
BehindTheWall Effect = "behind_the_wall"
Megaphone Effect = "megaphone"
PitchDown Effect = "pitch_down"
Psychodelic Effect = "psychodelic"
Pulse Effect = "pulse"
TrainAnnounce Effect = "train_announce"
)

// Add wraps text with proper tags using given effect.
//
// Example:
// ...
// "tts": "Hello, " + effects.Add(effects.Megaphone, "world!"),
// ...
func Add(e Effect, s string) string {
return `<speaker effect="` + string(e) + `">` + s + `<speaker effect="-">`
}
29 changes: 29 additions & 0 deletions audio/effects/effects_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package effects

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestAdd(t *testing.T) {
testCases := []struct {
effect Effect
text string
expect string
}{
{Hamster, "squeek", `<speaker effect="hamster">squeek<speaker effect="-">`},
{BehindTheWall, "psst", `<speaker effect="behind_the_wall">psst<speaker effect="-">`},
{Megaphone, "heeey", `<speaker effect="megaphone">heeey<speaker effect="-">`},
{PitchDown, "looool", `<speaker effect="pitch_down">looool<speaker effect="-">`},
{Psychodelic, "high", `<speaker effect="psychodelic">high<speaker effect="-">`},
{Pulse, "beep", `<speaker effect="pulse">beep<speaker effect="-">`},
{TrainAnnounce, "here it comes", `<speaker effect="train_announce">here it comes<speaker effect="-">`},
}

for _, tc := range testCases {
t.Run(string(tc.effect), func(t *testing.T) {
assert.Equal(t, tc.expect, Add(tc.effect, tc.text))
})
}
}
44 changes: 44 additions & 0 deletions audio/sounds/animals.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/animals-docpage/
// for sound samples.
// Example:
// ...
// "tts": "Than cat meows " + sounds.Cat1,
// ...
const (
Cat1 = `<speaker audio="alice-sounds-animals-cat-1.opus">`
Cat2 = `<speaker audio="alice-sounds-animals-cat-2.opus">`
Cat3 = `<speaker audio="alice-sounds-animals-cat-3.opus">`
Cat4 = `<speaker audio="alice-sounds-animals-cat-4.opus">`
Cat5 = `<speaker audio="alice-sounds-animals-cat-5.opus">`
Chicken1 = `<speaker audio="alice-sounds-animals-chicken-1.opus">`
Cow1 = `<speaker audio="alice-sounds-animals-cow-1.opus">`
Cow2 = `<speaker audio="alice-sounds-animals-cow-2.opus">`
Cow3 = `<speaker audio="alice-sounds-animals-cow-3.opus">`
Crow1 = `<speaker audio="alice-sounds-animals-crow-1.opus">`
Crow2 = `<speaker audio="alice-sounds-animals-crow-2.opus">`
Cuckoo1 = `<speaker audio="alice-sounds-animals-cuckoo-1.opus">`
Dog1 = `<speaker audio="alice-sounds-animals-dog-1.opus">`
Dog2 = `<speaker audio="alice-sounds-animals-dog-2.opus">`
Dog3 = `<speaker audio="alice-sounds-animals-dog-3.opus">`
Dog4 = `<speaker audio="alice-sounds-animals-dog-4.opus">`
Dog5 = `<speaker audio="alice-sounds-animals-dog-5.opus">`
Elephant1 = `<speaker audio="alice-sounds-animals-elephant-1.opus">`
Elephant2 = `<speaker audio="alice-sounds-animals-elephant-2.opus">`
Frog1 = `<speaker audio="alice-sounds-animals-frog-1.opus">`
Horse1 = `<speaker audio="alice-sounds-animals-horse-1.opus">`
Horse2 = `<speaker audio="alice-sounds-animals-horse-2.opus">`
HorseGalloping1 = `<speaker audio="alice-sounds-animals-horse-galloping-1.opus">`
HorseWalking1 = `<speaker audio="alice-sounds-animals-horse-walking-1.opus">`
Lion1 = `<speaker audio="alice-sounds-animals-lion-1.opus">`
Lion2 = `<speaker audio="alice-sounds-animals-lion-2.opus">`
Monkey1 = `<speaker audio="alice-sounds-animals-monkey-1.opus">`
Owl1 = `<speaker audio="alice-sounds-animals-owl-1.opus">`
Owl2 = `<speaker audio="alice-sounds-animals-owl-2.opus">`
Rooster1 = `<speaker audio="alice-sounds-animals-rooster-1.opus">`
Seagull1 = `<speaker audio="alice-sounds-animals-seagull-1.opus">`
Sheep1 = `<speaker audio="alice-sounds-animals-sheep-1.opus">`
Sheep2 = `<speaker audio="alice-sounds-animals-sheep-2.opus">`
Wolf1 = `<speaker audio="alice-sounds-animals-wolf-1.opus">`
)
25 changes: 25 additions & 0 deletions audio/sounds/games.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/games-docpage/
// for sound samples.
// Example:
// ...
// "tts": "Victory is yours " + sounds.GameWin1,
// ...
const (
GameBoot8Bit = `<speaker audio="alice-sounds-game-boot-1.opus">`
GameCoin8Bit1 = `<speaker audio="alice-sounds-game-8-bit-coin-1.opus">`
GameCoin8Bit2 = `<speaker audio="alice-sounds-game-8-bit-coin-2.opus">`
GameFlyby8Bit = `<speaker audio="alice-sounds-game-8-bit-flyby-1.opus">`
GameLoss1 = `<speaker audio="alice-sounds-game-loss-1.opus">`
GameLoss2 = `<speaker audio="alice-sounds-game-loss-2.opus">`
GameLoss3 = `<speaker audio="alice-sounds-game-loss-3.opus">`
GameMachineGun8Bit = `<speaker audio="alice-sounds-game-8-bit-machine-gun-1.opus">`
GamePhone8Bit = `<speaker audio="alice-sounds-game-8-bit-phone-1.opus">`
GamePing = `<speaker audio="alice-sounds-game-ping-1.opus">`
GamePowerup1 = `<speaker audio="alice-sounds-game-powerup-1.opus">`
GamePowerup2 = `<speaker audio="alice-sounds-game-powerup-2.opus">`
GameWin1 = `<speaker audio="alice-sounds-game-win-1.opus">`
GameWin2 = `<speaker audio="alice-sounds-game-win-2.opus">`
GameWin3 = `<speaker audio="alice-sounds-game-win-3.opus">`
)
35 changes: 35 additions & 0 deletions audio/sounds/human.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/human-docpage/
// for sound samples.
// Example:
// ...
// "tts": "And the Oscar goes to... " + sounds.Applause,
// ...
const (
Applause = `<speaker audio="alice-sounds-human-cheer-1.opus">`
Cough1 = `<speaker audio="alice-sounds-human-cough-1.opus">`
Cough2 = `<speaker audio="alice-sounds-human-cough-2.opus">`
Crowd1 = `<speaker audio="alice-sounds-human-crowd-1.opus">`
Crowd2 = `<speaker audio="alice-sounds-human-crowd-2.opus">`
Crowd3 = `<speaker audio="alice-sounds-human-crowd-3.opus">`
Crowd4 = `<speaker audio="alice-sounds-human-crowd-4.opus">`
Crowd5 = `<speaker audio="alice-sounds-human-crowd-5.opus">`
Crowd6 = `<speaker audio="alice-sounds-human-crowd-6.opus">`
Crowd7 = `<speaker audio="alice-sounds-human-crowd-7.opus">`
FansCheers = `<speaker audio="alice-sounds-human-cheer-2.opus">`
Kids = `<speaker audio="alice-sounds-human-kids-1.opus">`
Laugh1 = `<speaker audio="alice-sounds-human-laugh-1.opus">`
Laugh2 = `<speaker audio="alice-sounds-human-laugh-2.opus">`
Laugh3 = `<speaker audio="alice-sounds-human-laugh-3.opus">`
Laugh4 = `<speaker audio="alice-sounds-human-laugh-4.opus">`
Laugh5 = `<speaker audio="alice-sounds-human-laugh-5.opus">`
Sneeze1 = `<speaker audio="alice-sounds-human-sneeze-1.opus">`
Sneeze2 = `<speaker audio="alice-sounds-human-sneeze-2.opus">`
StepsInRoom = `<speaker audio="alice-sounds-human-walking-room-1.opus">`
StepsOnLeaves = `<speaker audio="alice-sounds-human-walking-leaves-1.opus">`
StepsOnSnow = `<speaker audio="alice-sounds-human-walking-snow-1.opus">`
WalkingDead1 = `<speaker audio="alice-sounds-human-walking-dead-1.opus">`
WalkingDead2 = `<speaker audio="alice-sounds-human-walking-dead-2.opus">`
WalkingDead3 = `<speaker audio="alice-sounds-human-walking-dead-3.opus">`
)
45 changes: 45 additions & 0 deletions audio/sounds/music.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/music-docpage/
// for sound samples.
// Example:
// ...
// "tts": "Ba-dum " + sounds.Drums1,
// ...
const (
Bagpipes1 = `<speaker audio="alice-music-bagpipes-1.opus">`
Bagpipes2 = `<speaker audio="alice-music-bagpipes-2.opus">`
DrumLoop1 = `<speaker audio="alice-music-drum-loop-1.opus">`
DrumLoop2 = `<speaker audio="alice-music-drum-loop-2.opus">`
Drums1 = `<speaker audio="alice-music-drums-1.opus">`
Drums2 = `<speaker audio="alice-music-drums-2.opus">`
Drums3 = `<speaker audio="alice-music-drums-3.opus">`
Gong1 = `<speaker audio="alice-music-gong-1.opus">`
Gong2 = `<speaker audio="alice-music-gong-2.opus">`
GuitarA = `<speaker audio="alice-music-guitar-a-1.opus">`
GuitarC = `<speaker audio="alice-music-guitar-c-1.opus">`
GuitarE = `<speaker audio="alice-music-guitar-e-1.opus">`
GuitarG = `<speaker audio="alice-music-guitar-g-1.opus">`
Harp = `<speaker audio="alice-music-harp-1.opus">`
Horn1 = `<speaker audio="alice-music-horn-1.opus">`
Horn2 = `<speaker audio="alice-music-horn-2.opus">`
PianoA = `<speaker audio="alice-music-piano-a-1.opus">`
PianoB = `<speaker audio="alice-music-piano-b-1.opus">`
PianoC1 = `<speaker audio="alice-music-piano-c-1.opus">`
PianoC2 = `<speaker audio="alice-music-piano-c-2.opus">`
PianoD = `<speaker audio="alice-music-piano-d-1.opus">`
PianoE = `<speaker audio="alice-music-piano-e-1.opus">`
PianoF = `<speaker audio="alice-music-piano-f-1.opus">`
PianoG = `<speaker audio="alice-music-piano-g-1.opus">`
Tambourine100bpm = `<speaker audio="alice-music-tambourine-100bpm-1.opus">`
Tambourine120bpm = `<speaker audio="alice-music-tambourine-120bpm-1.opus">`
Tambourine80bpm = `<speaker audio="alice-music-tambourine-80bpm-1.opus">`
ViolinA = `<speaker audio="alice-music-violin-a-1.opus">`
ViolinB = `<speaker audio="alice-music-violin-b-1.opus">`
ViolinC1 = `<speaker audio="alice-music-violin-c-1.opus">`
ViolinC2 = `<speaker audio="alice-music-violin-c-2.opus">`
ViolinD = `<speaker audio="alice-music-violin-d-1.opus">`
ViolinE = `<speaker audio="alice-music-violin-e-1.opus">`
ViolinF = `<speaker audio="alice-music-violin-f-1.opus">`
ViolinG = `<speaker audio="alice-music-violin-g-1.opus">`
)
26 changes: 26 additions & 0 deletions audio/sounds/nature.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/nature-docpage/
// for sound samples.
// Example:
// ...
// "tts": "Paper burns at 451 Fahrenheit " + sounds.Fire1,
// ...
const (
Wind1 = `<speaker audio="alice-sounds-nature-wind-1.opus">`
Wind2 = `<speaker audio="alice-sounds-nature-wind-2.opus">`
Thunder1 = `<speaker audio="alice-sounds-nature-thunder-1.opus">`
Thunder2 = `<speaker audio="alice-sounds-nature-thunder-2.opus">`
Jungle1 = `<speaker audio="alice-sounds-nature-jungle-1.opus">`
Jungle2 = `<speaker audio="alice-sounds-nature-jungle-2.opus">`
Rain1 = `<speaker audio="alice-sounds-nature-rain-1.opus">`
Rain2 = `<speaker audio="alice-sounds-nature-rain-2.opus">`
Forest1 = `<speaker audio="alice-sounds-nature-forest-1.opus">`
Forest2 = `<speaker audio="alice-sounds-nature-forest-2.opus">`
Sea1 = `<speaker audio="alice-sounds-nature-sea-1.opus">`
Sea2 = `<speaker audio="alice-sounds-nature-sea-2.opus">`
Fire1 = `<speaker audio="alice-sounds-nature-fire-1.opus">`
Fire2 = `<speaker audio="alice-sounds-nature-fire-2.opus">`
Stream1 = `<speaker audio="alice-sounds-nature-stream-1.opus">`
Stream2 = `<speaker audio="alice-sounds-nature-stream-2.opus">`
)
45 changes: 45 additions & 0 deletions audio/sounds/things.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package sounds

// Visit https://tech.yandex.ru/dialogs/alice/doc/sounds/things-docpage/
// for sound samples.
// Example:
// ...
// "tts": "The ringing of the division bell had begun " + sounds.Bell1,
// ...
const (
Bell1 = `<speaker audio="alice-sounds-things-bell-1.opus">`
Bell2 = `<speaker audio="alice-sounds-things-bell-2.opus">`
BoilingWater = `<speaker audio="alice-sounds-things-water-2.opus">`
CarNotStarting = `<speaker audio="alice-sounds-things-car-2.opus">`
CarStarting = `<speaker audio="alice-sounds-things-car-1.opus">`
Chainsaw = `<speaker audio="alice-sounds-things-chainsaw-1.opus">`
CuckooClock1 = `<speaker audio="alice-sounds-things-cuckoo-clock-1.opus">`
CuckooClock2 = `<speaker audio="alice-sounds-things-cuckoo-clock-2.opus">`
Door1 = `<speaker audio="alice-sounds-things-door-1.opus">`
Door2 = `<speaker audio="alice-sounds-things-door-2.opus">`
Explosion = `<speaker audio="alice-sounds-things-explosion-1.opus">`
GlassBreaking = `<speaker audio="alice-sounds-things-glass-1.opus">`
GlassesClinking = `<speaker audio="alice-sounds-things-glass-2.opus">`
Jackhammer = `<speaker audio="alice-sounds-things-construction-2.opus">`
LeakingWater = `<speaker audio="alice-sounds-things-water-1.opus">`
OldPhone1 = `<speaker audio="alice-sounds-things-old-phone-1.opus">`
OldPhone2 = `<speaker audio="alice-sounds-things-old-phone-2.opus">`
PhoneRing1 = `<speaker audio="alice-sounds-things-phone-1.opus">`
PhoneRing2 = `<speaker audio="alice-sounds-things-phone-2.opus">`
PhoneRing3 = `<speaker audio="alice-sounds-things-phone-3.opus">`
PhoneRing4 = `<speaker audio="alice-sounds-things-phone-4.opus">`
PhoneRing5 = `<speaker audio="alice-sounds-things-phone-5.opus">`
PouringWater = `<speaker audio="alice-sounds-things-water-3.opus">`
SawAndHammer = `<speaker audio="alice-sounds-things-construction-1.opus">`
ShipHorn1 = `<speaker audio="alice-sounds-transport-ship-horn-1.opus">`
ShipHorn2 = `<speaker audio="alice-sounds-transport-ship-horn-2.opus">`
Shotgun = `<speaker audio="alice-sounds-things-gun-1.opus">`
Siren1 = `<speaker audio="alice-sounds-things-siren-1.opus">`
Siren2 = `<speaker audio="alice-sounds-things-siren-2.opus">`
SwitchOff = `<speaker audio="alice-sounds-things-switch-2.opus">`
SwitchOn = `<speaker audio="alice-sounds-things-switch-1.opus">`
SwordFight = `<speaker audio="alice-sounds-things-sword-3.opus">`
SwordOutOfsheath = `<speaker audio="alice-sounds-things-sword-2.opus">`
SwordParrying = `<speaker audio="alice-sounds-things-sword-1.opus">`
ToiletFlushing = `<speaker audio="alice-sounds-things-toilet-1.opus">`
)
16 changes: 0 additions & 16 deletions glide.lock

This file was deleted.

7 changes: 0 additions & 7 deletions glide.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/bbrodriges/mielofon

require github.com/stretchr/testify v1.3.0
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

0 comments on commit a6aaf22

Please sign in to comment.