From a6aaf22e479ee4d67f012e7ee22ec3766ea8b1ca Mon Sep 17 00:00:00 2001 From: bbrodriges Date: Sat, 16 Feb 2019 17:17:34 +0300 Subject: [PATCH] move to modules, add audio packages --- audio/effects/effects.go | 23 ++++++++++++++++++ audio/effects/effects_test.go | 29 ++++++++++++++++++++++ audio/sounds/animals.go | 44 ++++++++++++++++++++++++++++++++++ audio/sounds/games.go | 25 +++++++++++++++++++ audio/sounds/human.go | 35 +++++++++++++++++++++++++++ audio/sounds/music.go | 45 +++++++++++++++++++++++++++++++++++ audio/sounds/nature.go | 26 ++++++++++++++++++++ audio/sounds/things.go | 45 +++++++++++++++++++++++++++++++++++ glide.lock | 16 ------------- glide.yaml | 7 ------ go.mod | 3 +++ go.sum | 8 +++++++ 12 files changed, 283 insertions(+), 23 deletions(-) create mode 100644 audio/effects/effects.go create mode 100644 audio/effects/effects_test.go create mode 100644 audio/sounds/animals.go create mode 100644 audio/sounds/games.go create mode 100644 audio/sounds/human.go create mode 100644 audio/sounds/music.go create mode 100644 audio/sounds/nature.go create mode 100644 audio/sounds/things.go delete mode 100644 glide.lock delete mode 100644 glide.yaml create mode 100644 go.mod create mode 100644 go.sum diff --git a/audio/effects/effects.go b/audio/effects/effects.go new file mode 100644 index 0000000..00b2cf1 --- /dev/null +++ b/audio/effects/effects.go @@ -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 `` + s + `` +} diff --git a/audio/effects/effects_test.go b/audio/effects/effects_test.go new file mode 100644 index 0000000..5510acc --- /dev/null +++ b/audio/effects/effects_test.go @@ -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", `squeek`}, + {BehindTheWall, "psst", `psst`}, + {Megaphone, "heeey", `heeey`}, + {PitchDown, "looool", `looool`}, + {Psychodelic, "high", `high`}, + {Pulse, "beep", `beep`}, + {TrainAnnounce, "here it comes", `here it comes`}, + } + + for _, tc := range testCases { + t.Run(string(tc.effect), func(t *testing.T) { + assert.Equal(t, tc.expect, Add(tc.effect, tc.text)) + }) + } +} diff --git a/audio/sounds/animals.go b/audio/sounds/animals.go new file mode 100644 index 0000000..ccff8d9 --- /dev/null +++ b/audio/sounds/animals.go @@ -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 = `` + Cat2 = `` + Cat3 = `` + Cat4 = `` + Cat5 = `` + Chicken1 = `` + Cow1 = `` + Cow2 = `` + Cow3 = `` + Crow1 = `` + Crow2 = `` + Cuckoo1 = `` + Dog1 = `` + Dog2 = `` + Dog3 = `` + Dog4 = `` + Dog5 = `` + Elephant1 = `` + Elephant2 = `` + Frog1 = `` + Horse1 = `` + Horse2 = `` + HorseGalloping1 = `` + HorseWalking1 = `` + Lion1 = `` + Lion2 = `` + Monkey1 = `` + Owl1 = `` + Owl2 = `` + Rooster1 = `` + Seagull1 = `` + Sheep1 = `` + Sheep2 = `` + Wolf1 = `` +) diff --git a/audio/sounds/games.go b/audio/sounds/games.go new file mode 100644 index 0000000..6aa099a --- /dev/null +++ b/audio/sounds/games.go @@ -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 = `` + GameCoin8Bit1 = `` + GameCoin8Bit2 = `` + GameFlyby8Bit = `` + GameLoss1 = `` + GameLoss2 = `` + GameLoss3 = `` + GameMachineGun8Bit = `` + GamePhone8Bit = `` + GamePing = `` + GamePowerup1 = `` + GamePowerup2 = `` + GameWin1 = `` + GameWin2 = `` + GameWin3 = `` +) diff --git a/audio/sounds/human.go b/audio/sounds/human.go new file mode 100644 index 0000000..c3eb52b --- /dev/null +++ b/audio/sounds/human.go @@ -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 = `` + Cough1 = `` + Cough2 = `` + Crowd1 = `` + Crowd2 = `` + Crowd3 = `` + Crowd4 = `` + Crowd5 = `` + Crowd6 = `` + Crowd7 = `` + FansCheers = `` + Kids = `` + Laugh1 = `` + Laugh2 = `` + Laugh3 = `` + Laugh4 = `` + Laugh5 = `` + Sneeze1 = `` + Sneeze2 = `` + StepsInRoom = `` + StepsOnLeaves = `` + StepsOnSnow = `` + WalkingDead1 = `` + WalkingDead2 = `` + WalkingDead3 = `` +) diff --git a/audio/sounds/music.go b/audio/sounds/music.go new file mode 100644 index 0000000..dc58583 --- /dev/null +++ b/audio/sounds/music.go @@ -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 = `` + Bagpipes2 = `` + DrumLoop1 = `` + DrumLoop2 = `` + Drums1 = `` + Drums2 = `` + Drums3 = `` + Gong1 = `` + Gong2 = `` + GuitarA = `` + GuitarC = `` + GuitarE = `` + GuitarG = `` + Harp = `` + Horn1 = `` + Horn2 = `` + PianoA = `` + PianoB = `` + PianoC1 = `` + PianoC2 = `` + PianoD = `` + PianoE = `` + PianoF = `` + PianoG = `` + Tambourine100bpm = `` + Tambourine120bpm = `` + Tambourine80bpm = `` + ViolinA = `` + ViolinB = `` + ViolinC1 = `` + ViolinC2 = `` + ViolinD = `` + ViolinE = `` + ViolinF = `` + ViolinG = `` +) diff --git a/audio/sounds/nature.go b/audio/sounds/nature.go new file mode 100644 index 0000000..a6078b5 --- /dev/null +++ b/audio/sounds/nature.go @@ -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 = `` + Wind2 = `` + Thunder1 = `` + Thunder2 = `` + Jungle1 = `` + Jungle2 = `` + Rain1 = `` + Rain2 = `` + Forest1 = `` + Forest2 = `` + Sea1 = `` + Sea2 = `` + Fire1 = `` + Fire2 = `` + Stream1 = `` + Stream2 = `` +) diff --git a/audio/sounds/things.go b/audio/sounds/things.go new file mode 100644 index 0000000..fc6fe37 --- /dev/null +++ b/audio/sounds/things.go @@ -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 = `` + Bell2 = `` + BoilingWater = `` + CarNotStarting = `` + CarStarting = `` + Chainsaw = `` + CuckooClock1 = `` + CuckooClock2 = `` + Door1 = `` + Door2 = `` + Explosion = `` + GlassBreaking = `` + GlassesClinking = `` + Jackhammer = `` + LeakingWater = `` + OldPhone1 = `` + OldPhone2 = `` + PhoneRing1 = `` + PhoneRing2 = `` + PhoneRing3 = `` + PhoneRing4 = `` + PhoneRing5 = `` + PouringWater = `` + SawAndHammer = `` + ShipHorn1 = `` + ShipHorn2 = `` + Shotgun = `` + Siren1 = `` + Siren2 = `` + SwitchOff = `` + SwitchOn = `` + SwordFight = `` + SwordOutOfsheath = `` + SwordParrying = `` + ToiletFlushing = `` +) diff --git a/glide.lock b/glide.lock deleted file mode 100644 index c4d53f2..0000000 --- a/glide.lock +++ /dev/null @@ -1,16 +0,0 @@ -hash: 0aebc1ed7582a040e53d5d36208730bce6cd2a994ca4cc52cc210f325f7c288a -updated: 2018-12-31T13:55:33.263327+03:00 -imports: [] -testImports: -- name: github.com/davecgh/go-spew - version: d8f796af33cc11cb798c1aaeb27a4ebc5099927d - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: 5d4384ee4fb2527b0a1256a821ebfc92f91efefc - subpackages: - - difflib -- name: github.com/stretchr/testify - version: f35b8ab0b5a2cef36673838d662e249dd9c94686 - subpackages: - - assert diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index e16293e..0000000 --- a/glide.yaml +++ /dev/null @@ -1,7 +0,0 @@ -package: . -import: [] -testImport: -- package: github.com/stretchr/testify - version: ^1.2.2 - subpackages: - - assert diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ad8d81c --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/bbrodriges/mielofon + +require github.com/stretchr/testify v1.3.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..380091e --- /dev/null +++ b/go.sum @@ -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=