Skip to content

Commit

Permalink
Updating media rate hertz
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas committed Dec 23, 2024
1 parent 13b1ca2 commit d2ff9ca
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions AWSTranscribeStreamingTests/AWSTranscribeStreamingSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,31 @@ class AWSTranscribeStreamingSwiftTests: XCTestCase {
}

func testStreamingExampleEnglish() throws {
try transcribeAudio(languageCode: .enUS, fileName: "hello_world")
try transcribeAudio(
languageCode: .enUS,
fileName: "hello_world",
mediaSampleRateHertz: 8000
)
}

func testStreamingExampleDeutsche() throws {
try transcribeAudio(languageCode: .deDE, fileName: "guten_tag")
try transcribeAudio(
languageCode: .deDE,
fileName: "guten_tag"
)
}

func testStreamingExampleEspañol() throws {
try transcribeAudio(languageCode: .esES, fileName: "hola_mundo")
try transcribeAudio(
languageCode: .esES,
fileName: "hola_mundo"
)
}

private func transcribeAudio(languageCode: AWSTranscribeStreamingLanguageCode, fileName: String) throws {
private func transcribeAudio(
languageCode: AWSTranscribeStreamingLanguageCode,
fileName: String,
mediaSampleRateHertz: NSNumber = 2400) throws {
let bundle = Bundle(for: AWSTranscribeStreamingSwiftTests.self)
guard let audioPath = bundle.path(forResource: fileName, ofType: "wav") else {
XCTFail("Can't find audio path: \(fileName).wav")
Expand All @@ -72,7 +85,7 @@ class AWSTranscribeStreamingSwiftTests: XCTestCase {

request.languageCode = languageCode
request.mediaEncoding = .pcm
request.mediaSampleRateHertz = 24000
request.mediaSampleRateHertz = mediaSampleRateHertz

// Set up delegate and its expectations
let delegate = MockTranscribeStreamingClientDelegate()
Expand Down

0 comments on commit d2ff9ca

Please sign in to comment.