Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[HELP] Swift IOS Programming Reading Audio hertz

Status
Not open for further replies.
Newbie Spellweaver
Joined
Feb 28, 2006
Messages
20
Reaction score
0
Good day everyone,

i have a question. How can i get the herts from an audio file i recorded. I am using AVAudioEngine and i want to get the hertz realtime. Is this even possible? and could you give me a hint how to get this.

Thanks in advance!
 
Newbie Spellweaver
Joined
Feb 28, 2006
Messages
20
Reaction score
0
this is my code to get the frequencies real time

var sr:Float = Float(mixer.outputFormatForBus(0).sampleRate)
var n_channels = mixer.outputFormatForBus(0).channelCount

for var i = 0; i < Int(buffer.frameLength); i+=Int(n_channels) {
var val = sinf(441.0*Float(i)*2*Float(M_PI)/sr)
buffer.floatChannelData.memory = val * 0.5
//test
println("buffer waarde:\(buffer.floatChannelData.memory * 100 )");
}

BUT i get strange values could anyone help me out here is, is it becouse i use the iphone simulator?

some example value i got

Hertz:9.34841
Hertz:15.4174
Hertz:21.2444
Hertz:26.7372
Hertz:31.8109
Hertz:36.3852
Hertz:40.3882
Hertz:43.7571
Hertz:46.4388
Hertz:48.3917

those values should have been arround 27.something becouse i was making frequencies arround that value
 
Newbie Spellweaver
Joined
Feb 28, 2006
Messages
20
Reaction score
0
Could a mod close this please? becouse i already fixxed it xD
 
Status
Not open for further replies.
Back
Top