Allison Logic

Introduction

The main features:

Integration with database:

History:

Usage Example:

import UIKit
import AllisonLogic

class ViewController: UIViewController {
//MARK: Properties
var magnitudes1 : [Float] = []
var magnitudes2 : [Float] = []

let prepare = AllisonLogic.Prepare()

@IBOutlet weak var Record1Button: UIButton!
@IBOutlet weak var Record2Button: UIButton!
@IBOutlet weak var CompareButton: UIButton!

//MARK: Actions

@IBAction func RecordVoice1(_ sender: UIButton) {
magnitudes1 = prepare.record_audio_get_frequency()
var idx = 1
for magnitudeValue in magnitudes1
{
print("\(idx) magnitudeValue1 = \(magnitudeValue)")
idx = idx + 1
}
}

@IBAction func RecordVoice2(_ sender: UIButton) {
magnitudes2 = prepare.record_audio_get_frequency()
var idx = 1
for magnitudeValue in magnitudes2
{
print("\(idx) magnitudeValue2 = \(magnitudeValue)")
idx = idx + 1
}
}

@IBAction func CompareVoice(_ sender: UIButton) {
let compute = AllisonLogic.Compute()
let mag1_100_blocks = compute.sum_store_in_100_blocks(magnitudes1)
let mag2_100_blocks = compute.sum_store_in_100_blocks(magnitudes2)
//section 1: testing use
let score = compare_magnitudes_get_score(mag1_100_blocks, mag2_100_blocks)
//the authentication threshold should be set at >= 77%, the minumum score needed to be considered the same voice as the authorized person
print("score in % =\(score)")

//section 2: database integration design
//i. each record should have 100 fields
//ii. and additional fields for userid, devicemodel, storagecount as recordkey
//iii. we need devicemodel as part of the recordkey because different hardware has different frequence response so we must record additional voice and store it
//iv. we need storagecount as part of the recordkey because we want to store 2 voice samples per userid and devicemodel where the 2 voice samples must match >= 77%.
//v. do not store the voice samples into the database if the comparison score did not match >= 77%, the voice samples stored in the database are used as the source signals
//vi. when the input userid and devicemodel matches the values in the database, and the input signal matches any one of these 2 source voice samples in the database with a score >= 77%, we consider it authorized
//vii. the above design is for enabling better security and at the same time able to avoid user frustration when the incoming signals can compare against any one of the valid source samples

//the process of storing voice sample 1
var idx1 = 1
for magnitudeValue in mag1_100_blocks //loop 1 to 100
{
print("Store this value \(magnitudeValue) in field \(idx1)")
idx1 = idx1 + 1
}

//the process of storing voice sample 2
var idx2 = 1
for magnitudeValue in mag2_100_blocks //loop 1 to 100
{
print("Store this value \(magnitudeValue) in field \(idx2)")
idx2 = idx2 + 1
}
}

func compare_magnitudes_get_score(_ magnitude1: [Float], _ magnitude2: [Float]) -> Int {
var block1: Float = 0
var block2: Float = 0
var ratio: Float = 0
var matchCount: Int = 0

for index in 0...99
{
block1 = magnitude1[index]
block2 = magnitude2[index]
ratio = block2 / block1
if ratio >= 0.5 && ratio <= 1.5
{
matchCount += 1
}
}
return matchCount
}

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
prepare.LicenseKey = "enquiry@basic-signalprocessing.com"
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}


Trial Version Download:

Implementation: