objc2_speech/generated/
SFVoiceAnalytics.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// The value of a voice analysis metric.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/speech/sfacousticfeature?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct SFAcousticFeature;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for SFAcousticFeature {}
20);
21
22extern_conformance!(
23    unsafe impl NSCopying for SFAcousticFeature {}
24);
25
26unsafe impl CopyingHelper for SFAcousticFeature {
27    type Result = Self;
28}
29
30extern_conformance!(
31    unsafe impl NSObjectProtocol for SFAcousticFeature {}
32);
33
34extern_conformance!(
35    unsafe impl NSSecureCoding for SFAcousticFeature {}
36);
37
38impl SFAcousticFeature {
39    extern_methods!(
40        /// An array of feature values, one value per audio frame, corresponding to a transcript segment of recorded audio.
41        #[unsafe(method(acousticFeatureValuePerFrame))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn acousticFeatureValuePerFrame(&self) -> Retained<NSArray<NSNumber>>;
44
45        /// The duration of the audio frame.
46        #[unsafe(method(frameDuration))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn frameDuration(&self) -> NSTimeInterval;
49    );
50}
51
52/// Methods declared on superclass `NSObject`.
53impl SFAcousticFeature {
54    extern_methods!(
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[unsafe(method(new))]
60        #[unsafe(method_family = new)]
61        pub unsafe fn new() -> Retained<Self>;
62    );
63}
64
65extern_class!(
66    /// A collection of vocal analysis metrics.
67    ///
68    /// Use an ``SFAcousticFeature`` object to access the `SFVoiceAnalytics` insights. Voice analytics include the following features:
69    ///
70    /// - Use ``jitter`` to measure how pitch varies in audio.
71    /// - Use ``shimmer`` to measure how amplitude varies in audio.
72    /// - Use ``pitch`` to measure the highness and lowness of the tone.
73    /// - Use ``voicing`` to identify voiced regions in speech.
74    ///
75    /// These results are part of the ``SFTranscriptionSegment`` object and are available when the system sends the ``SFSpeechRecognitionResult/isFinal`` flag.
76    ///
77    /// See also [Apple's documentation](https://developer.apple.com/documentation/speech/sfvoiceanalytics?language=objc)
78    #[unsafe(super(NSObject))]
79    #[derive(Debug, PartialEq, Eq, Hash)]
80    pub struct SFVoiceAnalytics;
81);
82
83extern_conformance!(
84    unsafe impl NSCoding for SFVoiceAnalytics {}
85);
86
87extern_conformance!(
88    unsafe impl NSCopying for SFVoiceAnalytics {}
89);
90
91unsafe impl CopyingHelper for SFVoiceAnalytics {
92    type Result = Self;
93}
94
95extern_conformance!(
96    unsafe impl NSObjectProtocol for SFVoiceAnalytics {}
97);
98
99extern_conformance!(
100    unsafe impl NSSecureCoding for SFVoiceAnalytics {}
101);
102
103impl SFVoiceAnalytics {
104    extern_methods!(
105        /// The variation in pitch in each frame of a transcription segment, expressed as a percentage of the frame's fundamental frequency.
106        #[unsafe(method(jitter))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn jitter(&self) -> Retained<SFAcousticFeature>;
109
110        /// The variation in vocal volume stability (amplitude) in each frame of a transcription segment, expressed in decibels.
111        #[unsafe(method(shimmer))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn shimmer(&self) -> Retained<SFAcousticFeature>;
114
115        /// The highness or lowness of the tone (fundamental frequency) in each frame of a transcription segment, expressed as a logarithm.
116        ///
117        /// The value is a logarithm (base `e`) of the normalized pitch estimate for each frame.
118        #[unsafe(method(pitch))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn pitch(&self) -> Retained<SFAcousticFeature>;
121
122        /// The likelihood of a voice in each frame of a transcription segment.
123        ///
124        /// The `voicing` value is expressed as a probability in the range `[0.0, 1.0]`.
125        #[unsafe(method(voicing))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn voicing(&self) -> Retained<SFAcousticFeature>;
128    );
129}
130
131/// Methods declared on superclass `NSObject`.
132impl SFVoiceAnalytics {
133    extern_methods!(
134        #[unsafe(method(init))]
135        #[unsafe(method_family = init)]
136        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
137
138        #[unsafe(method(new))]
139        #[unsafe(method_family = new)]
140        pub unsafe fn new() -> Retained<Self>;
141    );
142}