Skip to content

Commit

Permalink
refactor: consolidate whisper.cpp download & code
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Dec 31, 2023
1 parent d89b8b9 commit 5a421fd
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 59 deletions.
15 changes: 2 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,5 @@ test_resources/test.png.aes

screenshots

macos/whisper.cpp/*.zip
macos/whisper.cpp/whisper.cpp*/
macos/whisper.cpp/ggml.c
macos/whisper.cpp/ggml.h
macos/whisper.cpp/whisper.cpp
macos/whisper.cpp/whisper.h

ios/whisper.cpp/*.zip
ios/whisper.cpp/whisper.cpp*/
ios/whisper.cpp/ggml.c
ios/whisper.cpp/ggml.h
ios/whisper.cpp/whisper.cpp
ios/whisper.cpp/whisper.h
whisper.cpp/*.zip
whisper.cpp/whisper.cpp-*/
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ bundle:
#######################################

.PHONY: ios_build_ipa
ios_build_ipa: get_whisper_cpp_ios
ios_build_ipa: get_whisper_cpp
$(FLUTTER_CMD) build ipa

.PHONY: ios_build
Expand Down Expand Up @@ -193,15 +193,9 @@ macos_open: macos_build macos_archive

.PHONY: get_whisper_cpp
get_whisper_cpp:
cd macos/whisper.cpp/ && \
cd whisper.cpp/ && \
wget -nc https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v$(WHISPER_CPP_VERSION).zip && \
unzip v$(WHISPER_CPP_VERSION).zip

.PHONY: get_whisper_cpp_ios
get_whisper_cpp_ios:
cd ios/whisper.cpp/ && \
wget -nc https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v$(WHISPER_CPP_VERSION).zip && \
unzip v$(WHISPER_CPP_VERSION).zip
unzip -n v$(WHISPER_CPP_VERSION).zip

.PHONY: macos_fastlane_build
macos_fastlane_build:
Expand Down
36 changes: 18 additions & 18 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
AD3F79932B41D98B009867B5 /* LibWhisper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD3F79922B41D98B009867B5 /* LibWhisper.swift */; };
AD3F79A12B41D9B5009867B5 /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD3F799D2B41D9B5009867B5 /* whisper.cpp */; };
AD3F79A22B41D9B5009867B5 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = AD3F799F2B41D9B5009867B5 /* ggml.c */; };
ADB650B7270B3C4300B98C66 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADB650B6270B3C4300B98C66 /* HealthKit.framework */; };
ADB9DA302B4180DC0002A6CA /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB9DA2C2B4180DC0002A6CA /* whisper.cpp */; };
ADB9DA312B4180DC0002A6CA /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = ADB9DA2F2B4180DC0002A6CA /* ggml.c */; };
ADC929BF2A16DD7300FEAF10 /* LibWhisper.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC929BE2A16DD7300FEAF10 /* LibWhisper.swift */; };
FD4BDDFBB85CAB6754042A0B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E08CACAFD56E1EF268BBD8C5 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -50,15 +50,15 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AD0869BB271438AF00225DF9 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Base.xcconfig; path = Flutter/Base.xcconfig; sourceTree = "<group>"; };
ADA413802A0DB79F00C39C5B /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
AD3F79912B41D98B009867B5 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Runner-Bridging-Header.h"; path = "../../whisper.cpp/Runner-Bridging-Header.h"; sourceTree = "<group>"; };
AD3F79922B41D98B009867B5 /* LibWhisper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibWhisper.swift; path = ../../whisper.cpp/LibWhisper.swift; sourceTree = "<group>"; };
AD3F799D2B41D9B5009867B5 /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = "../../whisper.cpp/whisper.cpp-1.4.2/whisper.cpp"; sourceTree = "<group>"; };
AD3F799E2B41D9B5009867B5 /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = "../../whisper.cpp/whisper.cpp-1.4.2/ggml.h"; sourceTree = "<group>"; };
AD3F799F2B41D9B5009867B5 /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = "../../whisper.cpp/whisper.cpp-1.4.2/ggml.c"; sourceTree = "<group>"; };
AD3F79A02B41D9B5009867B5 /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = "../../whisper.cpp/whisper.cpp-1.4.2/whisper.h"; sourceTree = "<group>"; };
ADAEC2742738A8F200996377 /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = "<group>"; };
ADB650B5270B3C4300B98C66 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
ADB650B6270B3C4300B98C66 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
ADB9DA2C2B4180DC0002A6CA /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = "whisper.cpp-1.4.2/whisper.cpp"; sourceTree = "<group>"; };
ADB9DA2D2B4180DC0002A6CA /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = "whisper.cpp-1.4.2/whisper.h"; sourceTree = "<group>"; };
ADB9DA2E2B4180DC0002A6CA /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = "whisper.cpp-1.4.2/ggml.h"; sourceTree = "<group>"; };
ADB9DA2F2B4180DC0002A6CA /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = "whisper.cpp-1.4.2/ggml.c"; sourceTree = "<group>"; };
ADC929BE2A16DD7300FEAF10 /* LibWhisper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibWhisper.swift; path = ../../macos/whisper.cpp/LibWhisper.swift; sourceTree = "<group>"; };
ADEF534728103FDF00F29D25 /* RunnerDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerDebug.entitlements; sourceTree = "<group>"; };
E08CACAFD56E1EF268BBD8C5 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9EF5E47E2CAAE216BAF45A3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -139,12 +139,12 @@
ADA4137B2A0DB72A00C39C5B /* whisper.cpp */ = {
isa = PBXGroup;
children = (
ADB9DA2F2B4180DC0002A6CA /* ggml.c */,
ADB9DA2E2B4180DC0002A6CA /* ggml.h */,
ADB9DA2C2B4180DC0002A6CA /* whisper.cpp */,
ADB9DA2D2B4180DC0002A6CA /* whisper.h */,
ADC929BE2A16DD7300FEAF10 /* LibWhisper.swift */,
ADA413802A0DB79F00C39C5B /* Runner-Bridging-Header.h */,
AD3F799F2B41D9B5009867B5 /* ggml.c */,
AD3F799E2B41D9B5009867B5 /* ggml.h */,
AD3F799D2B41D9B5009867B5 /* whisper.cpp */,
AD3F79A02B41D9B5009867B5 /* whisper.h */,
AD3F79922B41D98B009867B5 /* LibWhisper.swift */,
AD3F79912B41D98B009867B5 /* Runner-Bridging-Header.h */,
);
path = whisper.cpp;
sourceTree = "<group>";
Expand Down Expand Up @@ -309,10 +309,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ADB9DA312B4180DC0002A6CA /* ggml.c in Sources */,
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
ADC929BF2A16DD7300FEAF10 /* LibWhisper.swift in Sources */,
ADB9DA302B4180DC0002A6CA /* whisper.cpp in Sources */,
AD3F79A12B41D9B5009867B5 /* whisper.cpp in Sources */,
AD3F79932B41D98B009867B5 /* LibWhisper.swift in Sources */,
AD3F79A22B41D9B5009867B5 /* ggml.c in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
38 changes: 20 additions & 18 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
7E2335674AA28E31A7EEBE87 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAE814E2540AB2A5F49FEB9F /* Pods_Runner.framework */; };
AD38B4842B41C7A100618129 /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD38B4812B41C7A100618129 /* whisper.cpp */; };
AD38B4852B41C7A100618129 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = AD38B4822B41C7A100618129 /* ggml.c */; };
ADAC398A2A06D97C00E07F8F /* LibWhisper.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAC39892A06D97C00E07F8F /* LibWhisper.swift */; };
AD3F79962B41D994009867B5 /* LibWhisper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD3F79942B41D994009867B5 /* LibWhisper.swift */; };
AD3F799B2B41D9AA009867B5 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = AD3F79972B41D9AA009867B5 /* ggml.c */; };
AD3F799C2B41D9AA009867B5 /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD3F79992B41D9AA009867B5 /* whisper.cpp */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -74,13 +74,14 @@
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
A87512A16BAFE7C799AAEE04 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
AD38B4802B41C7A100618129 /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = "whisper.cpp-1.4.2/ggml.h"; sourceTree = "<group>"; };
AD38B4812B41C7A100618129 /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = "whisper.cpp-1.4.2/whisper.cpp"; sourceTree = "<group>"; };
AD38B4822B41C7A100618129 /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = "whisper.cpp-1.4.2/ggml.c"; sourceTree = "<group>"; };
AD38B4832B41C7A100618129 /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = "whisper.cpp-1.4.2/whisper.h"; sourceTree = "<group>"; };
AD3F79942B41D994009867B5 /* LibWhisper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LibWhisper.swift; path = ../../whisper.cpp/LibWhisper.swift; sourceTree = "<group>"; };
AD3F79972B41D9AA009867B5 /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = "../../whisper.cpp/whisper.cpp-1.4.2/ggml.c"; sourceTree = "<group>"; };
AD3F79982B41D9AA009867B5 /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = "../../whisper.cpp/whisper.cpp-1.4.2/whisper.h"; sourceTree = "<group>"; };
AD3F79992B41D9AA009867B5 /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = "../../whisper.cpp/whisper.cpp-1.4.2/whisper.cpp"; sourceTree = "<group>"; };
AD3F799A2B41D9AA009867B5 /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = "../../whisper.cpp/whisper.cpp-1.4.2/ggml.h"; sourceTree = "<group>"; };
AD3F79A32B41DA90009867B5 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Runner-Bridging-Header.h"; path = "../../whisper.cpp/Runner-Bridging-Header.h"; sourceTree = "<group>"; };
AD3F79A42B41DAE9009867B5 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
AD4D50B4272DC22C00B0D18C /* RunnerDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerDebug.entitlements; sourceTree = "<group>"; };
ADAC39822A06D93C00E07F8F /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
ADAC39892A06D97C00E07F8F /* LibWhisper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibWhisper.swift; sourceTree = "<group>"; };
BAE814E2540AB2A5F49FEB9F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EE88E1714354055D8612F843 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -153,6 +154,7 @@
33FAB671232836740065AC1E /* Runner */ = {
isa = PBXGroup;
children = (
AD3F79A32B41DA90009867B5 /* Runner-Bridging-Header.h */,
AD4D50B4272DC22C00B0D18C /* RunnerDebug.entitlements */,
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
Expand All @@ -167,12 +169,12 @@
ADAC39812A06D91900E07F8F /* whisper.cpp */ = {
isa = PBXGroup;
children = (
AD38B4822B41C7A100618129 /* ggml.c */,
AD38B4802B41C7A100618129 /* ggml.h */,
AD38B4812B41C7A100618129 /* whisper.cpp */,
AD38B4832B41C7A100618129 /* whisper.h */,
ADAC39892A06D97C00E07F8F /* LibWhisper.swift */,
ADAC39822A06D93C00E07F8F /* Runner-Bridging-Header.h */,
AD3F79A42B41DAE9009867B5 /* Runner-Bridging-Header.h */,
AD3F79972B41D9AA009867B5 /* ggml.c */,
AD3F799A2B41D9AA009867B5 /* ggml.h */,
AD3F79992B41D9AA009867B5 /* whisper.cpp */,
AD3F79982B41D9AA009867B5 /* whisper.h */,
AD3F79942B41D994009867B5 /* LibWhisper.swift */,
);
path = whisper.cpp;
sourceTree = "<group>";
Expand Down Expand Up @@ -359,11 +361,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ADAC398A2A06D97C00E07F8F /* LibWhisper.swift in Sources */,
AD38B4842B41C7A100618129 /* whisper.cpp in Sources */,
AD38B4852B41C7A100618129 /* ggml.c in Sources */,
AD3F79962B41D994009867B5 /* LibWhisper.swift in Sources */,
AD3F799C2B41D9AA009867B5 /* whisper.cpp in Sources */,
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
AD3F799B2B41D9AA009867B5 /* ggml.c in Sources */,
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.396+2307
version: 0.9.396+2308

msix_config:
display_name: LottiApp
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions whisper.cpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Whisper.cpp integration

Run `make get_whisper_cpp` in project root to download the matching version. The version is defined
at the top of the `Makefile`.
File renamed without changes.

0 comments on commit 5a421fd

Please sign in to comment.