There's wrong with speech detector ios26

i tried combine speech detector and speech transciber to anlayzer. but speech detector is not speech module. please help me

Answered by DTS Engineer in 850555022

Hello all,

SpeechDetector does not formally conform to the SpeechModule protocol, though it does satisfy the protocol requirements.

You could declare that conformance yourself, which might get you temporarily unblocked:

extension SpeechDetector: @retroactive SpeechModule, @unchecked @retroactive Sendable {}

But, there are a lot of good reasons to not do that. If you do this, be sure to remove your extension if SpeechDetector is updated to formally conform to SpeechModule in the SDK itself.

Also, you should file a bug report for this issue if you haven't already using Feedback Assistant.

-- Greg

i experience exactly same problem. please help me too

try these solutions:

let modules: [any SpeechAnalysisModule] = [detector, transcriber]

let speechAnalyzer: SpeechAnalyzer = SpeechAnalyzer(modules: modules)

SpeechAnalysisModule doesn't exist, SpeechAnalyzer init parameter is called SpeechModule.

Doing

let modules: [any SpeechModule] = [detector, transcriber]

also doesn't work, since it's obviously Cannot convert value of type 'SpeechDetector' to expected element type 'any SpeechModule'.

This compiles and runs:

        let detector = SpeechDetector(detectionOptions: SpeechDetector.DetectionOptions(sensitivityLevel: .medium), reportResults: true)
        let modules: [any SpeechModule] = [detector as! (any SpeechModule), transcriber]

        let analyzer = SpeechAnalyzer(modules: modules, options: SpeechAnalyzer.Options(priority: .high, modelRetention: .processLifetime))

but honestly, I see no difference with or without the detector.

Actually testing the results via:

    let detector = SpeechDetector(detectionOptions: SpeechDetector.DetectionOptions(sensitivityLevel: .medium), reportResults: true)
    let modules: [any SpeechModule] = [detector as! (any SpeechModule), transcriber]

    Task {
        for try await result in detector.results {
                print("result: \(result.description)]")
        }
    }

also doesn't yield any log lines, so I think while force-casting it to SpeechModule doesn't make the app crash, it's just ignored.

Hello all,

SpeechDetector does not formally conform to the SpeechModule protocol, though it does satisfy the protocol requirements.

You could declare that conformance yourself, which might get you temporarily unblocked:

extension SpeechDetector: @retroactive SpeechModule, @unchecked @retroactive Sendable {}

But, there are a lot of good reasons to not do that. If you do this, be sure to remove your extension if SpeechDetector is updated to formally conform to SpeechModule in the SDK itself.

Also, you should file a bug report for this issue if you haven't already using Feedback Assistant.

-- Greg

Thank you Greg! @DTS Engineer

When I use it with the retroactive protocol conformance, it seems to work, but I never see any results (for the reportResults: true)

When I try:

        let detector = SpeechDetector(detectionOptions: SpeechDetector.DetectionOptions(sensitivityLevel: .medium), reportResults: true)

        if analyzer == nil {
            analyzer = SpeechAnalyzer(modules: [detector, transcriber], options: SpeechAnalyzer.Options(priority: .high, modelRetention: .processLifetime))
        }

        Task {
            for try await result in detector.results {
                    print("result: \(result.description)]")
            }
        }

I never see any of the result prints in the log, while the Transcription works fine. Is the detector.results supposed to be used like that and if so, does it show any response for others?

SpeechDetector only provides a result if there is an error (and if you also specify reportResults: true).

I never see any results (for the reportResults: true)

There's wrong with speech detector ios26
 
 
Q