Swiftpack.co - The-TONE-Knows-Inc/ToneLibrary as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by The-TONE-Knows-Inc.
The-TONE-Knows-Inc/ToneLibrary 7.0.1
Tone Library
⭐️ 0
🕓 20 weeks ago
iOS macOS
.package(url: "https://github.com/The-TONE-Knows-Inc/ToneLibrary.git", from: "7.0.1")

Tone Framework

A Swift package for working with AudioKIK and allows to perceive and filter tones (frequencies)

Requirements

  • Swift 5.3+
  • IOS 13+

Usage


import ToneListen

// Instance tone framework by passing client ID
let toneFramework = ToneFramework(clientID: {{ Your client ID }})

//Start listen service:
toneFramework.start()

//To stop service:
toneFramework.stop()

//If you need to be notified when a valid tone was caught, you will need to subscribe to 'notificationName' from NotificationHandler:

// By publishing this property we can ensure that our subscriber (notificationName) will be
// re-rendered when the property changes (i.e. whenever there's a new notification)
@Published var newNotification: String? {
    didSet {
        guard notifiedValue != nil else { return }            
    }
}

notificationSub = NotificationCenter.default.publisher(for: NotificationsHandler.notificationName)
            .map { notification in notification.object as? String }   // Transform the notification into a simple string
            .assign(to: \notifiedValue, on: self)  // Assign the msg to a property using a keypath

// 'notifiedValue' saves an URL or PhoneNumber (string), depending what tone was caught. 

NOTE:

You need to add "Background modes" capabilites to your proyect to allow use microphone and other services in background.

Also you need to add frecuencies_table.json to your project.

Installation

Swift Package Manager

Add the ToneLibrary package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/The-TONE-Knows-Inc/ToneLibrary",
        from: "TonelibraryV3"
    ),
  ]
)

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics