├── SpeechToTextDemo ├── en.lproj │ └── InfoPlist.strings ├── AppDelegate.h ├── main.m ├── ViewController.h ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── SpeechToTextDemo-Prefix.pch ├── SpeechToTextDemo-Info.plist ├── ViewController.m ├── AppDelegate.m └── Base.lproj │ └── Main.storyboard ├── SpeechToText ├── bg.png ├── mic.png ├── Speex.framework │ ├── Speex │ └── Headers │ │ ├── speex_config_types.h │ │ ├── speex_buffer.h │ │ ├── speex_stereo.h │ │ ├── speex_types.h │ │ ├── speex_header.h │ │ ├── speex_callbacks.h │ │ ├── speex_echo.h │ │ ├── speex_bits.h │ │ ├── speex_jitter.h │ │ ├── speex_preprocess.h │ │ ├── speex.h │ │ └── speex_resampler.h ├── WaveDisplay.h ├── WaveDisplay.m ├── SineWaveViewController.h ├── SineWaveViewController.m ├── SpeechToTextModule.h ├── SineWaveViewController.xib └── SpeechToTextModule.m ├── SpeechToTextDemoTests ├── en.lproj │ └── InfoPlist.strings ├── SpeechToTextDemoTests-Info.plist └── SpeechToTextDemoTests.m ├── SpeechToTextDemo.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── zeeshan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── developer.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ ├── developer.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── SpeechToTextDemo.xcscheme │ └── zeeshan.xcuserdatad │ │ ├── xcschemes │ │ ├── xcschememanagement.plist │ │ └── SpeechToTextDemo.xcscheme │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── project.pbxproj ├── README.md ├── LICENSE-speex.md └── License.md /SpeechToTextDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SpeechToText/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzeeshanid/iOS-Speech-To-Text/HEAD/SpeechToText/bg.png -------------------------------------------------------------------------------- /SpeechToTextDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SpeechToText/mic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzeeshanid/iOS-Speech-To-Text/HEAD/SpeechToText/mic.png -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Speex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzeeshanid/iOS-Speech-To-Text/HEAD/SpeechToText/Speex.framework/Speex -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/project.xcworkspace/xcuserdata/zeeshan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzeeshanid/iOS-Speech-To-Text/HEAD/SpeechToTextDemo.xcodeproj/project.xcworkspace/xcuserdata/zeeshan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/project.xcworkspace/xcuserdata/developer.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzeeshanid/iOS-Speech-To-Text/HEAD/SpeechToTextDemo.xcodeproj/project.xcworkspace/xcuserdata/developer.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPEEX_TYPES_H__ 2 | #define __SPEEX_TYPES_H__ 3 | 4 | /* these are filled in by configure */ 5 | typedef short spx_int16_t; 6 | typedef unsigned short spx_uint16_t; 7 | typedef int spx_int32_t; 8 | typedef unsigned int spx_uint32_t; 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /SpeechToText/WaveDisplay.h: -------------------------------------------------------------------------------- 1 | // 2 | // WaveDisplay.h 3 | // SpeechToText 4 | // 5 | // Created by Sam Bosley on 10/11/11. 6 | // Copyright (c) 2011 Astrid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WaveDisplay : UIView 12 | 13 | @property (retain) NSArray *dataPoints; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SpeechToTextDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SpeechToTextDemo 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SpeechToTextDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SpeechToTextDemo 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SpeechToTextDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SpeechToTextDemo 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SpeechToTextModule.h" 11 | 12 | @interface ViewController : UIViewController 13 | { 14 | 15 | } 16 | @property(nonatomic, strong)SpeechToTextModule *speechToTextObj; 17 | @end 18 | -------------------------------------------------------------------------------- /SpeechToTextDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SpeechToTextDemo/SpeechToTextDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | 17 | 18 | #define GOOGLE_SPEECH_TO_TEXT_KEY @"your api key" 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /SpeechToTextDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SpeechToTextDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B3FFFF44185E0B390008EC39 16 | 17 | primary 18 | 19 | 20 | B3FFFF65185E0B3A0008EC39 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/xcuserdata/zeeshan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SpeechToTextDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B3FFFF44185E0B390008EC39 16 | 17 | primary 18 | 19 | 20 | B3FFFF65185E0B3A0008EC39 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | iOS-Speech-To-Text 2 | ================== 3 | 4 | This library use the Google Voice API and the Speex audio codec for speech-to-text on iOS 5 | 6 |

Update:

Google speech to text api v1 has been deprecated and google has release v2 which requires api key.
7 | 8 | For details see this github repository 9 | 10 | You can get the api key by following the steps defined here 11 | 12 | All you need to do is to open "SpeechToTextDemo-Prefix.pch" from sample project and set your api key. 13 | 14 | For details see this blog post http://ideamakerz.com/mzeeshanid/ios-speech-to-text/ 15 | -------------------------------------------------------------------------------- /SpeechToTextDemoTests/SpeechToTextDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.iosDevelopment.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SpeechToTextDemoTests/SpeechToTextDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SpeechToTextDemoTests.m 3 | // SpeechToTextDemoTests 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SpeechToTextDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SpeechToTextDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/xcuserdata/zeeshan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SpeechToTextDemo/SpeechToTextDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.iosDevelopment.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LICENSE-speex.md: -------------------------------------------------------------------------------- 1 | © 2002-2003, Jean-Marc Valin/Xiph.Org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 10 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 11 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /SpeechToTextDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SpeechToTextDemo 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | { 13 | UITextField *fakeTextField; 14 | } 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | fakeTextField = [[UITextField alloc] initWithFrame:CGRectZero]; 24 | [fakeTextField setHidden:YES]; 25 | [self.view addSubview:fakeTextField]; 26 | 27 | self.speechToTextObj = [[SpeechToTextModule alloc] initWithCustomDisplay:@"SineWaveViewController"]; 28 | [self.speechToTextObj setDelegate:self]; 29 | } 30 | 31 | - (void)didReceiveMemoryWarning 32 | { 33 | [super didReceiveMemoryWarning]; 34 | // Dispose of any resources that can be recreated. 35 | } 36 | #pragma mark - My IBActions - 37 | - (IBAction)recordSpeechButtonTapped:(UIButton *)sender 38 | { 39 | [self.speechToTextObj beginRecording]; 40 | } 41 | #pragma mark - SpeechToTextModule Delegate - 42 | - (BOOL)didReceiveVoiceResponse:(NSData *)data 43 | { 44 | NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 45 | NSLog(@"responseString: %@",responseString); 46 | return YES; 47 | } 48 | - (void)showSineWaveView:(SineWaveViewController *)view 49 | { 50 | [fakeTextField setInputView:view.view]; 51 | [fakeTextField becomeFirstResponder]; 52 | } 53 | - (void)dismissSineWaveView:(SineWaveViewController *)view cancelled:(BOOL)wasCancelled 54 | { 55 | [fakeTextField resignFirstResponder]; 56 | } 57 | - (void)showLoadingView 58 | { 59 | NSLog(@"show loadingView"); 60 | } 61 | - (void)requestFailedWithError:(NSError *)error 62 | { 63 | NSLog(@"error: %@",error); 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /SpeechToText/WaveDisplay.m: -------------------------------------------------------------------------------- 1 | // 2 | // WaveDisplay.m 3 | // SpeechToText 4 | // 5 | // Created by Sam Bosley on 10/11/11. 6 | // Copyright (c) 2011 Astrid. All rights reserved. 7 | // 8 | 9 | #import "WaveDisplay.h" 10 | #import "SpeechToTextModule.h" 11 | 12 | @implementation WaveDisplay 13 | 14 | @synthesize dataPoints; 15 | 16 | - (id)initWithFrame:(CGRect)frame 17 | { 18 | self = [super initWithFrame:frame]; 19 | if (self) { 20 | // Initialization code 21 | } 22 | return self; 23 | } 24 | 25 | - (void)dealloc { 26 | [super dealloc]; 27 | self.dataPoints = nil; 28 | } 29 | 30 | // Simulates drawing a waveform by drawing a series of alternating 31 | // quadratic curves of varying heights. Also reverses the sign of 32 | // each data point at every iteration to achieve the effect of 33 | // waveform movement 34 | - (void)drawRect:(CGRect)rect { 35 | [super drawRect:rect]; 36 | static bool reverse = false; 37 | 38 | CGFloat scaleFactor = ((rect.size.height / 2) - 4.0) / kMaxVolumeSampleValue; 39 | CGContextRef context = UIGraphicsGetCurrentContext(); 40 | 41 | CGContextBeginPath(context); 42 | CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); 43 | CGContextSetLineWidth(context, 3.0); 44 | int count = [self.dataPoints count]; 45 | CGFloat dx = rect.size.width / count; 46 | CGFloat x = 0.0; 47 | CGFloat y = rect.size.height / 2; 48 | CGContextMoveToPoint(context, x, y); 49 | BOOL down = NO; 50 | 51 | for (NSNumber *point in self.dataPoints) { 52 | // Draw curve 53 | CGFloat raw = [point floatValue] * scaleFactor; 54 | CGFloat draw = (down ? -raw : raw); 55 | draw = (reverse ? -draw : draw); 56 | x += dx; 57 | CGContextAddQuadCurveToPoint(context, x + dx/2, y - draw * 2, x, y); 58 | 59 | down = !down; 60 | } 61 | reverse = !reverse; 62 | CGContextDrawPath(context, kCGPathStroke);//*/ 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /SpeechToTextDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SpeechToTextDemo 4 | // 5 | // Created by Muhammad Zeeshan on 12/15/13. 6 | // Copyright (c) 2013 Muhammad Zeeshan. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SpeechToText/SineWaveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SineWaveViewController.h 3 | // SpeechToText 4 | // 5 | // Created by Sam Bosley on 10/11/11. 6 | // Copyright (c) 2011 Astrid. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "WaveDisplay.h" 11 | 12 | @protocol SineWaveViewDelegate 13 | 14 | - (void)sineWaveDoneAction; 15 | - (void)sineWaveCancelAction; 16 | 17 | @end 18 | 19 | // Users of this class can create a custom nib conforming to 20 | // the defined IB interface. 21 | 22 | @interface SineWaveViewController : UIViewController { 23 | IBOutlet UILabel *header; // Title header 24 | IBOutlet UIImageView *backgroundImage; 25 | 26 | // Displays a realtime waveform that receives new data from the STTModule during recording 27 | IBOutlet WaveDisplay *waveDisplay; 28 | 29 | // This view can be used if the sine wave controller is repurposed to show a loading screen during 30 | // voice processing (as it is in Astrid) 31 | IBOutlet UIView *processingView; 32 | 33 | IBOutlet UIButton *doneButton; 34 | IBOutlet UIButton *cancelButton; 35 | IBOutlet UITextView *footer; 36 | } 37 | 38 | @property (assign) id delegate; 39 | @property (readonly) WaveDisplay *waveDisplay; 40 | @property (readonly) UIImageView *backgroundView; 41 | @property (readonly) UIView *processingView; 42 | @property (readonly) UIButton *doneButton; 43 | @property (readonly) UIButton *cancelButton; 44 | @property (readonly) UILabel *header; 45 | @property (readonly) UITextView *footer; 46 | 47 | // Pointer to the array containing data points for the waveform to draw 48 | @property (nonatomic, retain) NSArray *dataPoints; 49 | 50 | // Action sent by doneButton. This passes "done" or "cancel" messages to the delegate, 51 | // which is generally a SpeechToTextModule instance 52 | - (IBAction)done; 53 | 54 | - (IBAction)cancel; 55 | 56 | // Force the waveform display to update when new data is added 57 | - (void)updateWaveDisplay; 58 | 59 | // Resets the view state to the default (see the .m file for what that default is) 60 | - (void)resetViewState; 61 | 62 | // Repurposes the done button to be a cancel button 63 | //- (void)repurposeForCancelling; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /SpeechToText/SineWaveViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SineWaveViewController.m 3 | // SpeechToText 4 | // 5 | // Created by Sam Bosley on 10/11/11. 6 | // Copyright (c) 2011 Astrid. All rights reserved. 7 | // 8 | 9 | #import "SineWaveViewController.h" 10 | #import "SpeechToTextModule.h" 11 | 12 | @interface SineWaveViewController () 13 | 14 | @property (retain) NSString *originalDoneText; 15 | 16 | @end 17 | 18 | @implementation SineWaveViewController 19 | 20 | @synthesize delegate; 21 | @synthesize dataPoints; 22 | @synthesize backgroundView; 23 | @synthesize waveDisplay; 24 | @synthesize doneButton; 25 | @synthesize processingView; 26 | @synthesize header; 27 | @synthesize footer; 28 | @synthesize originalDoneText; 29 | @synthesize cancelButton; 30 | 31 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 32 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 33 | if (self) { 34 | 35 | } 36 | return self; 37 | } 38 | 39 | - (void)viewDidLoad { 40 | [super viewDidLoad]; 41 | waveDisplay.dataPoints = self.dataPoints; 42 | } 43 | 44 | - (void)setDataPoints:(NSArray *)_dataPoints { 45 | // Have to hold on to them here in case the wave display hasn't loaded when they're first set 46 | [dataPoints release]; 47 | dataPoints = [_dataPoints retain]; 48 | waveDisplay.dataPoints = dataPoints; 49 | } 50 | 51 | - (void)dealloc { 52 | delegate = nil; 53 | [dataPoints release]; 54 | [header release]; 55 | [footer release]; 56 | [backgroundImage release]; 57 | [waveDisplay release]; 58 | [doneButton release]; 59 | [cancelButton release]; 60 | [processingView release]; 61 | self.originalDoneText = nil; 62 | 63 | [super dealloc]; 64 | } 65 | 66 | - (void)resetViewState { 67 | self.header.hidden = NO; 68 | self.header.text = @"Speak now"; 69 | self.header.font = [UIFont fontWithName:@"Helvetica-Bold" size:17.0]; 70 | self.processingView.hidden = YES; 71 | self.waveDisplay.hidden = NO; 72 | self.doneButton.hidden = NO; 73 | self.doneButton.enabled = YES; 74 | self.cancelButton.hidden = NO; 75 | self.footer.hidden = YES; 76 | } 77 | 78 | - (IBAction)done { 79 | [delegate sineWaveDoneAction]; 80 | } 81 | 82 | -(IBAction)cancel { 83 | [delegate sineWaveCancelAction]; 84 | } 85 | 86 | - (void)updateWaveDisplay { 87 | [waveDisplay setNeedsDisplay]; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_buffer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007 Jean-Marc Valin 2 | 3 | File: speex_buffer.h 4 | This is a very simple ring buffer implementation. It is not thread-safe 5 | so you need to do your own locking. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | 3. The name of the author may not be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef SPEEX_BUFFER_H 35 | #define SPEEX_BUFFER_H 36 | 37 | #include "speex/speex_types.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | struct SpeexBuffer_; 44 | typedef struct SpeexBuffer_ SpeexBuffer; 45 | 46 | SpeexBuffer *speex_buffer_init(int size); 47 | 48 | void speex_buffer_destroy(SpeexBuffer *st); 49 | 50 | int speex_buffer_write(SpeexBuffer *st, void *data, int len); 51 | 52 | int speex_buffer_writezeros(SpeexBuffer *st, int len); 53 | 54 | int speex_buffer_read(SpeexBuffer *st, void *data, int len); 55 | 56 | int speex_buffer_get_available(SpeexBuffer *st); 57 | 58 | int speex_buffer_resize(SpeexBuffer *st, int len); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /SpeechToText/SpeechToTextModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // VoiceAddModule.h 3 | // AstridiPhone 4 | // 5 | // Created by Sam Bosley on 10/7/11. 6 | // Copyright (c) 2011 Todoroo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import "SineWaveViewController.h" 14 | 15 | #define kNumberBuffers 3 16 | #define kNumVolumeSamples 10 17 | #define kSilenceThresholdDB -30.0 18 | 19 | #define kVolumeSamplingInterval 0.05 20 | #define kSilenceTimeThreshold 0.9 21 | #define kSilenceThresholdNumSamples kSilenceTimeThreshold / kVolumeSamplingInterval 22 | 23 | // For scaling display 24 | #define kMinVolumeSampleValue 0.01 25 | #define kMaxVolumeSampleValue 1.0 26 | typedef struct AQRecorderState { 27 | AudioStreamBasicDescription mDataFormat; 28 | AudioQueueRef mQueue; 29 | AudioQueueBufferRef mBuffers[kNumberBuffers]; 30 | UInt32 bufferByteSize; 31 | SInt64 mCurrentPacket; 32 | bool mIsRunning; 33 | 34 | SpeexBits speex_bits; 35 | void * speex_enc_state; 36 | int speex_samples_per_frame; 37 | __unsafe_unretained NSMutableData * encodedSpeexData; 38 | 39 | __unsafe_unretained id selfRef; 40 | } AQRecorderState; 41 | 42 | @protocol SpeechToTextModuleDelegate 43 | 44 | // Delegate will need to parse JSON and dismiss loading view if presented 45 | // returns true on success, false on failure 46 | - (BOOL)didReceiveVoiceResponse:(NSData *)data; 47 | 48 | @optional 49 | - (void)showSineWaveView:(SineWaveViewController *)view; 50 | - (void)dismissSineWaveView:(SineWaveViewController *)view cancelled:(BOOL)wasCancelled; 51 | - (void)showLoadingView; 52 | - (void)requestFailedWithError:(NSError *)error; 53 | @end 54 | 55 | @interface SpeechToTextModule : NSObject { 56 | UIAlertView *status; 57 | 58 | AQRecorderState aqData; 59 | 60 | BOOL detectedSpeech; 61 | int samplesBelowSilence; 62 | 63 | NSTimer *meterTimer; 64 | BOOL processing; 65 | 66 | NSMutableArray *volumeDataPoints; 67 | SineWaveViewController *sineWave; 68 | 69 | NSThread *processingThread; 70 | } 71 | 72 | @property (readonly) BOOL recording; 73 | @property (assign) id delegate; 74 | 75 | /* Caller can pass a non-nil nib name to specify the nib with which to create 76 | a SineWaveViewController (nib should conform to the spec in the SineWaveViewController 77 | interface). A nil argument will cause the module to display an alert view instead 78 | of the custom view controller. */ 79 | - (id)initWithCustomDisplay:(NSString *)nibName; 80 | 81 | // Begins a voice recording 82 | - (void)beginRecording; 83 | 84 | // Stops a voice recording. The startProcessing parameter is intended for internal use, 85 | // so don't pass NO unless you really mean it. 86 | - (void)stopRecording:(BOOL)startProcessing; 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_stereo.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin*/ 2 | /** 3 | @file speex_stereo.h 4 | @brief Describes the handling for intensity stereo 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef STEREO_H 36 | #define STEREO_H 37 | /** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files 38 | * This describes the Speex intensity stereo encoding/decoding 39 | * @{ 40 | */ 41 | 42 | #include "speex/speex_types.h" 43 | #include "speex/speex_bits.h" 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** If you access any of these fields directly, I'll personally come and bite you */ 50 | typedef struct SpeexStereoState { 51 | float balance; /**< Left/right balance info */ 52 | float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */ 53 | float smooth_left; /**< Smoothed left channel gain */ 54 | float smooth_right; /**< Smoothed right channel gain */ 55 | float reserved1; /**< Reserved for future use */ 56 | float reserved2; /**< Reserved for future use */ 57 | } SpeexStereoState; 58 | 59 | /** Deprecated. Use speex_stereo_state_init() instead. */ 60 | #define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0} 61 | 62 | /** Initialise/create a stereo stereo state */ 63 | SpeexStereoState *speex_stereo_state_init(); 64 | 65 | /** Reset/re-initialise an already allocated stereo state */ 66 | void speex_stereo_state_reset(SpeexStereoState *stereo); 67 | 68 | /** Destroy a stereo stereo state */ 69 | void speex_stereo_state_destroy(SpeexStereoState *stereo); 70 | 71 | /** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ 72 | void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits); 73 | 74 | /** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ 75 | void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits); 76 | 77 | /** Transforms a mono frame into a stereo frame using intensity stereo info */ 78 | void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo); 79 | 80 | /** Transforms a mono frame into a stereo frame using intensity stereo info */ 81 | void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo); 82 | 83 | /** Callback handler for intensity stereo info */ 84 | int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | /** @} */ 91 | #endif 92 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/SpeechToTextDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/xcuserdata/zeeshan.xcuserdatad/xcschemes/SpeechToTextDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_types.h: -------------------------------------------------------------------------------- 1 | /* speex_types.h taken from libogg */ 2 | /******************************************************************** 3 | * * 4 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * by the Xiph.Org Foundation http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 15 | last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $ 16 | 17 | ********************************************************************/ 18 | /** 19 | @file speex_types.h 20 | @brief Speex types 21 | */ 22 | #ifndef _SPEEX_TYPES_H 23 | #define _SPEEX_TYPES_H 24 | 25 | #if defined(_WIN32) 26 | 27 | # if defined(__CYGWIN__) 28 | # include <_G_config.h> 29 | typedef _G_int32_t spx_int32_t; 30 | typedef _G_uint32_t spx_uint32_t; 31 | typedef _G_int16_t spx_int16_t; 32 | typedef _G_uint16_t spx_uint16_t; 33 | # elif defined(__MINGW32__) 34 | typedef short spx_int16_t; 35 | typedef unsigned short spx_uint16_t; 36 | typedef int spx_int32_t; 37 | typedef unsigned int spx_uint32_t; 38 | # elif defined(__MWERKS__) 39 | typedef int spx_int32_t; 40 | typedef unsigned int spx_uint32_t; 41 | typedef short spx_int16_t; 42 | typedef unsigned short spx_uint16_t; 43 | # else 44 | /* MSVC/Borland */ 45 | typedef __int32 spx_int32_t; 46 | typedef unsigned __int32 spx_uint32_t; 47 | typedef __int16 spx_int16_t; 48 | typedef unsigned __int16 spx_uint16_t; 49 | # endif 50 | 51 | #elif defined(__MACOS__) 52 | 53 | # include 54 | typedef SInt16 spx_int16_t; 55 | typedef UInt16 spx_uint16_t; 56 | typedef SInt32 spx_int32_t; 57 | typedef UInt32 spx_uint32_t; 58 | 59 | #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ 60 | 61 | # include 62 | typedef int16_t spx_int16_t; 63 | typedef u_int16_t spx_uint16_t; 64 | typedef int32_t spx_int32_t; 65 | typedef u_int32_t spx_uint32_t; 66 | 67 | #elif defined(__BEOS__) 68 | 69 | /* Be */ 70 | # include 71 | typedef int16_t spx_int16_t; 72 | typedef u_int16_t spx_uint16_t; 73 | typedef int32_t spx_int32_t; 74 | typedef u_int32_t spx_uint32_t; 75 | 76 | #elif defined (__EMX__) 77 | 78 | /* OS/2 GCC */ 79 | typedef short spx_int16_t; 80 | typedef unsigned short spx_uint16_t; 81 | typedef int spx_int32_t; 82 | typedef unsigned int spx_uint32_t; 83 | 84 | #elif defined (DJGPP) 85 | 86 | /* DJGPP */ 87 | typedef short spx_int16_t; 88 | typedef int spx_int32_t; 89 | typedef unsigned int spx_uint32_t; 90 | 91 | #elif defined(R5900) 92 | 93 | /* PS2 EE */ 94 | typedef int spx_int32_t; 95 | typedef unsigned spx_uint32_t; 96 | typedef short spx_int16_t; 97 | 98 | #elif defined(__SYMBIAN32__) 99 | 100 | /* Symbian GCC */ 101 | typedef signed short spx_int16_t; 102 | typedef unsigned short spx_uint16_t; 103 | typedef signed int spx_int32_t; 104 | typedef unsigned int spx_uint32_t; 105 | 106 | #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) 107 | 108 | typedef short spx_int16_t; 109 | typedef unsigned short spx_uint16_t; 110 | typedef long spx_int32_t; 111 | typedef unsigned long spx_uint32_t; 112 | 113 | #elif defined(CONFIG_TI_C6X) 114 | 115 | typedef short spx_int16_t; 116 | typedef unsigned short spx_uint16_t; 117 | typedef int spx_int32_t; 118 | typedef unsigned int spx_uint32_t; 119 | 120 | #else 121 | 122 | # include 123 | 124 | #endif 125 | 126 | #endif /* _SPEEX_TYPES_H */ 127 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_header.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file speex_header.h 4 | @brief Describes the Speex header 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | 37 | #ifndef SPEEX_HEADER_H 38 | #define SPEEX_HEADER_H 39 | /** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header 40 | * This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP. 41 | * @{ 42 | */ 43 | 44 | #include "speex/speex_types.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | struct SpeexMode; 51 | 52 | /** Length of the Speex header identifier */ 53 | #define SPEEX_HEADER_STRING_LENGTH 8 54 | 55 | /** Maximum number of characters for encoding the Speex version number in the header */ 56 | #define SPEEX_HEADER_VERSION_LENGTH 20 57 | 58 | /** Speex header info for file-based formats */ 59 | typedef struct SpeexHeader { 60 | char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */ 61 | char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */ 62 | spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */ 63 | spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */ 64 | spx_int32_t rate; /**< Sampling rate used */ 65 | spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */ 66 | spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */ 67 | spx_int32_t nb_channels; /**< Number of channels encoded */ 68 | spx_int32_t bitrate; /**< Bit-rate used */ 69 | spx_int32_t frame_size; /**< Size of frames */ 70 | spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */ 71 | spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */ 72 | spx_int32_t extra_headers; /**< Number of additional headers after the comments */ 73 | spx_int32_t reserved1; /**< Reserved for future use, must be zero */ 74 | spx_int32_t reserved2; /**< Reserved for future use, must be zero */ 75 | } SpeexHeader; 76 | 77 | /** Initializes a SpeexHeader using basic information */ 78 | void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m); 79 | 80 | /** Creates the header packet from the header itself (mostly involves endianness conversion) */ 81 | char *speex_header_to_packet(SpeexHeader *header, int *size); 82 | 83 | /** Creates a SpeexHeader from a packet */ 84 | SpeexHeader *speex_packet_to_header(char *packet, int size); 85 | 86 | /** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */ 87 | void speex_header_free(void *ptr); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | /** @} */ 94 | #endif 95 | -------------------------------------------------------------------------------- /SpeechToTextDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_callbacks.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin*/ 2 | /** 3 | @file speex_callbacks.h 4 | @brief Describes callback handling and in-band signalling 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #ifndef SPEEX_CALLBACKS_H 37 | #define SPEEX_CALLBACKS_H 38 | /** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder. 39 | * @{ 40 | */ 41 | 42 | #include "speex.h" 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /** Total number of callbacks */ 49 | #define SPEEX_MAX_CALLBACKS 16 50 | 51 | /* Describes all the in-band requests */ 52 | 53 | /*These are 1-bit requests*/ 54 | /** Request for perceptual enhancement (1 for on, 0 for off) */ 55 | #define SPEEX_INBAND_ENH_REQUEST 0 56 | /** Reserved */ 57 | #define SPEEX_INBAND_RESERVED1 1 58 | 59 | /*These are 4-bit requests*/ 60 | /** Request for a mode change */ 61 | #define SPEEX_INBAND_MODE_REQUEST 2 62 | /** Request for a low mode change */ 63 | #define SPEEX_INBAND_LOW_MODE_REQUEST 3 64 | /** Request for a high mode change */ 65 | #define SPEEX_INBAND_HIGH_MODE_REQUEST 4 66 | /** Request for VBR (1 on, 0 off) */ 67 | #define SPEEX_INBAND_VBR_QUALITY_REQUEST 5 68 | /** Request to be sent acknowledge */ 69 | #define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6 70 | /** Request for VBR (1 for on, 0 for off) */ 71 | #define SPEEX_INBAND_VBR_REQUEST 7 72 | 73 | /*These are 8-bit requests*/ 74 | /** Send a character in-band */ 75 | #define SPEEX_INBAND_CHAR 8 76 | /** Intensity stereo information */ 77 | #define SPEEX_INBAND_STEREO 9 78 | 79 | /*These are 16-bit requests*/ 80 | /** Transmit max bit-rate allowed */ 81 | #define SPEEX_INBAND_MAX_BITRATE 10 82 | 83 | /*These are 32-bit requests*/ 84 | /** Acknowledge packet reception */ 85 | #define SPEEX_INBAND_ACKNOWLEDGE 12 86 | 87 | /** Callback function type */ 88 | typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data); 89 | 90 | /** Callback information */ 91 | typedef struct SpeexCallback { 92 | int callback_id; /**< ID associated to the callback */ 93 | speex_callback_func func; /**< Callback handler function */ 94 | void *data; /**< Data that will be sent to the handler */ 95 | void *reserved1; /**< Reserved for future use */ 96 | int reserved2; /**< Reserved for future use */ 97 | } SpeexCallback; 98 | 99 | /** Handle in-band request */ 100 | int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state); 101 | 102 | /** Standard handler for mode request (change mode, no questions asked) */ 103 | int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data); 104 | 105 | /** Standard handler for high mode request (change high mode, no questions asked) */ 106 | int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data); 107 | 108 | /** Standard handler for in-band characters (write to stderr) */ 109 | int speex_std_char_handler(SpeexBits *bits, void *state, void *data); 110 | 111 | /** Default handler for user-defined requests: in this case, just ignore */ 112 | int speex_default_user_handler(SpeexBits *bits, void *state, void *data); 113 | 114 | 115 | 116 | /** Standard handler for low mode request (change low mode, no questions asked) */ 117 | int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data); 118 | 119 | /** Standard handler for VBR request (Set VBR, no questions asked) */ 120 | int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data); 121 | 122 | /** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */ 123 | int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data); 124 | 125 | /** Standard handler for VBR quality request (Set VBR quality, no questions asked) */ 126 | int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data); 127 | 128 | 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | 133 | /** @} */ 134 | #endif 135 | -------------------------------------------------------------------------------- /SpeechToText/SineWaveViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 40 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_echo.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Jean-Marc Valin */ 2 | /** 3 | @file speex_echo.h 4 | @brief Echo cancellation 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | 3. The name of the author may not be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef SPEEX_ECHO_H 35 | #define SPEEX_ECHO_H 36 | /** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller 37 | * This is the acoustic echo canceller module. 38 | * @{ 39 | */ 40 | #include "speex/speex_types.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** Obtain frame size used by the AEC */ 47 | #define SPEEX_ECHO_GET_FRAME_SIZE 3 48 | 49 | /** Set sampling rate */ 50 | #define SPEEX_ECHO_SET_SAMPLING_RATE 24 51 | /** Get sampling rate */ 52 | #define SPEEX_ECHO_GET_SAMPLING_RATE 25 53 | 54 | /* Can't set window sizes */ 55 | /** Get size of impulse response (int32) */ 56 | #define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27 57 | 58 | /* Can't set window content */ 59 | /** Get impulse response (int32[]) */ 60 | #define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29 61 | 62 | /** Internal echo canceller state. Should never be accessed directly. */ 63 | struct SpeexEchoState_; 64 | 65 | /** @class SpeexEchoState 66 | * This holds the state of the echo canceller. You need one per channel. 67 | */ 68 | 69 | /** Internal echo canceller state. Should never be accessed directly. */ 70 | typedef struct SpeexEchoState_ SpeexEchoState; 71 | 72 | /** Creates a new echo canceller state 73 | * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms) 74 | * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) 75 | * @return Newly-created echo canceller state 76 | */ 77 | SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length); 78 | 79 | /** Creates a new multi-channel echo canceller state 80 | * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms) 81 | * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) 82 | * @param nb_mic Number of microphone channels 83 | * @param nb_speakers Number of speaker channels 84 | * @return Newly-created echo canceller state 85 | */ 86 | SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers); 87 | 88 | /** Destroys an echo canceller state 89 | * @param st Echo canceller state 90 | */ 91 | void speex_echo_state_destroy(SpeexEchoState *st); 92 | 93 | /** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added 94 | * to playback in this form) 95 | * 96 | * @param st Echo canceller state 97 | * @param rec Signal from the microphone (near end + far end echo) 98 | * @param play Signal played to the speaker (received from far end) 99 | * @param out Returns near-end signal with echo removed 100 | */ 101 | void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out); 102 | 103 | /** Performs echo cancellation a frame (deprecated) */ 104 | void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout); 105 | 106 | /** Perform echo cancellation using internal playback buffer, which is delayed by two frames 107 | * to account for the delay introduced by most soundcards (but it could be off!) 108 | * @param st Echo canceller state 109 | * @param rec Signal from the microphone (near end + far end echo) 110 | * @param out Returns near-end signal with echo removed 111 | */ 112 | void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out); 113 | 114 | /** Let the echo canceller know that a frame was just queued to the soundcard 115 | * @param st Echo canceller state 116 | * @param play Signal played to the speaker (received from far end) 117 | */ 118 | void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play); 119 | 120 | /** Reset the echo canceller to its original state 121 | * @param st Echo canceller state 122 | */ 123 | void speex_echo_state_reset(SpeexEchoState *st); 124 | 125 | /** Used like the ioctl function to control the echo canceller parameters 126 | * 127 | * @param st Echo canceller state 128 | * @param request ioctl-type request (one of the SPEEX_ECHO_* macros) 129 | * @param ptr Data exchanged to-from function 130 | * @return 0 if no error, -1 if request in unknown 131 | */ 132 | int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr); 133 | 134 | 135 | 136 | struct SpeexDecorrState_; 137 | 138 | typedef struct SpeexDecorrState_ SpeexDecorrState; 139 | 140 | 141 | /** Create a state for the channel decorrelation algorithm 142 | This is useful for multi-channel echo cancellation only 143 | * @param rate Sampling rate 144 | * @param channels Number of channels (it's a bit pointless if you don't have at least 2) 145 | * @param frame_size Size of the frame to process at ones (counting samples *per* channel) 146 | */ 147 | SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size); 148 | 149 | /** Remove correlation between the channels by modifying the phase and possibly 150 | adding noise in a way that is not (or little) perceptible. 151 | * @param st Decorrelator state 152 | * @param in Input audio in interleaved format 153 | * @param out Result of the decorrelation (out *may* alias in) 154 | * @param strength How much alteration of the audio to apply from 0 to 100. 155 | */ 156 | void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength); 157 | 158 | /** Destroy a Decorrelation state 159 | * @param st State to destroy 160 | */ 161 | void speex_decorrelate_destroy(SpeexDecorrState *st); 162 | 163 | 164 | #ifdef __cplusplus 165 | } 166 | #endif 167 | 168 | 169 | /** @}*/ 170 | #endif 171 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_bits.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file speex_bits.h 4 | @brief Handles bit packing/unpacking 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #ifndef BITS_H 37 | #define BITS_H 38 | /** @defgroup SpeexBits SpeexBits: Bit-stream manipulations 39 | * This is the structure that holds the bit-stream when encoding or decoding 40 | * with Speex. It allows some manipulations as well. 41 | * @{ 42 | */ 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /** Bit-packing data structure representing (part of) a bit-stream. */ 49 | typedef struct SpeexBits { 50 | char *chars; /**< "raw" data */ 51 | int nbBits; /**< Total number of bits stored in the stream*/ 52 | int charPtr; /**< Position of the byte "cursor" */ 53 | int bitPtr; /**< Position of the bit "cursor" within the current char */ 54 | int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */ 55 | int overflow;/**< Set to one if we try to read past the valid data */ 56 | int buf_size;/**< Allocated size for buffer */ 57 | int reserved1; /**< Reserved for future use */ 58 | void *reserved2; /**< Reserved for future use */ 59 | } SpeexBits; 60 | 61 | /** Initializes and allocates resources for a SpeexBits struct */ 62 | void speex_bits_init(SpeexBits *bits); 63 | 64 | /** Initializes SpeexBits struct using a pre-allocated buffer*/ 65 | void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size); 66 | 67 | /** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */ 68 | void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size); 69 | 70 | /** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/ 71 | void speex_bits_destroy(SpeexBits *bits); 72 | 73 | /** Resets bits to initial value (just after initialization, erasing content)*/ 74 | void speex_bits_reset(SpeexBits *bits); 75 | 76 | /** Rewind the bit-stream to the beginning (ready for read) without erasing the content */ 77 | void speex_bits_rewind(SpeexBits *bits); 78 | 79 | /** Initializes the bit-stream from the data in an area of memory */ 80 | void speex_bits_read_from(SpeexBits *bits, char *bytes, int len); 81 | 82 | /** Append bytes to the bit-stream 83 | * 84 | * @param bits Bit-stream to operate on 85 | * @param bytes pointer to the bytes what will be appended 86 | * @param len Number of bytes of append 87 | */ 88 | void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len); 89 | 90 | /** Write the content of a bit-stream to an area of memory 91 | * 92 | * @param bits Bit-stream to operate on 93 | * @param bytes Memory location where to write the bits 94 | * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer) 95 | * @return Number of bytes written to the "bytes" buffer 96 | */ 97 | int speex_bits_write(SpeexBits *bits, char *bytes, int max_len); 98 | 99 | /** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */ 100 | int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len); 101 | 102 | /** Append bits to the bit-stream 103 | * @param bits Bit-stream to operate on 104 | * @param data Value to append as integer 105 | * @param nbBits number of bits to consider in "data" 106 | */ 107 | void speex_bits_pack(SpeexBits *bits, int data, int nbBits); 108 | 109 | /** Interpret the next bits in the bit-stream as a signed integer 110 | * 111 | * @param bits Bit-stream to operate on 112 | * @param nbBits Number of bits to interpret 113 | * @return A signed integer represented by the bits read 114 | */ 115 | int speex_bits_unpack_signed(SpeexBits *bits, int nbBits); 116 | 117 | /** Interpret the next bits in the bit-stream as an unsigned integer 118 | * 119 | * @param bits Bit-stream to operate on 120 | * @param nbBits Number of bits to interpret 121 | * @return An unsigned integer represented by the bits read 122 | */ 123 | unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits); 124 | 125 | /** Returns the number of bytes in the bit-stream, including the last one even if it is not "full" 126 | * 127 | * @param bits Bit-stream to operate on 128 | * @return Number of bytes in the stream 129 | */ 130 | int speex_bits_nbytes(SpeexBits *bits); 131 | 132 | /** Same as speex_bits_unpack_unsigned, but without modifying the cursor position 133 | * 134 | * @param bits Bit-stream to operate on 135 | * @param nbBits Number of bits to look for 136 | * @return Value of the bits peeked, interpreted as unsigned 137 | */ 138 | unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits); 139 | 140 | /** Get the value of the next bit in the stream, without modifying the 141 | * "cursor" position 142 | * 143 | * @param bits Bit-stream to operate on 144 | * @return Value of the bit peeked (one bit only) 145 | */ 146 | int speex_bits_peek(SpeexBits *bits); 147 | 148 | /** Advances the position of the "bit cursor" in the stream 149 | * 150 | * @param bits Bit-stream to operate on 151 | * @param n Number of bits to advance 152 | */ 153 | void speex_bits_advance(SpeexBits *bits, int n); 154 | 155 | /** Returns the number of bits remaining to be read in a stream 156 | * 157 | * @param bits Bit-stream to operate on 158 | * @return Number of bits that can still be read from the stream 159 | */ 160 | int speex_bits_remaining(SpeexBits *bits); 161 | 162 | /** Insert a terminator so that the data can be sent as a packet while auto-detecting 163 | * the number of frames in each packet 164 | * 165 | * @param bits Bit-stream to operate on 166 | */ 167 | void speex_bits_insert_terminator(SpeexBits *bits); 168 | 169 | #ifdef __cplusplus 170 | } 171 | #endif 172 | 173 | /* @} */ 174 | #endif 175 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_jitter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Jean-Marc Valin */ 2 | /** 3 | @file speex_jitter.h 4 | @brief Adaptive jitter buffer for Speex 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #ifndef SPEEX_JITTER_H 37 | #define SPEEX_JITTER_H 38 | /** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer 39 | * This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size 40 | * to maintain good quality and low latency. 41 | * @{ 42 | */ 43 | 44 | #include "speex/speex_types.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /** Generic adaptive jitter buffer state */ 51 | struct JitterBuffer_; 52 | 53 | /** Generic adaptive jitter buffer state */ 54 | typedef struct JitterBuffer_ JitterBuffer; 55 | 56 | /** Definition of an incoming packet */ 57 | typedef struct _JitterBufferPacket JitterBufferPacket; 58 | 59 | /** Definition of an incoming packet */ 60 | struct _JitterBufferPacket { 61 | char *data; /**< Data bytes contained in the packet */ 62 | spx_uint32_t len; /**< Length of the packet in bytes */ 63 | spx_uint32_t timestamp; /**< Timestamp for the packet */ 64 | spx_uint32_t span; /**< Time covered by the packet (same units as timestamp) */ 65 | spx_uint16_t sequence; /**< RTP Sequence number if available (0 otherwise) */ 66 | spx_uint32_t user_data; /**< Put whatever data you like here (it's ignored by the jitter buffer) */ 67 | }; 68 | 69 | /** Packet has been retrieved */ 70 | #define JITTER_BUFFER_OK 0 71 | /** Packet is lost or is late */ 72 | #define JITTER_BUFFER_MISSING 1 73 | /** A "fake" packet is meant to be inserted here to increase buffering */ 74 | #define JITTER_BUFFER_INSERTION 2 75 | /** There was an error in the jitter buffer */ 76 | #define JITTER_BUFFER_INTERNAL_ERROR -1 77 | /** Invalid argument */ 78 | #define JITTER_BUFFER_BAD_ARGUMENT -2 79 | 80 | 81 | /** Set minimum amount of extra buffering required (margin) */ 82 | #define JITTER_BUFFER_SET_MARGIN 0 83 | /** Get minimum amount of extra buffering required (margin) */ 84 | #define JITTER_BUFFER_GET_MARGIN 1 85 | /* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */ 86 | 87 | /** Get the amount of available packets currently buffered */ 88 | #define JITTER_BUFFER_GET_AVAILABLE_COUNT 3 89 | /** Included because of an early misspelling (will remove in next release) */ 90 | #define JITTER_BUFFER_GET_AVALIABLE_COUNT 3 91 | 92 | /** Assign a function to destroy unused packet. When setting that, the jitter 93 | buffer no longer copies packet data. */ 94 | #define JITTER_BUFFER_SET_DESTROY_CALLBACK 4 95 | /** */ 96 | #define JITTER_BUFFER_GET_DESTROY_CALLBACK 5 97 | 98 | /** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */ 99 | #define JITTER_BUFFER_SET_DELAY_STEP 6 100 | /** */ 101 | #define JITTER_BUFFER_GET_DELAY_STEP 7 102 | 103 | /** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */ 104 | #define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8 105 | #define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9 106 | 107 | /** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss 108 | should be half of that or less. */ 109 | #define JITTER_BUFFER_SET_MAX_LATE_RATE 10 110 | #define JITTER_BUFFER_GET_MAX_LATE_RATE 11 111 | 112 | /** Equivalent cost of one percent late packet in timestamp units */ 113 | #define JITTER_BUFFER_SET_LATE_COST 12 114 | #define JITTER_BUFFER_GET_LATE_COST 13 115 | 116 | 117 | /** Initialises jitter buffer 118 | * 119 | * @param step_size Starting value for the size of concleanment packets and delay 120 | adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP 121 | and JITTER_BUFFER_GET_CONCEALMENT_SIZE. 122 | * @return Newly created jitter buffer state 123 | */ 124 | JitterBuffer *jitter_buffer_init(int step_size); 125 | 126 | /** Restores jitter buffer to its original state 127 | * 128 | * @param jitter Jitter buffer state 129 | */ 130 | void jitter_buffer_reset(JitterBuffer *jitter); 131 | 132 | /** Destroys jitter buffer 133 | * 134 | * @param jitter Jitter buffer state 135 | */ 136 | void jitter_buffer_destroy(JitterBuffer *jitter); 137 | 138 | /** Put one packet into the jitter buffer 139 | * 140 | * @param jitter Jitter buffer state 141 | * @param packet Incoming packet 142 | */ 143 | void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet); 144 | 145 | /** Get one packet from the jitter buffer 146 | * 147 | * @param jitter Jitter buffer state 148 | * @param packet Returned packet 149 | * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee) 150 | * @param current_timestamp Timestamp for the returned packet 151 | */ 152 | int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset); 153 | 154 | /** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp. 155 | * This is mainly useful for media where a single "frame" can be split into several packets. 156 | * 157 | * @param jitter Jitter buffer state 158 | * @param packet Returned packet 159 | */ 160 | int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet); 161 | 162 | /** Get pointer timestamp of jitter buffer 163 | * 164 | * @param jitter Jitter buffer state 165 | */ 166 | int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter); 167 | 168 | /** Advance by one tick 169 | * 170 | * @param jitter Jitter buffer state 171 | */ 172 | void jitter_buffer_tick(JitterBuffer *jitter); 173 | 174 | /** Telling the jitter buffer about the remaining data in the application buffer 175 | * @param jitter Jitter buffer state 176 | * @param rem Amount of data buffered by the application (timestamp units) 177 | */ 178 | void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem); 179 | 180 | /** Used like the ioctl function to control the jitter buffer parameters 181 | * 182 | * @param jitter Jitter buffer state 183 | * @param request ioctl-type request (one of the JITTER_BUFFER_* macros) 184 | * @param ptr Data exchanged to-from function 185 | * @return 0 if no error, -1 if request in unknown 186 | */ 187 | int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr); 188 | 189 | int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset); 190 | 191 | /* @} */ 192 | 193 | #ifdef __cplusplus 194 | } 195 | #endif 196 | 197 | #endif 198 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_preprocess.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2003 Epic Games 2 | Written by Jean-Marc Valin */ 3 | /** 4 | * @file speex_preprocess.h 5 | * @brief Speex preprocessor. The preprocess can do noise suppression, 6 | * residual echo suppression (after using the echo canceller), automatic 7 | * gain control (AGC) and voice activity detection (VAD). 8 | */ 9 | /* 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are 12 | met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, 15 | this list of conditions and the following disclaimer. 16 | 17 | 2. Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 21 | 3. The name of the author may not be used to endorse or promote products 22 | derived from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | POSSIBILITY OF SUCH DAMAGE. 35 | */ 36 | 37 | #ifndef SPEEX_PREPROCESS_H 38 | #define SPEEX_PREPROCESS_H 39 | /** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor 40 | * This is the Speex preprocessor. The preprocess can do noise suppression, 41 | * residual echo suppression (after using the echo canceller), automatic 42 | * gain control (AGC) and voice activity detection (VAD). 43 | * @{ 44 | */ 45 | 46 | #include "speex/speex_types.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** State of the preprocessor (one per channel). Should never be accessed directly. */ 53 | struct SpeexPreprocessState_; 54 | 55 | /** State of the preprocessor (one per channel). Should never be accessed directly. */ 56 | typedef struct SpeexPreprocessState_ SpeexPreprocessState; 57 | 58 | 59 | /** Creates a new preprocessing state. You MUST create one state per channel processed. 60 | * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be 61 | * the same value as that used for the echo canceller for residual echo cancellation to work. 62 | * @param sampling_rate Sampling rate used for the input. 63 | * @return Newly created preprocessor state 64 | */ 65 | SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate); 66 | 67 | /** Destroys a preprocessor state 68 | * @param st Preprocessor state to destroy 69 | */ 70 | void speex_preprocess_state_destroy(SpeexPreprocessState *st); 71 | 72 | /** Preprocess a frame 73 | * @param st Preprocessor state 74 | * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init(). 75 | * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on. 76 | */ 77 | int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x); 78 | 79 | /** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/ 80 | int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo); 81 | 82 | /** Update preprocessor state, but do not compute the output 83 | * @param st Preprocessor state 84 | * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init(). 85 | */ 86 | void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x); 87 | 88 | /** Used like the ioctl function to control the preprocessor parameters 89 | * @param st Preprocessor state 90 | * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros) 91 | * @param ptr Data exchanged to-from function 92 | * @return 0 if no error, -1 if request in unknown 93 | */ 94 | int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr); 95 | 96 | 97 | 98 | /** Set preprocessor denoiser state */ 99 | #define SPEEX_PREPROCESS_SET_DENOISE 0 100 | /** Get preprocessor denoiser state */ 101 | #define SPEEX_PREPROCESS_GET_DENOISE 1 102 | 103 | /** Set preprocessor Automatic Gain Control state */ 104 | #define SPEEX_PREPROCESS_SET_AGC 2 105 | /** Get preprocessor Automatic Gain Control state */ 106 | #define SPEEX_PREPROCESS_GET_AGC 3 107 | 108 | /** Set preprocessor Voice Activity Detection state */ 109 | #define SPEEX_PREPROCESS_SET_VAD 4 110 | /** Get preprocessor Voice Activity Detection state */ 111 | #define SPEEX_PREPROCESS_GET_VAD 5 112 | 113 | /** Set preprocessor Automatic Gain Control level (float) */ 114 | #define SPEEX_PREPROCESS_SET_AGC_LEVEL 6 115 | /** Get preprocessor Automatic Gain Control level (float) */ 116 | #define SPEEX_PREPROCESS_GET_AGC_LEVEL 7 117 | 118 | /** Set preprocessor dereverb state */ 119 | #define SPEEX_PREPROCESS_SET_DEREVERB 8 120 | /** Get preprocessor dereverb state */ 121 | #define SPEEX_PREPROCESS_GET_DEREVERB 9 122 | 123 | /** Set preprocessor dereverb level */ 124 | #define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10 125 | /** Get preprocessor dereverb level */ 126 | #define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11 127 | 128 | /** Set preprocessor dereverb decay */ 129 | #define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12 130 | /** Get preprocessor dereverb decay */ 131 | #define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13 132 | 133 | /** Set probability required for the VAD to go from silence to voice */ 134 | #define SPEEX_PREPROCESS_SET_PROB_START 14 135 | /** Get probability required for the VAD to go from silence to voice */ 136 | #define SPEEX_PREPROCESS_GET_PROB_START 15 137 | 138 | /** Set probability required for the VAD to stay in the voice state (integer percent) */ 139 | #define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16 140 | /** Get probability required for the VAD to stay in the voice state (integer percent) */ 141 | #define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17 142 | 143 | /** Set maximum attenuation of the noise in dB (negative number) */ 144 | #define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18 145 | /** Get maximum attenuation of the noise in dB (negative number) */ 146 | #define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19 147 | 148 | /** Set maximum attenuation of the residual echo in dB (negative number) */ 149 | #define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20 150 | /** Get maximum attenuation of the residual echo in dB (negative number) */ 151 | #define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21 152 | 153 | /** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */ 154 | #define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22 155 | /** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */ 156 | #define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23 157 | 158 | /** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */ 159 | #define SPEEX_PREPROCESS_SET_ECHO_STATE 24 160 | /** Get the corresponding echo canceller state */ 161 | #define SPEEX_PREPROCESS_GET_ECHO_STATE 25 162 | 163 | /** Set maximal gain increase in dB/second (int32) */ 164 | #define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26 165 | 166 | /** Get maximal gain increase in dB/second (int32) */ 167 | #define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27 168 | 169 | /** Set maximal gain decrease in dB/second (int32) */ 170 | #define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28 171 | 172 | /** Get maximal gain decrease in dB/second (int32) */ 173 | #define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29 174 | 175 | /** Set maximal gain in dB (int32) */ 176 | #define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30 177 | 178 | /** Get maximal gain in dB (int32) */ 179 | #define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31 180 | 181 | /* Can't set loudness */ 182 | /** Get loudness */ 183 | #define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33 184 | 185 | /* Can't set gain */ 186 | /** Get current gain (int32 percent) */ 187 | #define SPEEX_PREPROCESS_GET_AGC_GAIN 35 188 | 189 | /* Can't set spectrum size */ 190 | /** Get spectrum size for power spectrum (int32) */ 191 | #define SPEEX_PREPROCESS_GET_PSD_SIZE 37 192 | 193 | /* Can't set power spectrum */ 194 | /** Get power spectrum (int32[] of squared values) */ 195 | #define SPEEX_PREPROCESS_GET_PSD 39 196 | 197 | /* Can't set noise size */ 198 | /** Get spectrum size for noise estimate (int32) */ 199 | #define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41 200 | 201 | /* Can't set noise estimate */ 202 | /** Get noise estimate (int32[] of squared values) */ 203 | #define SPEEX_PREPROCESS_GET_NOISE_PSD 43 204 | 205 | /* Can't set speech probability */ 206 | /** Get speech probability in last frame (int32). */ 207 | #define SPEEX_PREPROCESS_GET_PROB 45 208 | 209 | /** Set preprocessor Automatic Gain Control level (int32) */ 210 | #define SPEEX_PREPROCESS_SET_AGC_TARGET 46 211 | /** Get preprocessor Automatic Gain Control level (int32) */ 212 | #define SPEEX_PREPROCESS_GET_AGC_TARGET 47 213 | 214 | #ifdef __cplusplus 215 | } 216 | #endif 217 | 218 | /** @}*/ 219 | #endif 220 | -------------------------------------------------------------------------------- /SpeechToText/SpeechToTextModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // VoiceAddModule.m 3 | // AstridiPhone 4 | // 5 | // Created by Sam Bosley on 10/7/11. 6 | // Copyright (c) 2011 Todoroo. All rights reserved. 7 | // 8 | 9 | #import "SpeechToTextModule.h" 10 | #import "SineWaveViewController.h" 11 | 12 | #define FRAME_SIZE 110 13 | 14 | @interface SpeechToTextModule () 15 | 16 | - (void)reset; 17 | - (void)postByteData:(NSData *)data; 18 | - (void)cleanUpProcessingThread; 19 | @end 20 | 21 | @implementation SpeechToTextModule 22 | 23 | @synthesize delegate; 24 | 25 | static void HandleInputBuffer (void *aqData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, 26 | const AudioTimeStamp *inStartTime, UInt32 inNumPackets, 27 | const AudioStreamPacketDescription *inPacketDesc) { 28 | 29 | AQRecorderState *pAqData = (AQRecorderState *) aqData; 30 | 31 | if (inNumPackets == 0 && pAqData->mDataFormat.mBytesPerPacket != 0) 32 | inNumPackets = inBuffer->mAudioDataByteSize / pAqData->mDataFormat.mBytesPerPacket; 33 | 34 | // process speex 35 | int packets_per_frame = pAqData->speex_samples_per_frame; 36 | 37 | char cbits[FRAME_SIZE + 1]; 38 | for (int i = 0; i < inNumPackets; i+= packets_per_frame) { 39 | speex_bits_reset(&(pAqData->speex_bits)); 40 | 41 | speex_encode_int(pAqData->speex_enc_state, ((spx_int16_t*)inBuffer->mAudioData) + i, &(pAqData->speex_bits)); 42 | int nbBytes = speex_bits_write(&(pAqData->speex_bits), cbits + 1, FRAME_SIZE); 43 | cbits[0] = nbBytes; 44 | 45 | [pAqData->encodedSpeexData appendBytes:cbits length:nbBytes + 1]; 46 | } 47 | pAqData->mCurrentPacket += inNumPackets; 48 | 49 | if (!pAqData->mIsRunning) 50 | return; 51 | 52 | AudioQueueEnqueueBuffer(pAqData->mQueue, inBuffer, 0, NULL); 53 | } 54 | 55 | static void DeriveBufferSize (AudioQueueRef audioQueue, AudioStreamBasicDescription *ASBDescription, Float64 seconds, UInt32 *outBufferSize) { 56 | static const int maxBufferSize = 0x50000; 57 | 58 | int maxPacketSize = ASBDescription->mBytesPerPacket; 59 | if (maxPacketSize == 0) { 60 | UInt32 maxVBRPacketSize = sizeof(maxPacketSize); 61 | AudioQueueGetProperty (audioQueue, kAudioQueueProperty_MaximumOutputPacketSize, &maxPacketSize, &maxVBRPacketSize); 62 | } 63 | 64 | Float64 numBytesForTime = ASBDescription->mSampleRate * maxPacketSize * seconds; 65 | *outBufferSize = (UInt32)(numBytesForTime < maxBufferSize ? numBytesForTime : maxBufferSize); 66 | } 67 | 68 | - (id)init { 69 | if ((self = [self initWithCustomDisplay:nil])) { 70 | // 71 | } 72 | return self; 73 | } 74 | 75 | - (id)initWithCustomDisplay:(NSString *)nibName { 76 | if ((self = [super init])) { 77 | aqData.mDataFormat.mFormatID = kAudioFormatLinearPCM; 78 | aqData.mDataFormat.mSampleRate = 16000.0; 79 | aqData.mDataFormat.mChannelsPerFrame = 1; 80 | aqData.mDataFormat.mBitsPerChannel = 16; 81 | aqData.mDataFormat.mBytesPerPacket = 82 | aqData.mDataFormat.mBytesPerFrame = 83 | aqData.mDataFormat.mChannelsPerFrame * sizeof (SInt16); 84 | aqData.mDataFormat.mFramesPerPacket = 1; 85 | 86 | aqData.mDataFormat.mFormatFlags = 87 | kLinearPCMFormatFlagIsSignedInteger 88 | | kLinearPCMFormatFlagIsPacked; 89 | 90 | memset(&(aqData.speex_bits), 0, sizeof(SpeexBits)); 91 | speex_bits_init(&(aqData.speex_bits)); 92 | aqData.speex_enc_state = speex_encoder_init(&speex_wb_mode); 93 | 94 | int quality = 8; 95 | speex_encoder_ctl(aqData.speex_enc_state, SPEEX_SET_QUALITY, &quality); 96 | int vbr = 1; 97 | speex_encoder_ctl(aqData.speex_enc_state, SPEEX_SET_VBR, &vbr); 98 | speex_encoder_ctl(aqData.speex_enc_state, SPEEX_GET_FRAME_SIZE, &(aqData.speex_samples_per_frame)); 99 | aqData.mQueue = NULL; 100 | 101 | if (nibName) { 102 | sineWave = [[SineWaveViewController alloc] initWithNibName:nibName bundle:nil]; 103 | sineWave.delegate = self; 104 | } 105 | 106 | [self reset]; 107 | aqData.selfRef = self; 108 | } 109 | return self; 110 | } 111 | 112 | - (void)dealloc { 113 | [processingThread cancel]; 114 | if (processing) { 115 | [self cleanUpProcessingThread]; 116 | } 117 | 118 | self.delegate = nil; 119 | status.delegate = nil; 120 | [status release]; 121 | sineWave.delegate = nil; 122 | [sineWave release]; 123 | speex_bits_destroy(&(aqData.speex_bits)); 124 | speex_encoder_destroy(aqData.speex_enc_state); 125 | [aqData.encodedSpeexData release]; 126 | AudioQueueDispose(aqData.mQueue, true); 127 | [volumeDataPoints release]; 128 | 129 | [super dealloc]; 130 | } 131 | 132 | - (BOOL)recording { 133 | return aqData.mIsRunning; 134 | } 135 | 136 | - (void)reset { 137 | if (aqData.mQueue != NULL) 138 | AudioQueueDispose(aqData.mQueue, true); 139 | 140 | AudioSessionInitialize(NULL, NULL, nil, (void *)(self)); 141 | UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord; 142 | AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory); 143 | AudioSessionSetActive(true); 144 | 145 | UInt32 enableLevelMetering = 1; 146 | AudioQueueNewInput(&(aqData.mDataFormat), HandleInputBuffer, &aqData, NULL, kCFRunLoopCommonModes, 0, &(aqData.mQueue)); 147 | AudioQueueSetProperty(aqData.mQueue, kAudioQueueProperty_EnableLevelMetering, &enableLevelMetering, sizeof(UInt32)); 148 | DeriveBufferSize(aqData.mQueue, &(aqData.mDataFormat), 0.5, &(aqData.bufferByteSize)); 149 | 150 | for (int i = 0; i < kNumberBuffers; i++) { 151 | AudioQueueAllocateBuffer(aqData.mQueue, aqData.bufferByteSize, &(aqData.mBuffers[i])); 152 | AudioQueueEnqueueBuffer(aqData.mQueue, aqData.mBuffers[i], 0, NULL); 153 | } 154 | 155 | [aqData.encodedSpeexData release]; 156 | aqData.encodedSpeexData = [[NSMutableData alloc] init]; 157 | 158 | [meterTimer invalidate]; 159 | [meterTimer release]; 160 | samplesBelowSilence = 0; 161 | detectedSpeech = NO; 162 | 163 | [volumeDataPoints release]; 164 | volumeDataPoints = [[NSMutableArray alloc] initWithCapacity:kNumVolumeSamples]; 165 | for (int i = 0; i < kNumVolumeSamples; i++) { 166 | [volumeDataPoints addObject:[NSNumber numberWithFloat:kMinVolumeSampleValue]]; 167 | } 168 | sineWave.dataPoints = volumeDataPoints; 169 | } 170 | 171 | - (void)beginRecording { 172 | @synchronized(self) { 173 | if (!self.recording && !processing) { 174 | aqData.mCurrentPacket = 0; 175 | aqData.mIsRunning = true; 176 | [self reset]; 177 | AudioQueueStart(aqData.mQueue, NULL); 178 | if (sineWave && [delegate respondsToSelector:@selector(showSineWaveView:)]) { 179 | [delegate showSineWaveView:sineWave]; 180 | } else { 181 | status = [[UIAlertView alloc] initWithTitle:@"Speak now!" message:@"" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil]; 182 | [status show]; 183 | } 184 | meterTimer = [[NSTimer scheduledTimerWithTimeInterval:kVolumeSamplingInterval target:self selector:@selector(checkMeter) userInfo:nil repeats:YES] retain]; 185 | } 186 | } 187 | } 188 | 189 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { 190 | if (self.recording && buttonIndex == 0) { 191 | [self stopRecording:YES]; 192 | } 193 | } 194 | 195 | - (void)sineWaveDoneAction { 196 | if (self.recording) 197 | [self stopRecording:YES]; 198 | else if ([delegate respondsToSelector:@selector(dismissSineWaveView:cancelled:)]) { 199 | [delegate dismissSineWaveView:sineWave cancelled:NO]; 200 | } 201 | } 202 | 203 | - (void)cleanUpProcessingThread { 204 | @synchronized(self) { 205 | [processingThread release]; 206 | processingThread = nil; 207 | processing = NO; 208 | } 209 | } 210 | 211 | - (void)sineWaveCancelAction { 212 | if (self.recording) { 213 | [self stopRecording:NO]; 214 | } else { 215 | if (processing) { 216 | [processingThread cancel]; 217 | processing = NO; 218 | } 219 | if ([delegate respondsToSelector:@selector(dismissSineWaveView:cancelled:)]) { 220 | [delegate dismissSineWaveView:sineWave cancelled:YES]; 221 | } 222 | } 223 | } 224 | 225 | - (void)stopRecording:(BOOL)startProcessing { 226 | @synchronized(self) { 227 | if (self.recording) { 228 | [status dismissWithClickedButtonIndex:-1 animated:YES]; 229 | [status release]; 230 | status = nil; 231 | 232 | if ([delegate respondsToSelector:@selector(dismissSineWaveView:cancelled:)]) 233 | [delegate dismissSineWaveView:sineWave cancelled:!startProcessing]; 234 | 235 | AudioQueueStop(aqData.mQueue, true); 236 | aqData.mIsRunning = false; 237 | [meterTimer invalidate]; 238 | [meterTimer release]; 239 | meterTimer = nil; 240 | if (startProcessing) { 241 | [self cleanUpProcessingThread]; 242 | processing = YES; 243 | processingThread = [[NSThread alloc] initWithTarget:self selector:@selector(postByteData:) object:aqData.encodedSpeexData]; 244 | [processingThread start]; 245 | if ([delegate respondsToSelector:@selector(showLoadingView)]) 246 | [delegate showLoadingView]; 247 | } 248 | } 249 | } 250 | } 251 | 252 | - (void)checkMeter { 253 | AudioQueueLevelMeterState meterState; 254 | AudioQueueLevelMeterState meterStateDB; 255 | UInt32 ioDataSize = sizeof(AudioQueueLevelMeterState); 256 | AudioQueueGetProperty(aqData.mQueue, kAudioQueueProperty_CurrentLevelMeter, &meterState, &ioDataSize); 257 | AudioQueueGetProperty(aqData.mQueue, kAudioQueueProperty_CurrentLevelMeterDB, &meterStateDB, &ioDataSize); 258 | 259 | [volumeDataPoints removeObjectAtIndex:0]; 260 | float dataPoint; 261 | if (meterStateDB.mAveragePower > kSilenceThresholdDB) { 262 | detectedSpeech = YES; 263 | dataPoint = MIN(kMaxVolumeSampleValue, meterState.mPeakPower); 264 | } else { 265 | dataPoint = MAX(kMinVolumeSampleValue, meterState.mPeakPower); 266 | } 267 | [volumeDataPoints addObject:[NSNumber numberWithFloat:dataPoint]]; 268 | 269 | [sineWave updateWaveDisplay]; 270 | 271 | if (detectedSpeech) { 272 | if (meterStateDB.mAveragePower < kSilenceThresholdDB) { 273 | samplesBelowSilence++; 274 | if (samplesBelowSilence > kSilenceThresholdNumSamples) 275 | [self stopRecording:YES]; 276 | } else { 277 | samplesBelowSilence = 0; 278 | } 279 | } 280 | } 281 | 282 | - (void)postByteData:(NSData *)byteData { 283 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 284 | 285 | NSString *urlString = [NSString stringWithFormat:@"https://www.google.com/speech-api/v2/recognize?xjerr=1&client=chromium&lang=en-US&key=%@",GOOGLE_SPEECH_TO_TEXT_KEY]; 286 | 287 | NSURL *url = [NSURL URLWithString:urlString]; 288 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; 289 | [request setHTTPMethod:@"POST"]; 290 | [request setHTTPBody:byteData]; 291 | [request addValue:@"audio/x-speex-with-header-byte; rate=16000" forHTTPHeaderField:@"Content-Type"]; 292 | [request setURL:url]; 293 | [request setTimeoutInterval:15]; 294 | NSURLResponse *response; 295 | NSError *error = nil; 296 | if ([processingThread isCancelled]) { 297 | [self cleanUpProcessingThread]; 298 | [request release]; 299 | [pool drain]; 300 | return; 301 | } 302 | NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 303 | [request release]; 304 | 305 | if(error) 306 | [self requestFailed:error]; 307 | 308 | if ([processingThread isCancelled]) { 309 | [self cleanUpProcessingThread]; 310 | [pool drain]; 311 | return; 312 | } 313 | 314 | [self performSelectorOnMainThread:@selector(gotResponse:) withObject:data waitUntilDone:NO]; 315 | 316 | [pool drain]; 317 | } 318 | 319 | - (void)gotResponse:(NSData *)jsonData { 320 | [self cleanUpProcessingThread]; 321 | [delegate didReceiveVoiceResponse:jsonData]; 322 | } 323 | 324 | - (void)requestFailed:(NSError *)error 325 | { 326 | if([delegate respondsToSelector:@selector(requestFailedWithError:)]) 327 | [delegate requestFailedWithError:error]; 328 | } 329 | @end 330 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002-2006 Jean-Marc Valin*/ 2 | /** 3 | @file speex.h 4 | @brief Describes the different modes of the codec 5 | */ 6 | /* 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | */ 35 | 36 | #ifndef SPEEX_H 37 | #define SPEEX_H 38 | /** @defgroup Codec Speex encoder and decoder 39 | * This is the Speex codec itself. 40 | * @{ 41 | */ 42 | 43 | #include "speex/speex_bits.h" 44 | #include "speex/speex_types.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /* Values allowed for *ctl() requests */ 51 | 52 | /** Set enhancement on/off (decoder only) */ 53 | #define SPEEX_SET_ENH 0 54 | /** Get enhancement state (decoder only) */ 55 | #define SPEEX_GET_ENH 1 56 | 57 | /*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/ 58 | /** Obtain frame size used by encoder/decoder */ 59 | #define SPEEX_GET_FRAME_SIZE 3 60 | 61 | /** Set quality value */ 62 | #define SPEEX_SET_QUALITY 4 63 | /** Get current quality setting */ 64 | /* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */ 65 | 66 | /** Set sub-mode to use */ 67 | #define SPEEX_SET_MODE 6 68 | /** Get current sub-mode in use */ 69 | #define SPEEX_GET_MODE 7 70 | 71 | /** Set low-band sub-mode to use (wideband only)*/ 72 | #define SPEEX_SET_LOW_MODE 8 73 | /** Get current low-band mode in use (wideband only)*/ 74 | #define SPEEX_GET_LOW_MODE 9 75 | 76 | /** Set high-band sub-mode to use (wideband only)*/ 77 | #define SPEEX_SET_HIGH_MODE 10 78 | /** Get current high-band mode in use (wideband only)*/ 79 | #define SPEEX_GET_HIGH_MODE 11 80 | 81 | /** Set VBR on (1) or off (0) */ 82 | #define SPEEX_SET_VBR 12 83 | /** Get VBR status (1 for on, 0 for off) */ 84 | #define SPEEX_GET_VBR 13 85 | 86 | /** Set quality value for VBR encoding (0-10) */ 87 | #define SPEEX_SET_VBR_QUALITY 14 88 | /** Get current quality value for VBR encoding (0-10) */ 89 | #define SPEEX_GET_VBR_QUALITY 15 90 | 91 | /** Set complexity of the encoder (0-10) */ 92 | #define SPEEX_SET_COMPLEXITY 16 93 | /** Get current complexity of the encoder (0-10) */ 94 | #define SPEEX_GET_COMPLEXITY 17 95 | 96 | /** Set bit-rate used by the encoder (or lower) */ 97 | #define SPEEX_SET_BITRATE 18 98 | /** Get current bit-rate used by the encoder or decoder */ 99 | #define SPEEX_GET_BITRATE 19 100 | 101 | /** Define a handler function for in-band Speex request*/ 102 | #define SPEEX_SET_HANDLER 20 103 | 104 | /** Define a handler function for in-band user-defined request*/ 105 | #define SPEEX_SET_USER_HANDLER 22 106 | 107 | /** Set sampling rate used in bit-rate computation */ 108 | #define SPEEX_SET_SAMPLING_RATE 24 109 | /** Get sampling rate used in bit-rate computation */ 110 | #define SPEEX_GET_SAMPLING_RATE 25 111 | 112 | /** Reset the encoder/decoder memories to zero*/ 113 | #define SPEEX_RESET_STATE 26 114 | 115 | /** Get VBR info (mostly used internally) */ 116 | #define SPEEX_GET_RELATIVE_QUALITY 29 117 | 118 | /** Set VAD status (1 for on, 0 for off) */ 119 | #define SPEEX_SET_VAD 30 120 | 121 | /** Get VAD status (1 for on, 0 for off) */ 122 | #define SPEEX_GET_VAD 31 123 | 124 | /** Set Average Bit-Rate (ABR) to n bits per seconds */ 125 | #define SPEEX_SET_ABR 32 126 | /** Get Average Bit-Rate (ABR) setting (in bps) */ 127 | #define SPEEX_GET_ABR 33 128 | 129 | /** Set DTX status (1 for on, 0 for off) */ 130 | #define SPEEX_SET_DTX 34 131 | /** Get DTX status (1 for on, 0 for off) */ 132 | #define SPEEX_GET_DTX 35 133 | 134 | /** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */ 135 | #define SPEEX_SET_SUBMODE_ENCODING 36 136 | /** Get submode encoding in each frame */ 137 | #define SPEEX_GET_SUBMODE_ENCODING 37 138 | 139 | /*#define SPEEX_SET_LOOKAHEAD 38*/ 140 | /** Returns the lookahead used by Speex */ 141 | #define SPEEX_GET_LOOKAHEAD 39 142 | 143 | /** Sets tuning for packet-loss concealment (expected loss rate) */ 144 | #define SPEEX_SET_PLC_TUNING 40 145 | /** Gets tuning for PLC */ 146 | #define SPEEX_GET_PLC_TUNING 41 147 | 148 | /** Sets the max bit-rate allowed in VBR mode */ 149 | #define SPEEX_SET_VBR_MAX_BITRATE 42 150 | /** Gets the max bit-rate allowed in VBR mode */ 151 | #define SPEEX_GET_VBR_MAX_BITRATE 43 152 | 153 | /** Turn on/off input/output high-pass filtering */ 154 | #define SPEEX_SET_HIGHPASS 44 155 | /** Get status of input/output high-pass filtering */ 156 | #define SPEEX_GET_HIGHPASS 45 157 | 158 | /** Get "activity level" of the last decoded frame, i.e. 159 | how much damage we cause if we remove the frame */ 160 | #define SPEEX_GET_ACTIVITY 47 161 | 162 | 163 | /* Preserving compatibility:*/ 164 | /** Equivalent to SPEEX_SET_ENH */ 165 | #define SPEEX_SET_PF 0 166 | /** Equivalent to SPEEX_GET_ENH */ 167 | #define SPEEX_GET_PF 1 168 | 169 | 170 | 171 | 172 | /* Values allowed for mode queries */ 173 | /** Query the frame size of a mode */ 174 | #define SPEEX_MODE_FRAME_SIZE 0 175 | 176 | /** Query the size of an encoded frame for a particular sub-mode */ 177 | #define SPEEX_SUBMODE_BITS_PER_FRAME 1 178 | 179 | 180 | 181 | /** Get major Speex version */ 182 | #define SPEEX_LIB_GET_MAJOR_VERSION 1 183 | /** Get minor Speex version */ 184 | #define SPEEX_LIB_GET_MINOR_VERSION 3 185 | /** Get micro Speex version */ 186 | #define SPEEX_LIB_GET_MICRO_VERSION 5 187 | /** Get extra Speex version */ 188 | #define SPEEX_LIB_GET_EXTRA_VERSION 7 189 | /** Get Speex version string */ 190 | #define SPEEX_LIB_GET_VERSION_STRING 9 191 | 192 | /*#define SPEEX_LIB_SET_ALLOC_FUNC 10 193 | #define SPEEX_LIB_GET_ALLOC_FUNC 11 194 | #define SPEEX_LIB_SET_FREE_FUNC 12 195 | #define SPEEX_LIB_GET_FREE_FUNC 13 196 | 197 | #define SPEEX_LIB_SET_WARNING_FUNC 14 198 | #define SPEEX_LIB_GET_WARNING_FUNC 15 199 | #define SPEEX_LIB_SET_ERROR_FUNC 16 200 | #define SPEEX_LIB_GET_ERROR_FUNC 17 201 | */ 202 | 203 | /** Number of defined modes in Speex */ 204 | #define SPEEX_NB_MODES 3 205 | 206 | /** modeID for the defined narrowband mode */ 207 | #define SPEEX_MODEID_NB 0 208 | 209 | /** modeID for the defined wideband mode */ 210 | #define SPEEX_MODEID_WB 1 211 | 212 | /** modeID for the defined ultra-wideband mode */ 213 | #define SPEEX_MODEID_UWB 2 214 | 215 | struct SpeexMode; 216 | 217 | 218 | /* Prototypes for mode function pointers */ 219 | 220 | /** Encoder state initialization function */ 221 | typedef void *(*encoder_init_func)(const struct SpeexMode *mode); 222 | 223 | /** Encoder state destruction function */ 224 | typedef void (*encoder_destroy_func)(void *st); 225 | 226 | /** Main encoding function */ 227 | typedef int (*encode_func)(void *state, void *in, SpeexBits *bits); 228 | 229 | /** Function for controlling the encoder options */ 230 | typedef int (*encoder_ctl_func)(void *state, int request, void *ptr); 231 | 232 | /** Decoder state initialization function */ 233 | typedef void *(*decoder_init_func)(const struct SpeexMode *mode); 234 | 235 | /** Decoder state destruction function */ 236 | typedef void (*decoder_destroy_func)(void *st); 237 | 238 | /** Main decoding function */ 239 | typedef int (*decode_func)(void *state, SpeexBits *bits, void *out); 240 | 241 | /** Function for controlling the decoder options */ 242 | typedef int (*decoder_ctl_func)(void *state, int request, void *ptr); 243 | 244 | 245 | /** Query function for a mode */ 246 | typedef int (*mode_query_func)(const void *mode, int request, void *ptr); 247 | 248 | /** Struct defining a Speex mode */ 249 | typedef struct SpeexMode { 250 | /** Pointer to the low-level mode data */ 251 | const void *mode; 252 | 253 | /** Pointer to the mode query function */ 254 | mode_query_func query; 255 | 256 | /** The name of the mode (you should not rely on this to identify the mode)*/ 257 | const char *modeName; 258 | 259 | /**ID of the mode*/ 260 | int modeID; 261 | 262 | /**Version number of the bitstream (incremented every time we break 263 | bitstream compatibility*/ 264 | int bitstream_version; 265 | 266 | /** Pointer to encoder initialization function */ 267 | encoder_init_func enc_init; 268 | 269 | /** Pointer to encoder destruction function */ 270 | encoder_destroy_func enc_destroy; 271 | 272 | /** Pointer to frame encoding function */ 273 | encode_func enc; 274 | 275 | /** Pointer to decoder initialization function */ 276 | decoder_init_func dec_init; 277 | 278 | /** Pointer to decoder destruction function */ 279 | decoder_destroy_func dec_destroy; 280 | 281 | /** Pointer to frame decoding function */ 282 | decode_func dec; 283 | 284 | /** ioctl-like requests for encoder */ 285 | encoder_ctl_func enc_ctl; 286 | 287 | /** ioctl-like requests for decoder */ 288 | decoder_ctl_func dec_ctl; 289 | 290 | } SpeexMode; 291 | 292 | /** 293 | * Returns a handle to a newly created Speex encoder state structure. For now, 294 | * the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes 295 | * may be added. Note that for now if you have more than one channels to 296 | * encode, you need one state per channel. 297 | * 298 | * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) 299 | * @return A newly created encoder state or NULL if state allocation fails 300 | */ 301 | void *speex_encoder_init(const SpeexMode *mode); 302 | 303 | /** Frees all resources associated to an existing Speex encoder state. 304 | * @param state Encoder state to be destroyed */ 305 | void speex_encoder_destroy(void *state); 306 | 307 | /** Uses an existing encoder state to encode one frame of speech pointed to by 308 | "in". The encoded bit-stream is saved in "bits". 309 | @param state Encoder state 310 | @param in Frame that will be encoded with a +-2^15 range. This data MAY be 311 | overwritten by the encoder and should be considered uninitialised 312 | after the call. 313 | @param bits Bit-stream where the data will be written 314 | @return 0 if frame needs not be transmitted (DTX only), 1 otherwise 315 | */ 316 | int speex_encode(void *state, float *in, SpeexBits *bits); 317 | 318 | /** Uses an existing encoder state to encode one frame of speech pointed to by 319 | "in". The encoded bit-stream is saved in "bits". 320 | @param state Encoder state 321 | @param in Frame that will be encoded with a +-2^15 range 322 | @param bits Bit-stream where the data will be written 323 | @return 0 if frame needs not be transmitted (DTX only), 1 otherwise 324 | */ 325 | int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits); 326 | 327 | /** Used like the ioctl function to control the encoder parameters 328 | * 329 | * @param state Encoder state 330 | * @param request ioctl-type request (one of the SPEEX_* macros) 331 | * @param ptr Data exchanged to-from function 332 | * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter 333 | */ 334 | int speex_encoder_ctl(void *state, int request, void *ptr); 335 | 336 | 337 | /** Returns a handle to a newly created decoder state structure. For now, 338 | * the mode argument can be &nb_mode or &wb_mode . In the future, more modes 339 | * may be added. Note that for now if you have more than one channels to 340 | * decode, you need one state per channel. 341 | * 342 | * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode) 343 | * @return A newly created decoder state or NULL if state allocation fails 344 | */ 345 | void *speex_decoder_init(const SpeexMode *mode); 346 | 347 | /** Frees all resources associated to an existing decoder state. 348 | * 349 | * @param state State to be destroyed 350 | */ 351 | void speex_decoder_destroy(void *state); 352 | 353 | /** Uses an existing decoder state to decode one frame of speech from 354 | * bit-stream bits. The output speech is saved written to out. 355 | * 356 | * @param state Decoder state 357 | * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost) 358 | * @param out Where to write the decoded frame 359 | * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream) 360 | */ 361 | int speex_decode(void *state, SpeexBits *bits, float *out); 362 | 363 | /** Uses an existing decoder state to decode one frame of speech from 364 | * bit-stream bits. The output speech is saved written to out. 365 | * 366 | * @param state Decoder state 367 | * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost) 368 | * @param out Where to write the decoded frame 369 | * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream) 370 | */ 371 | int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out); 372 | 373 | /** Used like the ioctl function to control the encoder parameters 374 | * 375 | * @param state Decoder state 376 | * @param request ioctl-type request (one of the SPEEX_* macros) 377 | * @param ptr Data exchanged to-from function 378 | * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter 379 | */ 380 | int speex_decoder_ctl(void *state, int request, void *ptr); 381 | 382 | 383 | /** Query function for mode information 384 | * 385 | * @param mode Speex mode 386 | * @param request ioctl-type request (one of the SPEEX_* macros) 387 | * @param ptr Data exchanged to-from function 388 | * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter 389 | */ 390 | int speex_mode_query(const SpeexMode *mode, int request, void *ptr); 391 | 392 | /** Functions for controlling the behavior of libspeex 393 | * @param request ioctl-type request (one of the SPEEX_LIB_* macros) 394 | * @param ptr Data exchanged to-from function 395 | * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter 396 | */ 397 | int speex_lib_ctl(int request, void *ptr); 398 | 399 | /** Default narrowband mode */ 400 | extern const SpeexMode speex_nb_mode; 401 | 402 | /** Default wideband mode */ 403 | extern const SpeexMode speex_wb_mode; 404 | 405 | /** Default "ultra-wideband" mode */ 406 | extern const SpeexMode speex_uwb_mode; 407 | 408 | /** List of all modes available */ 409 | extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES]; 410 | 411 | /** Obtain one of the modes available */ 412 | const SpeexMode * speex_lib_get_mode (int mode); 413 | 414 | #ifndef WIN32 415 | /* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */ 416 | #define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode)) 417 | #endif 418 | 419 | #ifdef __cplusplus 420 | } 421 | #endif 422 | 423 | /** @}*/ 424 | #endif 425 | -------------------------------------------------------------------------------- /SpeechToText/Speex.framework/Headers/speex_resampler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007 Jean-Marc Valin 2 | 3 | File: speex_resampler.h 4 | Resampling code 5 | 6 | The design goals of this code are: 7 | - Very fast algorithm 8 | - Low memory requirement 9 | - Good *perceptual* quality (and not best SNR) 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are 13 | met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | 2. Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | 3. The name of the author may not be used to endorse or promote products 23 | derived from this software without specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 34 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | 38 | 39 | #ifndef SPEEX_RESAMPLER_H 40 | #define SPEEX_RESAMPLER_H 41 | 42 | #ifdef OUTSIDE_SPEEX 43 | 44 | /********* WARNING: MENTAL SANITY ENDS HERE *************/ 45 | 46 | /* If the resampler is defined outside of Speex, we change the symbol names so that 47 | there won't be any clash if linking with Speex later on. */ 48 | 49 | /* #define RANDOM_PREFIX your software name here */ 50 | #ifndef RANDOM_PREFIX 51 | #error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes" 52 | #endif 53 | 54 | #define CAT_PREFIX2(a,b) a ## b 55 | #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b) 56 | 57 | #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init) 58 | #define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac) 59 | #define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy) 60 | #define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float) 61 | #define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int) 62 | #define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float) 63 | #define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int) 64 | #define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate) 65 | #define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate) 66 | #define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac) 67 | #define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio) 68 | #define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality) 69 | #define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality) 70 | #define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride) 71 | #define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride) 72 | #define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride) 73 | #define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride) 74 | #define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency) 75 | #define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency) 76 | #define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros) 77 | #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem) 78 | #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror) 79 | 80 | #define spx_int16_t short 81 | #define spx_int32_t int 82 | #define spx_uint16_t unsigned short 83 | #define spx_uint32_t unsigned int 84 | 85 | #else /* OUTSIDE_SPEEX */ 86 | 87 | #include "speex/speex_types.h" 88 | 89 | #endif /* OUTSIDE_SPEEX */ 90 | 91 | #ifdef __cplusplus 92 | extern "C" { 93 | #endif 94 | 95 | #define SPEEX_RESAMPLER_QUALITY_MAX 10 96 | #define SPEEX_RESAMPLER_QUALITY_MIN 0 97 | #define SPEEX_RESAMPLER_QUALITY_DEFAULT 4 98 | #define SPEEX_RESAMPLER_QUALITY_VOIP 3 99 | #define SPEEX_RESAMPLER_QUALITY_DESKTOP 5 100 | 101 | enum { 102 | RESAMPLER_ERR_SUCCESS = 0, 103 | RESAMPLER_ERR_ALLOC_FAILED = 1, 104 | RESAMPLER_ERR_BAD_STATE = 2, 105 | RESAMPLER_ERR_INVALID_ARG = 3, 106 | RESAMPLER_ERR_PTR_OVERLAP = 4, 107 | 108 | RESAMPLER_ERR_MAX_ERROR 109 | }; 110 | 111 | struct SpeexResamplerState_; 112 | typedef struct SpeexResamplerState_ SpeexResamplerState; 113 | 114 | /** Create a new resampler with integer input and output rates. 115 | * @param nb_channels Number of channels to be processed 116 | * @param in_rate Input sampling rate (integer number of Hz). 117 | * @param out_rate Output sampling rate (integer number of Hz). 118 | * @param quality Resampling quality between 0 and 10, where 0 has poor quality 119 | * and 10 has very high quality. 120 | * @return Newly created resampler state 121 | * @retval NULL Error: not enough memory 122 | */ 123 | SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, 124 | spx_uint32_t in_rate, 125 | spx_uint32_t out_rate, 126 | int quality, 127 | int *err); 128 | 129 | /** Create a new resampler with fractional input/output rates. The sampling 130 | * rate ratio is an arbitrary rational number with both the numerator and 131 | * denominator being 32-bit integers. 132 | * @param nb_channels Number of channels to be processed 133 | * @param ratio_num Numerator of the sampling rate ratio 134 | * @param ratio_den Denominator of the sampling rate ratio 135 | * @param in_rate Input sampling rate rounded to the nearest integer (in Hz). 136 | * @param out_rate Output sampling rate rounded to the nearest integer (in Hz). 137 | * @param quality Resampling quality between 0 and 10, where 0 has poor quality 138 | * and 10 has very high quality. 139 | * @return Newly created resampler state 140 | * @retval NULL Error: not enough memory 141 | */ 142 | SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, 143 | spx_uint32_t ratio_num, 144 | spx_uint32_t ratio_den, 145 | spx_uint32_t in_rate, 146 | spx_uint32_t out_rate, 147 | int quality, 148 | int *err); 149 | 150 | /** Destroy a resampler state. 151 | * @param st Resampler state 152 | */ 153 | void speex_resampler_destroy(SpeexResamplerState *st); 154 | 155 | /** Resample a float array. The input and output buffers must *not* overlap. 156 | * @param st Resampler state 157 | * @param channel_index Index of the channel to process for the multi-channel 158 | * base (0 otherwise) 159 | * @param in Input buffer 160 | * @param in_len Number of input samples in the input buffer. Returns the 161 | * number of samples processed 162 | * @param out Output buffer 163 | * @param out_len Size of the output buffer. Returns the number of samples written 164 | */ 165 | int speex_resampler_process_float(SpeexResamplerState *st, 166 | spx_uint32_t channel_index, 167 | const float *in, 168 | spx_uint32_t *in_len, 169 | float *out, 170 | spx_uint32_t *out_len); 171 | 172 | /** Resample an int array. The input and output buffers must *not* overlap. 173 | * @param st Resampler state 174 | * @param channel_index Index of the channel to process for the multi-channel 175 | * base (0 otherwise) 176 | * @param in Input buffer 177 | * @param in_len Number of input samples in the input buffer. Returns the number 178 | * of samples processed 179 | * @param out Output buffer 180 | * @param out_len Size of the output buffer. Returns the number of samples written 181 | */ 182 | int speex_resampler_process_int(SpeexResamplerState *st, 183 | spx_uint32_t channel_index, 184 | const spx_int16_t *in, 185 | spx_uint32_t *in_len, 186 | spx_int16_t *out, 187 | spx_uint32_t *out_len); 188 | 189 | /** Resample an interleaved float array. The input and output buffers must *not* overlap. 190 | * @param st Resampler state 191 | * @param in Input buffer 192 | * @param in_len Number of input samples in the input buffer. Returns the number 193 | * of samples processed. This is all per-channel. 194 | * @param out Output buffer 195 | * @param out_len Size of the output buffer. Returns the number of samples written. 196 | * This is all per-channel. 197 | */ 198 | int speex_resampler_process_interleaved_float(SpeexResamplerState *st, 199 | const float *in, 200 | spx_uint32_t *in_len, 201 | float *out, 202 | spx_uint32_t *out_len); 203 | 204 | /** Resample an interleaved int array. The input and output buffers must *not* overlap. 205 | * @param st Resampler state 206 | * @param in Input buffer 207 | * @param in_len Number of input samples in the input buffer. Returns the number 208 | * of samples processed. This is all per-channel. 209 | * @param out Output buffer 210 | * @param out_len Size of the output buffer. Returns the number of samples written. 211 | * This is all per-channel. 212 | */ 213 | int speex_resampler_process_interleaved_int(SpeexResamplerState *st, 214 | const spx_int16_t *in, 215 | spx_uint32_t *in_len, 216 | spx_int16_t *out, 217 | spx_uint32_t *out_len); 218 | 219 | /** Set (change) the input/output sampling rates (integer value). 220 | * @param st Resampler state 221 | * @param in_rate Input sampling rate (integer number of Hz). 222 | * @param out_rate Output sampling rate (integer number of Hz). 223 | */ 224 | int speex_resampler_set_rate(SpeexResamplerState *st, 225 | spx_uint32_t in_rate, 226 | spx_uint32_t out_rate); 227 | 228 | /** Get the current input/output sampling rates (integer value). 229 | * @param st Resampler state 230 | * @param in_rate Input sampling rate (integer number of Hz) copied. 231 | * @param out_rate Output sampling rate (integer number of Hz) copied. 232 | */ 233 | void speex_resampler_get_rate(SpeexResamplerState *st, 234 | spx_uint32_t *in_rate, 235 | spx_uint32_t *out_rate); 236 | 237 | /** Set (change) the input/output sampling rates and resampling ratio 238 | * (fractional values in Hz supported). 239 | * @param st Resampler state 240 | * @param ratio_num Numerator of the sampling rate ratio 241 | * @param ratio_den Denominator of the sampling rate ratio 242 | * @param in_rate Input sampling rate rounded to the nearest integer (in Hz). 243 | * @param out_rate Output sampling rate rounded to the nearest integer (in Hz). 244 | */ 245 | int speex_resampler_set_rate_frac(SpeexResamplerState *st, 246 | spx_uint32_t ratio_num, 247 | spx_uint32_t ratio_den, 248 | spx_uint32_t in_rate, 249 | spx_uint32_t out_rate); 250 | 251 | /** Get the current resampling ratio. This will be reduced to the least 252 | * common denominator. 253 | * @param st Resampler state 254 | * @param ratio_num Numerator of the sampling rate ratio copied 255 | * @param ratio_den Denominator of the sampling rate ratio copied 256 | */ 257 | void speex_resampler_get_ratio(SpeexResamplerState *st, 258 | spx_uint32_t *ratio_num, 259 | spx_uint32_t *ratio_den); 260 | 261 | /** Set (change) the conversion quality. 262 | * @param st Resampler state 263 | * @param quality Resampling quality between 0 and 10, where 0 has poor 264 | * quality and 10 has very high quality. 265 | */ 266 | int speex_resampler_set_quality(SpeexResamplerState *st, 267 | int quality); 268 | 269 | /** Get the conversion quality. 270 | * @param st Resampler state 271 | * @param quality Resampling quality between 0 and 10, where 0 has poor 272 | * quality and 10 has very high quality. 273 | */ 274 | void speex_resampler_get_quality(SpeexResamplerState *st, 275 | int *quality); 276 | 277 | /** Set (change) the input stride. 278 | * @param st Resampler state 279 | * @param stride Input stride 280 | */ 281 | void speex_resampler_set_input_stride(SpeexResamplerState *st, 282 | spx_uint32_t stride); 283 | 284 | /** Get the input stride. 285 | * @param st Resampler state 286 | * @param stride Input stride copied 287 | */ 288 | void speex_resampler_get_input_stride(SpeexResamplerState *st, 289 | spx_uint32_t *stride); 290 | 291 | /** Set (change) the output stride. 292 | * @param st Resampler state 293 | * @param stride Output stride 294 | */ 295 | void speex_resampler_set_output_stride(SpeexResamplerState *st, 296 | spx_uint32_t stride); 297 | 298 | /** Get the output stride. 299 | * @param st Resampler state copied 300 | * @param stride Output stride 301 | */ 302 | void speex_resampler_get_output_stride(SpeexResamplerState *st, 303 | spx_uint32_t *stride); 304 | 305 | /** Get the latency in input samples introduced by the resampler. 306 | * @param st Resampler state 307 | */ 308 | int speex_resampler_get_input_latency(SpeexResamplerState *st); 309 | 310 | /** Get the latency in output samples introduced by the resampler. 311 | * @param st Resampler state 312 | */ 313 | int speex_resampler_get_output_latency(SpeexResamplerState *st); 314 | 315 | /** Make sure that the first samples to go out of the resamplers don't have 316 | * leading zeros. This is only useful before starting to use a newly created 317 | * resampler. It is recommended to use that when resampling an audio file, as 318 | * it will generate a file with the same length. For real-time processing, 319 | * it is probably easier not to use this call (so that the output duration 320 | * is the same for the first frame). 321 | * @param st Resampler state 322 | */ 323 | int speex_resampler_skip_zeros(SpeexResamplerState *st); 324 | 325 | /** Reset a resampler so a new (unrelated) stream can be processed. 326 | * @param st Resampler state 327 | */ 328 | int speex_resampler_reset_mem(SpeexResamplerState *st); 329 | 330 | /** Returns the English meaning for an error code 331 | * @param err Error code 332 | * @return English string 333 | */ 334 | const char *speex_resampler_strerror(int err); 335 | 336 | #ifdef __cplusplus 337 | } 338 | #endif 339 | 340 | #endif 341 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /SpeechToTextDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8B013A51186119F4002D16EC /* bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 8B013A50186119F4002D16EC /* bg.png */; }; 11 | 8B013A5318611A50002D16EC /* mic.png in Resources */ = {isa = PBXBuildFile; fileRef = 8B013A5218611A50002D16EC /* mic.png */; }; 12 | B33E33B3185E27C5005962B9 /* SpeechToTextModule.m in Sources */ = {isa = PBXBuildFile; fileRef = B33E33AE185E27C5005962B9 /* SpeechToTextModule.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 13 | B33E33B4185E27C5005962B9 /* SineWaveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B33E33B0185E27C5005962B9 /* SineWaveViewController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 14 | B33E33B5185E27C5005962B9 /* WaveDisplay.m in Sources */ = {isa = PBXBuildFile; fileRef = B33E33B2185E27C5005962B9 /* WaveDisplay.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 15 | B33E33B7185E27E0005962B9 /* Speex.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B33E33B6185E27E0005962B9 /* Speex.framework */; }; 16 | B33E33BE185E2EE1005962B9 /* SineWaveViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B33E33BD185E2EE1005962B9 /* SineWaveViewController.xib */; }; 17 | B3FFFF49185E0B390008EC39 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF48185E0B390008EC39 /* Foundation.framework */; }; 18 | B3FFFF4B185E0B390008EC39 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF4A185E0B390008EC39 /* CoreGraphics.framework */; }; 19 | B3FFFF4D185E0B390008EC39 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF4C185E0B390008EC39 /* UIKit.framework */; }; 20 | B3FFFF53185E0B390008EC39 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B3FFFF51185E0B390008EC39 /* InfoPlist.strings */; }; 21 | B3FFFF55185E0B390008EC39 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B3FFFF54185E0B390008EC39 /* main.m */; }; 22 | B3FFFF59185E0B390008EC39 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B3FFFF58185E0B390008EC39 /* AppDelegate.m */; }; 23 | B3FFFF5C185E0B390008EC39 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B3FFFF5A185E0B390008EC39 /* Main.storyboard */; }; 24 | B3FFFF5F185E0B390008EC39 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B3FFFF5E185E0B390008EC39 /* ViewController.m */; }; 25 | B3FFFF61185E0B390008EC39 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B3FFFF60185E0B390008EC39 /* Images.xcassets */; }; 26 | B3FFFF68185E0B3A0008EC39 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF67185E0B3A0008EC39 /* XCTest.framework */; }; 27 | B3FFFF69185E0B3A0008EC39 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF48185E0B390008EC39 /* Foundation.framework */; }; 28 | B3FFFF6A185E0B3A0008EC39 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3FFFF4C185E0B390008EC39 /* UIKit.framework */; }; 29 | B3FFFF72185E0B3A0008EC39 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B3FFFF70185E0B3A0008EC39 /* InfoPlist.strings */; }; 30 | B3FFFF74185E0B3A0008EC39 /* SpeechToTextDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B3FFFF73185E0B3A0008EC39 /* SpeechToTextDemoTests.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | B3FFFF6B185E0B3A0008EC39 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = B3FFFF3D185E0B390008EC39 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = B3FFFF44185E0B390008EC39; 39 | remoteInfo = SpeechToTextDemo; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 8B013A50186119F4002D16EC /* bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bg.png; sourceTree = ""; }; 45 | 8B013A5218611A50002D16EC /* mic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mic.png; sourceTree = ""; }; 46 | B33E33AD185E27C5005962B9 /* SpeechToTextModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeechToTextModule.h; sourceTree = ""; }; 47 | B33E33AE185E27C5005962B9 /* SpeechToTextModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpeechToTextModule.m; sourceTree = ""; }; 48 | B33E33AF185E27C5005962B9 /* SineWaveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SineWaveViewController.h; sourceTree = ""; }; 49 | B33E33B0185E27C5005962B9 /* SineWaveViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SineWaveViewController.m; sourceTree = ""; }; 50 | B33E33B1185E27C5005962B9 /* WaveDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveDisplay.h; sourceTree = ""; }; 51 | B33E33B2185E27C5005962B9 /* WaveDisplay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WaveDisplay.m; sourceTree = ""; }; 52 | B33E33B6185E27E0005962B9 /* Speex.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Speex.framework; sourceTree = ""; }; 53 | B33E33BD185E2EE1005962B9 /* SineWaveViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SineWaveViewController.xib; sourceTree = ""; }; 54 | B3FFFF45185E0B390008EC39 /* SpeechToTextDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpeechToTextDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | B3FFFF48185E0B390008EC39 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 56 | B3FFFF4A185E0B390008EC39 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 57 | B3FFFF4C185E0B390008EC39 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 58 | B3FFFF50185E0B390008EC39 /* SpeechToTextDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SpeechToTextDemo-Info.plist"; sourceTree = ""; }; 59 | B3FFFF52185E0B390008EC39 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 60 | B3FFFF54185E0B390008EC39 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 61 | B3FFFF56185E0B390008EC39 /* SpeechToTextDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SpeechToTextDemo-Prefix.pch"; sourceTree = ""; }; 62 | B3FFFF57185E0B390008EC39 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 63 | B3FFFF58185E0B390008EC39 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 64 | B3FFFF5B185E0B390008EC39 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 65 | B3FFFF5D185E0B390008EC39 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 66 | B3FFFF5E185E0B390008EC39 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 67 | B3FFFF60185E0B390008EC39 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 68 | B3FFFF66185E0B3A0008EC39 /* SpeechToTextDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SpeechToTextDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 69 | B3FFFF67185E0B3A0008EC39 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 70 | B3FFFF6F185E0B3A0008EC39 /* SpeechToTextDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SpeechToTextDemoTests-Info.plist"; sourceTree = ""; }; 71 | B3FFFF71185E0B3A0008EC39 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 72 | B3FFFF73185E0B3A0008EC39 /* SpeechToTextDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SpeechToTextDemoTests.m; sourceTree = ""; }; 73 | /* End PBXFileReference section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | B3FFFF42185E0B390008EC39 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | B33E33B7185E27E0005962B9 /* Speex.framework in Frameworks */, 81 | B3FFFF4B185E0B390008EC39 /* CoreGraphics.framework in Frameworks */, 82 | B3FFFF4D185E0B390008EC39 /* UIKit.framework in Frameworks */, 83 | B3FFFF49185E0B390008EC39 /* Foundation.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | B3FFFF63185E0B3A0008EC39 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | B3FFFF68185E0B3A0008EC39 /* XCTest.framework in Frameworks */, 92 | B3FFFF6A185E0B3A0008EC39 /* UIKit.framework in Frameworks */, 93 | B3FFFF69185E0B3A0008EC39 /* Foundation.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | B33E33AC185E27A7005962B9 /* SpeechToText */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 8B013A50186119F4002D16EC /* bg.png */, 104 | 8B013A5218611A50002D16EC /* mic.png */, 105 | B33E33B6185E27E0005962B9 /* Speex.framework */, 106 | B33E33AD185E27C5005962B9 /* SpeechToTextModule.h */, 107 | B33E33AE185E27C5005962B9 /* SpeechToTextModule.m */, 108 | B33E33AF185E27C5005962B9 /* SineWaveViewController.h */, 109 | B33E33B0185E27C5005962B9 /* SineWaveViewController.m */, 110 | B33E33BD185E2EE1005962B9 /* SineWaveViewController.xib */, 111 | B33E33B1185E27C5005962B9 /* WaveDisplay.h */, 112 | B33E33B2185E27C5005962B9 /* WaveDisplay.m */, 113 | ); 114 | path = SpeechToText; 115 | sourceTree = ""; 116 | }; 117 | B3FFFF3C185E0B390008EC39 = { 118 | isa = PBXGroup; 119 | children = ( 120 | B33E33AC185E27A7005962B9 /* SpeechToText */, 121 | B3FFFF4E185E0B390008EC39 /* SpeechToTextDemo */, 122 | B3FFFF6D185E0B3A0008EC39 /* SpeechToTextDemoTests */, 123 | B3FFFF47185E0B390008EC39 /* Frameworks */, 124 | B3FFFF46185E0B390008EC39 /* Products */, 125 | ); 126 | sourceTree = ""; 127 | }; 128 | B3FFFF46185E0B390008EC39 /* Products */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | B3FFFF45185E0B390008EC39 /* SpeechToTextDemo.app */, 132 | B3FFFF66185E0B3A0008EC39 /* SpeechToTextDemoTests.xctest */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | B3FFFF47185E0B390008EC39 /* Frameworks */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | B3FFFF48185E0B390008EC39 /* Foundation.framework */, 141 | B3FFFF4A185E0B390008EC39 /* CoreGraphics.framework */, 142 | B3FFFF4C185E0B390008EC39 /* UIKit.framework */, 143 | B3FFFF67185E0B3A0008EC39 /* XCTest.framework */, 144 | ); 145 | name = Frameworks; 146 | sourceTree = ""; 147 | }; 148 | B3FFFF4E185E0B390008EC39 /* SpeechToTextDemo */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | B3FFFF57185E0B390008EC39 /* AppDelegate.h */, 152 | B3FFFF58185E0B390008EC39 /* AppDelegate.m */, 153 | B3FFFF5A185E0B390008EC39 /* Main.storyboard */, 154 | B3FFFF5D185E0B390008EC39 /* ViewController.h */, 155 | B3FFFF5E185E0B390008EC39 /* ViewController.m */, 156 | B3FFFF60185E0B390008EC39 /* Images.xcassets */, 157 | B3FFFF4F185E0B390008EC39 /* Supporting Files */, 158 | ); 159 | path = SpeechToTextDemo; 160 | sourceTree = ""; 161 | }; 162 | B3FFFF4F185E0B390008EC39 /* Supporting Files */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | B3FFFF50185E0B390008EC39 /* SpeechToTextDemo-Info.plist */, 166 | B3FFFF51185E0B390008EC39 /* InfoPlist.strings */, 167 | B3FFFF54185E0B390008EC39 /* main.m */, 168 | B3FFFF56185E0B390008EC39 /* SpeechToTextDemo-Prefix.pch */, 169 | ); 170 | name = "Supporting Files"; 171 | sourceTree = ""; 172 | }; 173 | B3FFFF6D185E0B3A0008EC39 /* SpeechToTextDemoTests */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | B3FFFF73185E0B3A0008EC39 /* SpeechToTextDemoTests.m */, 177 | B3FFFF6E185E0B3A0008EC39 /* Supporting Files */, 178 | ); 179 | path = SpeechToTextDemoTests; 180 | sourceTree = ""; 181 | }; 182 | B3FFFF6E185E0B3A0008EC39 /* Supporting Files */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | B3FFFF6F185E0B3A0008EC39 /* SpeechToTextDemoTests-Info.plist */, 186 | B3FFFF70185E0B3A0008EC39 /* InfoPlist.strings */, 187 | ); 188 | name = "Supporting Files"; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | B3FFFF44185E0B390008EC39 /* SpeechToTextDemo */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = B3FFFF77185E0B3A0008EC39 /* Build configuration list for PBXNativeTarget "SpeechToTextDemo" */; 197 | buildPhases = ( 198 | B3FFFF41185E0B390008EC39 /* Sources */, 199 | B3FFFF42185E0B390008EC39 /* Frameworks */, 200 | B3FFFF43185E0B390008EC39 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = SpeechToTextDemo; 207 | productName = SpeechToTextDemo; 208 | productReference = B3FFFF45185E0B390008EC39 /* SpeechToTextDemo.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | B3FFFF65185E0B3A0008EC39 /* SpeechToTextDemoTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = B3FFFF7A185E0B3A0008EC39 /* Build configuration list for PBXNativeTarget "SpeechToTextDemoTests" */; 214 | buildPhases = ( 215 | B3FFFF62185E0B3A0008EC39 /* Sources */, 216 | B3FFFF63185E0B3A0008EC39 /* Frameworks */, 217 | B3FFFF64185E0B3A0008EC39 /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | B3FFFF6C185E0B3A0008EC39 /* PBXTargetDependency */, 223 | ); 224 | name = SpeechToTextDemoTests; 225 | productName = SpeechToTextDemoTests; 226 | productReference = B3FFFF66185E0B3A0008EC39 /* SpeechToTextDemoTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | /* End PBXNativeTarget section */ 230 | 231 | /* Begin PBXProject section */ 232 | B3FFFF3D185E0B390008EC39 /* Project object */ = { 233 | isa = PBXProject; 234 | attributes = { 235 | LastUpgradeCheck = 0500; 236 | ORGANIZATIONNAME = "Muhammad Zeeshan"; 237 | TargetAttributes = { 238 | B3FFFF65185E0B3A0008EC39 = { 239 | TestTargetID = B3FFFF44185E0B390008EC39; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = B3FFFF40185E0B390008EC39 /* Build configuration list for PBXProject "SpeechToTextDemo" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = B3FFFF3C185E0B390008EC39; 252 | productRefGroup = B3FFFF46185E0B390008EC39 /* Products */; 253 | projectDirPath = ""; 254 | projectRoot = ""; 255 | targets = ( 256 | B3FFFF44185E0B390008EC39 /* SpeechToTextDemo */, 257 | B3FFFF65185E0B3A0008EC39 /* SpeechToTextDemoTests */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | B3FFFF43185E0B390008EC39 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | B33E33BE185E2EE1005962B9 /* SineWaveViewController.xib in Resources */, 268 | B3FFFF61185E0B390008EC39 /* Images.xcassets in Resources */, 269 | 8B013A51186119F4002D16EC /* bg.png in Resources */, 270 | B3FFFF53185E0B390008EC39 /* InfoPlist.strings in Resources */, 271 | 8B013A5318611A50002D16EC /* mic.png in Resources */, 272 | B3FFFF5C185E0B390008EC39 /* Main.storyboard in Resources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | B3FFFF64185E0B3A0008EC39 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | B3FFFF72185E0B3A0008EC39 /* InfoPlist.strings in Resources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | B3FFFF41185E0B390008EC39 /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | B3FFFF5F185E0B390008EC39 /* ViewController.m in Sources */, 292 | B33E33B3185E27C5005962B9 /* SpeechToTextModule.m in Sources */, 293 | B33E33B4185E27C5005962B9 /* SineWaveViewController.m in Sources */, 294 | B33E33B5185E27C5005962B9 /* WaveDisplay.m in Sources */, 295 | B3FFFF59185E0B390008EC39 /* AppDelegate.m in Sources */, 296 | B3FFFF55185E0B390008EC39 /* main.m in Sources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | B3FFFF62185E0B3A0008EC39 /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | B3FFFF74185E0B3A0008EC39 /* SpeechToTextDemoTests.m in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXSourcesBuildPhase section */ 309 | 310 | /* Begin PBXTargetDependency section */ 311 | B3FFFF6C185E0B3A0008EC39 /* PBXTargetDependency */ = { 312 | isa = PBXTargetDependency; 313 | target = B3FFFF44185E0B390008EC39 /* SpeechToTextDemo */; 314 | targetProxy = B3FFFF6B185E0B3A0008EC39 /* PBXContainerItemProxy */; 315 | }; 316 | /* End PBXTargetDependency section */ 317 | 318 | /* Begin PBXVariantGroup section */ 319 | B3FFFF51185E0B390008EC39 /* InfoPlist.strings */ = { 320 | isa = PBXVariantGroup; 321 | children = ( 322 | B3FFFF52185E0B390008EC39 /* en */, 323 | ); 324 | name = InfoPlist.strings; 325 | sourceTree = ""; 326 | }; 327 | B3FFFF5A185E0B390008EC39 /* Main.storyboard */ = { 328 | isa = PBXVariantGroup; 329 | children = ( 330 | B3FFFF5B185E0B390008EC39 /* Base */, 331 | ); 332 | name = Main.storyboard; 333 | sourceTree = ""; 334 | }; 335 | B3FFFF70185E0B3A0008EC39 /* InfoPlist.strings */ = { 336 | isa = PBXVariantGroup; 337 | children = ( 338 | B3FFFF71185E0B3A0008EC39 /* en */, 339 | ); 340 | name = InfoPlist.strings; 341 | sourceTree = ""; 342 | }; 343 | /* End PBXVariantGroup section */ 344 | 345 | /* Begin XCBuildConfiguration section */ 346 | B3FFFF75185E0B3A0008EC39 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ALWAYS_SEARCH_USER_PATHS = NO; 350 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 351 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 352 | CLANG_CXX_LIBRARY = "libc++"; 353 | CLANG_ENABLE_MODULES = YES; 354 | CLANG_ENABLE_OBJC_ARC = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_CONSTANT_CONVERSION = YES; 357 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 358 | CLANG_WARN_EMPTY_BODY = YES; 359 | CLANG_WARN_ENUM_CONVERSION = YES; 360 | CLANG_WARN_INT_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | }; 383 | name = Debug; 384 | }; 385 | B3FFFF76185E0B3A0008EC39 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ALWAYS_SEARCH_USER_PATHS = NO; 389 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 390 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 391 | CLANG_CXX_LIBRARY = "libc++"; 392 | CLANG_ENABLE_MODULES = YES; 393 | CLANG_ENABLE_OBJC_ARC = YES; 394 | CLANG_WARN_BOOL_CONVERSION = YES; 395 | CLANG_WARN_CONSTANT_CONVERSION = YES; 396 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 397 | CLANG_WARN_EMPTY_BODY = YES; 398 | CLANG_WARN_ENUM_CONVERSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 402 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 403 | COPY_PHASE_STRIP = YES; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | GCC_C_LANGUAGE_STANDARD = gnu99; 406 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 407 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 408 | GCC_WARN_UNDECLARED_SELECTOR = YES; 409 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 410 | GCC_WARN_UNUSED_FUNCTION = YES; 411 | GCC_WARN_UNUSED_VARIABLE = YES; 412 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 413 | SDKROOT = iphoneos; 414 | VALIDATE_PRODUCT = YES; 415 | }; 416 | name = Release; 417 | }; 418 | B3FFFF78185E0B3A0008EC39 /* Debug */ = { 419 | isa = XCBuildConfiguration; 420 | buildSettings = { 421 | ARCHS = "$(ARCHS_STANDARD)"; 422 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 423 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(inherited)", 426 | "$(SOURCE_ROOT)/SpeechToText", 427 | ); 428 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 429 | GCC_PREFIX_HEADER = "SpeechToTextDemo/SpeechToTextDemo-Prefix.pch"; 430 | HEADER_SEARCH_PATHS = ( 431 | "$(inherited)", 432 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 433 | ); 434 | INFOPLIST_FILE = "SpeechToTextDemo/SpeechToTextDemo-Info.plist"; 435 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 436 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 437 | OTHER_LDFLAGS = ""; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | VALID_ARCHS = "armv7 armv7s"; 440 | WRAPPER_EXTENSION = app; 441 | }; 442 | name = Debug; 443 | }; 444 | B3FFFF79185E0B3A0008EC39 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ARCHS = "$(ARCHS_STANDARD)"; 448 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 449 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 450 | FRAMEWORK_SEARCH_PATHS = ( 451 | "$(inherited)", 452 | "$(SOURCE_ROOT)/SpeechToText", 453 | ); 454 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 455 | GCC_PREFIX_HEADER = "SpeechToTextDemo/SpeechToTextDemo-Prefix.pch"; 456 | HEADER_SEARCH_PATHS = ( 457 | "$(inherited)", 458 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 459 | ); 460 | INFOPLIST_FILE = "SpeechToTextDemo/SpeechToTextDemo-Info.plist"; 461 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 462 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 463 | OTHER_LDFLAGS = ""; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | VALID_ARCHS = "armv7 armv7s"; 466 | WRAPPER_EXTENSION = app; 467 | }; 468 | name = Release; 469 | }; 470 | B3FFFF7B185E0B3A0008EC39 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 474 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SpeechToTextDemo.app/SpeechToTextDemo"; 475 | FRAMEWORK_SEARCH_PATHS = ( 476 | "$(SDKROOT)/Developer/Library/Frameworks", 477 | "$(inherited)", 478 | "$(DEVELOPER_FRAMEWORKS_DIR)", 479 | ); 480 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 481 | GCC_PREFIX_HEADER = "SpeechToTextDemo/SpeechToTextDemo-Prefix.pch"; 482 | GCC_PREPROCESSOR_DEFINITIONS = ( 483 | "DEBUG=1", 484 | "$(inherited)", 485 | ); 486 | INFOPLIST_FILE = "SpeechToTextDemoTests/SpeechToTextDemoTests-Info.plist"; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | TEST_HOST = "$(BUNDLE_LOADER)"; 489 | WRAPPER_EXTENSION = xctest; 490 | }; 491 | name = Debug; 492 | }; 493 | B3FFFF7C185E0B3A0008EC39 /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 497 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SpeechToTextDemo.app/SpeechToTextDemo"; 498 | FRAMEWORK_SEARCH_PATHS = ( 499 | "$(SDKROOT)/Developer/Library/Frameworks", 500 | "$(inherited)", 501 | "$(DEVELOPER_FRAMEWORKS_DIR)", 502 | ); 503 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 504 | GCC_PREFIX_HEADER = "SpeechToTextDemo/SpeechToTextDemo-Prefix.pch"; 505 | INFOPLIST_FILE = "SpeechToTextDemoTests/SpeechToTextDemoTests-Info.plist"; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | TEST_HOST = "$(BUNDLE_LOADER)"; 508 | WRAPPER_EXTENSION = xctest; 509 | }; 510 | name = Release; 511 | }; 512 | /* End XCBuildConfiguration section */ 513 | 514 | /* Begin XCConfigurationList section */ 515 | B3FFFF40185E0B390008EC39 /* Build configuration list for PBXProject "SpeechToTextDemo" */ = { 516 | isa = XCConfigurationList; 517 | buildConfigurations = ( 518 | B3FFFF75185E0B3A0008EC39 /* Debug */, 519 | B3FFFF76185E0B3A0008EC39 /* Release */, 520 | ); 521 | defaultConfigurationIsVisible = 0; 522 | defaultConfigurationName = Release; 523 | }; 524 | B3FFFF77185E0B3A0008EC39 /* Build configuration list for PBXNativeTarget "SpeechToTextDemo" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | B3FFFF78185E0B3A0008EC39 /* Debug */, 528 | B3FFFF79185E0B3A0008EC39 /* Release */, 529 | ); 530 | defaultConfigurationIsVisible = 0; 531 | defaultConfigurationName = Release; 532 | }; 533 | B3FFFF7A185E0B3A0008EC39 /* Build configuration list for PBXNativeTarget "SpeechToTextDemoTests" */ = { 534 | isa = XCConfigurationList; 535 | buildConfigurations = ( 536 | B3FFFF7B185E0B3A0008EC39 /* Debug */, 537 | B3FFFF7C185E0B3A0008EC39 /* Release */, 538 | ); 539 | defaultConfigurationIsVisible = 0; 540 | defaultConfigurationName = Release; 541 | }; 542 | /* End XCConfigurationList section */ 543 | }; 544 | rootObject = B3FFFF3D185E0B390008EC39 /* Project object */; 545 | } 546 | --------------------------------------------------------------------------------