Skip to content

Commit

Permalink
removed unused
Browse files Browse the repository at this point in the history
  • Loading branch information
Archetapp committed Nov 23, 2024
1 parent 05f6319 commit 17e66c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 65 deletions.
11 changes: 0 additions & 11 deletions Sources/HumeAI/Intramodular/API/HumeAI.APISpecification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ extension HumeAI {
@Path("/v0/evi/custom_voices/{id}")
@Body(json: \.input)
var updateVoiceName = Endpoint<RequestBodies.UpdateVoiceNameInput, ResponseBodies.Voice, Void>()

// Text to Speech Endpoints
@POST
@Path("/v0/tts/generate")
@Body(json: \.input)
var generateSpeech = Endpoint<RequestBodies.TTSInput, ResponseBodies.TTSOutput, Void>()

@POST
@Path("/v0/tts/generate/stream")
@Body(json: \.input)
var generateSpeechStream = Endpoint<RequestBodies.TTSInput, ResponseBodies.TTSStreamOutput, Void>()
}
}

Expand Down
54 changes: 0 additions & 54 deletions Sources/HumeAI/Intramodular/HumeAI.Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,6 @@ extension HumeAI.Client {
let response = try await run(\.listVoices)
return response.voices
}

public func generateSpeech(
text: String,
voiceID: String,
speed: Double? = nil,
stability: Double? = nil,
similarityBoost: Double? = nil,
styleExaggeration: Double? = nil
) async throws -> Data {
let input = HumeAI.APISpecification.RequestBodies.TTSInput(
text: text,
voiceId: voiceID,
speed: speed,
stability: stability,
similarityBoost: similarityBoost,
styleExaggeration: styleExaggeration
)

return try await run(\.generateSpeech, with: input).audio
}

public func generateSpeechStream(
text: String,
voiceID: String,
speed: Double? = nil,
stability: Double? = nil,
similarityBoost: Double? = nil,
styleExaggeration: Double? = nil
) async throws -> Data {
let input = HumeAI.APISpecification.RequestBodies.TTSInput(
text: text,
voiceId: voiceID,
speed: speed,
stability: stability,
similarityBoost: similarityBoost,
styleExaggeration: styleExaggeration
)

let stream = try await run(\.generateSpeechStream, with: input)

var request = URLRequest(url: stream.streamURL)

let (audioData, response) = try await URLSession.shared.data(for: request)

guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else {
throw HumeAI.APIError.audioDataError
}

guard !audioData.isEmpty else {
throw HumeAI.APIError.audioDataError
}

return audioData
}
}

// MARK: - Conformances
Expand Down

0 comments on commit 17e66c5

Please sign in to comment.