aboutsummaryrefslogtreecommitdiffstats
path: root/Project/RTDSP/frame.c
diff options
context:
space:
mode:
authorunknown <dm2515@eews303a-004.ic.ac.uk>2018-03-05 11:32:57 +0000
committerunknown <dm2515@eews303a-004.ic.ac.uk>2018-03-05 11:32:57 +0000
commitfcaf88ac27152cf3c553fb5976ce2aed3b64f6f2 (patch)
tree8acaa55d8bae3429c446f68f9f3fc0670404a207 /Project/RTDSP/frame.c
parent940fc1e52823dfdeb635e07fa161d98ab283bc0b (diff)
downloadNoiseSilencer-fcaf88ac27152cf3c553fb5976ce2aed3b64f6f2.tar.gz
NoiseSilencer-fcaf88ac27152cf3c553fb5976ce2aed3b64f6f2.zip
EX2 code
Diffstat (limited to 'Project/RTDSP/frame.c')
-rw-r--r--Project/RTDSP/frame.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Project/RTDSP/frame.c b/Project/RTDSP/frame.c
index a8fd350..1db240e 100644
--- a/Project/RTDSP/frame.c
+++ b/Project/RTDSP/frame.c
@@ -78,6 +78,8 @@ float *input;
float *intermediate;
float *output;
volatile int index = 0;
+float* mag;
+complex C[BUFLEN];
/******************************* Function prototypes *******************************/
@@ -181,7 +183,7 @@ void ISR_AIC(void)
void wait_buffer(void)
{
float *p;
-
+ int i;
/* wait for array index to be set to zero by ISR */
while(index);
@@ -191,10 +193,19 @@ void wait_buffer(void)
output = intermediate;
intermediate = p;
+
/************************* DO PROCESSING OF FRAME HERE **************************/
-
-
- /*please add your code */
+
+ // Copy data elements to complex
+ for (i = 0; i < BUFLEN; ++i)
+ C[i].r = intermediate[i];
+
+ fft(BUFLEN, C);
+
+ // Calculate the magnitude of the complex numbers
+ for (i = 0; i < BUFLEN; ++i)
+ mag[i] = cabs(C[i]);
+
/**********************************************************************************/