<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="VOi-PT-Rbu">
- <rect key="frame" x="35" y="121" width="156" height="34"/>
+ <rect key="frame" x="35" y="121" width="156" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
<color key="tintColor" systemColor="opaqueSeparatorColor"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
+ <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="Record some speech and press "Transcribe". The result will be displayed here." textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="mv2-KD-7jn">
+ <rect key="frame" x="35" y="248" width="320" height="300"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ <color key="textColor" systemColor="labelColor"/>
+ <fontDescription key="fontDescription" type="system" pointSize="20"/>
+ <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
+ </textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Brs-xi-o8i">
- <rect key="frame" x="35" y="177" width="156" height="34"/>
+ <rect key="frame" x="35" y="191" width="156" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
<color key="tintColor" systemColor="opaqueSeparatorColor"/>
<action selector="onTranscribePrepare:" destination="BYZ-38-t0r" eventType="touchDown" id="16T-dN-dfB"/>
</connections>
</button>
- <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="Record some speech and press "Transcribe". The result will be displayed here." textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="mv2-KD-7jn">
- <rect key="frame" x="35" y="248" width="320" height="300"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" systemColor="systemBackgroundColor"/>
- <color key="textColor" systemColor="labelColor"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
- </textView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</constraints>
</view>
<connections>
+ <outlet property="buttonToggleCapture" destination="VOi-PT-Rbu" id="nis-VC-DQO"/>
<outlet property="buttonTranscribe" destination="Brs-xi-o8i" id="N8h-9W-ywb"/>
<outlet property="labelStatusInp" destination="Tgu-2q-eHQ" id="1hH-Ql-K6j"/>
<outlet property="textviewResult" destination="mv2-KD-7jn" id="RBw-0L-iGj"/>
_labelStatusInp.text = @"Status: Idle";
+ [_buttonToggleCapture setTitle:@"Start capturing" forState:UIControlStateNormal];
+ [_buttonToggleCapture setBackgroundColor:[UIColor grayColor]];
+
stateInp.isCapturing = false;
AudioQueueStop(stateInp.queue, true);
if (stateInp.isCapturing) {
// stop capturing
[self stopCapturing];
- [sender setTitle:@"Start Capturing" forState:UIControlStateNormal];
return;
}
if (status == 0) {
_labelStatusInp.text = @"Status: Capturing";
[sender setTitle:@"Stop Capturing" forState:UIControlStateNormal];
+ [_buttonToggleCapture setBackgroundColor:[UIColor redColor]];
}
}
if (stateInp.isCapturing) {
// stop capturing
[self stopCapturing];
- [sender setTitle:@"Start Capturing" forState:UIControlStateNormal];
return;
}
params.n_threads = 4;
params.offset_ms = 0;
+ CFTimeInterval startTime = CACurrentMediaTime();
+
if (whisper_full(stateInp.ctx, params, stateInp.audioBufferF32, stateInp.n_samples) != 0) {
NSLog(@"Failed to run the model");
_textviewResult.text = @"Failed to run the model";
return;
}
+ CFTimeInterval endTime = CACurrentMediaTime();
+
// clear the text in the textview
_textviewResult.text = @"";
_textviewResult.text = [_textviewResult.text stringByAppendingString:[NSString stringWithUTF8String:text_cur]];
}
+ // internal model timing
whisper_print_timings(stateInp.ctx);
+
+ NSLog(@"\nProcessing time: %5.3f", endTime - startTime);
+
+ _textviewResult.text = [_textviewResult.text stringByAppendingString:[NSString stringWithFormat:@"\n\n[processing time: %5.3f s]", endTime - startTime]];
}
//