These instructions are for installing and running SPM12 (standalone) on macOS with Apple Silicon.
- Download SPM12 (standalone) here
These instructions are for installing and running SPM12 (standalone) on macOS with Apple Silicon.
| open class GoogleSpeechToTextStreamingTap { | |
| internal var converter: AVAudioConverter! | |
| @objc public init(_ input: AKNode?, sampleRate: Double = 16000.0) { | |
| let format = AVAudioFormat(commonFormat: AVAudioCommonFormat.pcmFormatInt16, sampleRate: sampleRate, channels: 1, interleaved: false)! | |
| self.converter = AVAudioConverter(from: AudioKit.format, to: format) | |
| self.converter?.sampleRateConverterAlgorithm = AVSampleRateConverterAlgorithm_Normal |
| import json | |
| import paho.mqtt.client as mqtt | |
| # MQTT client to connect to the bus | |
| mqtt_client = mqtt.Client() | |
| def on_connect(client, userdata, flags, rc): | |
| print('Connected') | |
| mqtt_client.subscribe('#') # subscribe to all messages | |
| mqtt_client.publish('hermes/asr/toggleOn') # Start recording audio |
| export DIGITAL_OCEAN_TOKEN='' | |
| curl -X GET --silent "https://api.digitalocean.com/v2/images?per_page=999" -H "Authorization: Bearer $DIGITAL_OCEAN_TOKEN" |
| import Foundation | |
| import RealmSwift | |
| import ObjectMapper | |
| class Product: Object, Mappable | |
| { | |
| dynamic var name = "" | |
| dynamic var price = 0.0 | |
| var discount = RealmOptional<Float>() { |
| extension Array | |
| { | |
| mutating func removeObjectByClass<T>(t: T.Type) | |
| { | |
| for (index, object) in self.enumerate() | |
| { | |
| if let _ = object as? T | |
| { | |
| self.removeAtIndex(index) | |
| } |
| import Foundation | |
| import CocoaLumberjack | |
| import Crashlytics | |
| class CrashlyticsLogger : DDAbstractLogger | |
| { | |
| static let sharedInstance = CrashlyticsLogger() | |
| private var _logFormatter : DDLogFormatter? | |
| override var logFormatter: DDLogFormatter? { |
| import Foundation | |
| import CocoaLumberjack | |
| class CustomLogFormatter : NSObject, DDLogFormatter | |
| { | |
| private var dateFormatter : NSDateFormatter! | |
| override init() | |
| { | |
| self.dateFormatter = NSDateFormatter() |
| var commands = [UIKeyCommand]() | |
| var onceToken : dispatch_once_t = 0 | |
| override var keyCommands : [AnyObject]? { | |
| get { | |
| dispatch_once(&onceToken) { | |
| self.commands = [ | |
| UIKeyCommand(input: " ", modifierFlags: nil, action: "spacePressed:"), | |
| UIKeyCommand(input: "\r", modifierFlags: nil, action: "enterPressed:"), | |
| UIKeyCommand(input: "0", modifierFlags: nil, action: "zeroPressed:"), |
| extension String | |
| { | |
| func removeWords(words: [String]) -> String | |
| { | |
| var cleanedString = self | |
| // Remove common words | |
| for word in words | |
| { | |
| cleanedString = cleanedString.stringByReplacingOccurrencesOfString(word, withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil) |