ios - Frequency from lightning sound card -


my app uses audiokit measure frequency , amplitude microphone. displays if people speaking within given area. works charm built in mic on ipad, , mic headset connected. try connect presonus audiobox ione, kind of soundcard, can connect professional mic to. amplitude more accurate mic, frequency measurement on place. playing constant sine wave of 500 hz, built in , headset mics measure perfectly, audiobox measures anywhere occasional correct 499 hz 43500 hz.

i tried various filters (aklowpassfilter , akhighpassfilter) audiokit not seem much.

the presonus box faulty thought, bought another, gives me same results. tried installing splnftt , app measures correct, hope can help

override func viewdidload() {         super.viewdidload()         recordingsession = avaudiosession.sharedinstance()         {             try recordingsession.setcategory(avaudiosessioncategoryplayandrecord)             try recordingsession.setactive(true)             recordingsession.requestrecordpermission() { [unowned self] allowed in                 dispatchqueue.main.async {                     if allowed {                         self.togglebutton.isenabled = true                     } else {                         self.togglebutton.isenabled = false                     }                 }             }         } catch {             // failed record!         }         aksettings.audioinputenabled = true         mic = akmicrophone()     }     @ibaction func togglestart(_ sender: uibutton) {          if(!running){             if (startstoplabel.text == "start øvelse"){                 measurements = [vtmeasurement]()                 startrecording()                 timer.invalidate()                 animator.invalidate()                 timer = timer.scheduledtimer(timeinterval: 1.0, target: self, selector: #selector(startcounter), userinfo: nil, repeats: true)                  startstoplabel.text = "stop øvelse"                 togglebutton.setimage(#imageliteral(resourcename: "stoprec"), for: .normal)                 mic.start()                 lowpass = akhighpassbutterworthfilter(mic, cutofffrequency: 500)                 lowpass.start()                  //frequencytracker = akfrequencytracker.init(mic)                 frequencytracker = akfrequencytracker.init(lowpass)                 silence = akbooster(frequencytracker, gain: 0)                  audiokit.output = silence                 audiokit.start()                 switch self.exercisetype {                 case .strength:                     self.miliseconds = 100                     animator = timer.scheduledtimer(timeinterval: 0.1, target: self, selector: #selector(strengthanimator), userinfo: nil, repeats: true)                 case .range:                     self.miliseconds = 100                     animator = timer.scheduledtimer(timeinterval: 0.1, target: self, selector: #selector(rangeanimator), userinfo: nil, repeats: true)                 case .combined:                     self.miliseconds = 200                     animator = timer.scheduledtimer(timeinterval: 0.2, target: self, selector: #selector(combinedanimator), userinfo: nil, repeats: true)                 case .notset:                     print("not set")                  }                 running = !running             }else{                 startstoplabel.text = "start øvelse"                 self.removesubviews()                 self.viewdidload()                 self.viewwillappear(true)             }         }else{             finishrecording(success: true)             startstoplabel.text = "genstart øvelse"             togglebutton.setimage(#imageliteral(resourcename: "startrec"), for: .normal)             frequencytracker.stop()             mic.stop()             frequencytracker = nil;             mic = nil;             timer.invalidate()             animator.invalidate()             if exercisetype == .strength{                 uiview.animate(withduration: 1.5, delay: 0.3, options: [.transitioncurldown], animations: {                     self.pinimageview?.frame.origin.y = self.rangeview.frame.height - 9                  }, completion: nil)             }              running = !running         }      }      func finish(){         finishrecording(success: true)         startstoplabel.text = "genstart øvelse"         togglebutton.setimage(#imageliteral(resourcename: "startrec"), for: .normal)         frequencytracker.stop()         timer.invalidate()         animator.invalidate()         if exercisetype == .strength{             uiview.animate(withduration: 1.5, delay: 0.3, options: [.transitioncurldown], animations: {                 self.pinimageview?.frame.origin.y = self.rangeview.frame.height - 9              }, completion: nil)         }      } 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -