{"action":"created","issue":{"url":"https://api.github.com/repos/syedhali/EZAudio/issues/225","labels_url":"https://api.github.com/repos/syedhali/EZAudio/issues/225/labels{/name}","comments_url":"https://api.github.com/repos/syedhali/EZAudio/issues/225/comments","events_url":"https://api.github.com/repos/syedhali/EZAudio/issues/225/events","html_url":"https://github.com/syedhali/EZAudio/issues/225","id":105646997,"number":225,"title":"Trying to understand FFT data ","user":{"login":"mikeydelamonde","id":1169975,"avatar_url":"https://avatars.githubusercontent.com/u/1169975?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeydelamonde","html_url":"https://github.com/mikeydelamonde","followers_url":"https://api.github.com/users/mikeydelamonde/followers","following_url":"https://api.github.com/users/mikeydelamonde/following{/other_user}","gists_url":"https://api.github.com/users/mikeydelamonde/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeydelamonde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeydelamonde/subscriptions","organizations_url":"https://api.github.com/users/mikeydelamonde/orgs","repos_url":"https://api.github.com/users/mikeydelamonde/repos","events_url":"https://api.github.com/users/mikeydelamonde/events{/privacy}","received_events_url":"https://api.github.com/users/mikeydelamonde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-09T17:35:46Z","updated_at":"2015-10-12T16:38:36Z","closed_at":null,"body":"I am trying to create an app that outputs a pattern based on the FFT of the audio source. Basically as the audio plays time is along the x axis and the FFT is along the y-axis. As the music plays a pattern is created of squares and the colour of the square will be dictated by the amplitude of the frequency in that FFT sub-region. \r\n\r\nThe code looks like this and the FFTViewControllerFFTWindowSize = 150;\r\n```\r\n//------------------------------------------------------------------------------\r\n#pragma mark - EZAudioPlayerDelegate\r\n//------------------------------------------------------------------------------\r\n\r\n- (void)  audioPlayer:(EZAudioPlayer *)audioPlayer\r\n          playedAudio:(float **)buffer\r\n       withBufferSize:(UInt32)bufferSize\r\n withNumberOfChannels:(UInt32)numberOfChannels\r\n          inAudioFile:(EZAudioFile *)audioFile\r\n{\r\n    [self.fft computeFFTWithBuffer:buffer[0] withBufferSize:bufferSize];\r\n}\r\n\r\n//------------------------------------------------------------------------------\r\n#pragma mark - EZAudioFFTDelegate\r\n//------------------------------------------------------------------------------\r\n\r\n- (void)        fft:(EZAudioFFT *)fft\r\n updatedWithFFTData:(float *)fftData\r\n         bufferSize:(vDSP_Length)bufferSize\r\n{\r\n    __weak typeof (self) weakSelf = self;\r\n    dispatch_async(dispatch_get_main_queue(), ^{\r\n        [weakSelf.audioPlot updateBuffer:fftData withBufferSize:(UInt32)bufferSize];\r\n        for (int i = 0; i<bufferSize; i++) {\r\n            NSLog(@\"fft val %f\", fftData[i]);\r\n        }\r\n    });\r\n}\r\n```\r\nThe NSLog is there to demonstrate my problem. I've picked two random lists from a time point and pasted them below. Basically I thought that the maximum that an FFT value could be was 1 but in one of them there is a value of 6.952471 and also in the other all the values are tiny e.g. 0.001 even though I can hear it's playing something. What am I doing wrong?\r\n\r\nI am trying to reproduce something that uses Flash's computeSpectrum function which returns an array of 256 floats between 0 and 1. This seems pretty easy!\r\n\r\nhttp://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/SoundMixer.html#computeSpectrum()\r\n\r\nPoint 1 | Point 2\r\n------- | -------\r\n0.005816 | 6.952471\r\n0.010704 | 1.260185\r\n0.004519 | 0.266269\r\n0.002781 | 0.152540\r\n0.038111 | 0.073087\r\n0.274509 | 0.125507\r\n0.004770 | 0.010155\r\n0.001016 | 0.023328\r\n0.000611 | 0.032141\r\n0.000115 | 0.003583\r\n0.001193 | 0.009749\r\n0.000731 | 0.011863\r\n0.000630 | 0.027307\r\n0.000996 | 0.002040\r\n0.000452 | 0.005508\r\n0.002430 | 0.004133\r\n0.001266 | 0.006598\r\n0.000089 | 0.001877\r\n0.000483 | 0.002913\r\n0.000826 | 0.004395\r\n0.005266 | 0.003958\r\n0.014211 | 0.002250\r\n0.008589 | 0.008281\r\n0.004920 | 0.002627\r\n0.008350 | 0.002476\r\n0.002999 | 0.003924\r\n0.002559 | 0.007930\r\n0.005831 | 0.004289\r\n0.011384 | 0.001885\r\n0.012413 | 0.005358\r\n0.006980 | 0.002461\r\n0.013374 | 0.000612\r\n0.015251 | 0.005339\r\n0.003759 | 0.002789\r\n0.006180 | 0.000378\r\n0.003345 | 0.001412\r\n0.008930 | 0.001558\r\n0.003787 | 0.002587\r\n0.000106 | 0.001820\r\n0.001123 | 0.000735\r\n0.000924 | 0.001579\r\n0.000151 | 0.001727\r\n0.002845 | 0.000791\r\n0.008067 | 0.001092\r\n0.005768 | 0.002239\r\n0.000094 | 0.001397\r\n0.001194 | 0.002666\r\n0.001379 | 0.001862\r\n0.006607 | 0.002025\r\n0.000655 | 0.002483\r\n0.004555 | 0.001759\r\n0.000482 | 0.001794\r\n0.002681 | 0.002802\r\n0.000500 | 0.000716\r\n0.002257 | 0.002413\r\n0.000055 | 0.001505\r\n0.001836 | 0.002478\r\n0.002179 | 0.001258\r\n0.006315 | 0.001065\r\n0.000939 | 0.001652\r\n0.000145 | 0.002018\r\n0.004384 | 0.001556\r\n0.002653 | 0.002018\r\n0.000954 | 0.001747\r\n0.000014 | 0.001198\r\n0.000021 | 0.001133\r\n0.000004 | 0.000924\r\n0.000018 | 0.000901\r\n0.000051 | 0.000748\r\n0.000023 | 0.000646\r\n0.000022 | 0.000739\r\n0.000114 | 0.000669\r\n0.000567 | 0.000658\r\n0.001699 | 0.000710\r\n0.000680 | 0.000622\r\n\r\n\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/syedhali/EZAudio/issues/comments/147455614","html_url":"https://github.com/syedhali/EZAudio/issues/225#issuecomment-147455614","issue_url":"https://api.github.com/repos/syedhali/EZAudio/issues/225","id":147455614,"user":{"login":"nor-bu","id":10696903,"avatar_url":"https://avatars.githubusercontent.com/u/10696903?v=3","gravatar_id":"","url":"https://api.github.com/users/nor-bu","html_url":"https://github.com/nor-bu","followers_url":"https://api.github.com/users/nor-bu/followers","following_url":"https://api.github.com/users/nor-bu/following{/other_user}","gists_url":"https://api.github.com/users/nor-bu/gists{/gist_id}","starred_url":"https://api.github.com/users/nor-bu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nor-bu/subscriptions","organizations_url":"https://api.github.com/users/nor-bu/orgs","repos_url":"https://api.github.com/users/nor-bu/repos","events_url":"https://api.github.com/users/nor-bu/events{/privacy}","received_events_url":"https://api.github.com/users/nor-bu/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T16:38:36Z","updated_at":"2015-10-12T16:38:36Z","body":"Do you have a solution for the problem?"}}