Skip to content

Commit

Permalink
Adding any codec support for Go language speech sdk (#32)
Browse files Browse the repository at this point in the history
* adding any codec support for Go language speech sdk

* some formating

Co-authored-by: amishu <amishu@AMIT-SURFACE>
  • Loading branch information
amitkumarshukla and amishu committed Apr 29, 2021
1 parent a8d94ac commit b698fc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions audio/audio_stream_container_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ const (

// AMRWB Stream ContainerFormat definition for AMRWB. Currently not supported.
AMRWB AudioStreamContainerFormat = 0x107

// ANY Stream ContainerFormat definition when the actual stream format is not known.
ANY AudioStreamContainerFormat = 0x108
)
14 changes: 6 additions & 8 deletions samples/recognizer/from_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,16 @@ func RecognizeOnceFromCompressedFile(subscription string, region string, file st
var containerFormat audio.AudioStreamContainerFormat
if strings.Contains(file, ".mulaw") {
containerFormat = audio.MULAW
}
if strings.Contains(file, ".alaw") {
} else if strings.Contains(file, ".alaw") {
containerFormat = audio.ALAW
}
if strings.Contains(file, ".mp3") {
} else if strings.Contains(file, ".mp3") {
containerFormat = audio.MP3
}
if strings.Contains(file, ".flac") {
} else if strings.Contains(file, ".flac") {
containerFormat = audio.FLAC
}
if strings.Contains(file, ".opus") {
} else if strings.Contains(file, ".opus") {
containerFormat = audio.OGGOPUS
} else {
containerFormat = audio.ANY
}
format, err := audio.GetCompressedFormat(containerFormat)
if err != nil {
Expand Down

0 comments on commit b698fc5

Please sign in to comment.