Skip to content

examples : use xcframework in whisper.objc example #2882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

danbev
Copy link
Collaborator

@danbev danbev commented Mar 14, 2025

This commit updates the whisper.objc example to use the xcframework.

The motivation for this to be consistent with the swift example and to also act as a reference for how to use the xcframework in an objc project.

Resolves: #2881

@danbev
Copy link
Collaborator Author

danbev commented Mar 14, 2025

I'm looking into an issue when running this example which I don't think is related to the xcframework, but I want to verify this hence the draft pr. This issue was that I had mistakenly removed the model resources from the project. I reverted those changes and the model now loads as expected.

I ran into another issue when trying to capture audio which did not work for me. I've added 5afa03e which tries to address this. I'm not sure as to why this is needed now, perhaps a reason could be that when using more recent iOS versions Apple requires the session to be explicitly activated.

danbev added 2 commits March 17, 2025 07:17
This commit updates the whisper.objc example to use the xcframework.

The motivation for this to be consistent with the swift example and to
also act as a reference for how to use the xcframework in an objc
project.

Resolves: ggml-org#2881
This commit adds the setup of the audio session in the viewDidload
method of the ViewController.m file. This is necessary to allow the app
to record audio.

The motivation for this is that without this it was not possible to
caputue audio from the microphone. It was possible to click on the
Capture button but nothing happened after that, and the button was not
marked red indicating that the button could be clicked again to stop
capturing. With this change it is possible to capture audio from the
microphone and get it transcribed.
@danbev danbev force-pushed the whisper-objc-xcframework branch from f7bda7e to 5afa03e Compare March 17, 2025 06:20
@danbev danbev marked this pull request as ready for review March 17, 2025 06:29
Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on iPhone 13 Mini - audio capture works even without the AVAudioSession. But for the simulator, the AVAudioSession patch is necessary. Maybe it is some new requirement because I don't think it was needed in the past.

@danbev danbev merged commit 83b14c3 into ggml-org:master Mar 17, 2025
45 checks passed
buxuku pushed a commit to buxuku/whisper.cpp that referenced this pull request Mar 26, 2025
* examples : use xcframework in whisper.objc example

This commit updates the whisper.objc example to use the xcframework.

The motivation for this to be consistent with the swift example and to
also act as a reference for how to use the xcframework in an objc
project.

Resolves: ggml-org#2881

* examples : setup audio session viewDidload

This commit adds the setup of the audio session in the viewDidload
method of the ViewController.m file. This is necessary to allow the app
to record audio.

The motivation for this is that without this it was not possible to
caputue audio from the microphone. It was possible to click on the
Capture button but nothing happened after that, and the button was not
marked red indicating that the button could be clicked again to stop
capturing. With this change it is possible to capture audio from the
microphone and get it transcribed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update whisper.objc example to use xcframework
2 participants