summaryrefslogtreecommitdiff
path: root/Build/index.html
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2021-08-27 09:48:11 +0100
committerZoRo <dos21h@gmail.com>2021-08-27 09:48:11 +0100
commitffe433508af77aac30f79200d281b4326173af75 (patch)
tree470986ff782482b06337d8c635b284116df31f5b /Build/index.html
parentec585ba33f61381e5b2095c2386083ea843b2c47 (diff)
downloadNaiveFFT-ffe433508af77aac30f79200d281b4326173af75.tar.gz
NaiveFFT-ffe433508af77aac30f79200d281b4326173af75.zip
Fixed input data bug
Diffstat (limited to 'Build/index.html')
-rw-r--r--Build/index.html24
1 files changed, 13 insertions, 11 deletions
diff --git a/Build/index.html b/Build/index.html
index 1a571f7..df0ba28 100644
--- a/Build/index.html
+++ b/Build/index.html
@@ -23,8 +23,9 @@
script.src = "index.js";
script.onload = function() {
console.log("Emscripten boilerplate loaded.");
- run_dft = Module.cwrap("dft", [],[['float'],['float'],'number','number']);
- run_fft= Module.cwrap("fft_1",[],[['float'],['float'],'number','number']);
+ run_dft = Module.cwrap("dft", [],[['float'],['float'],'number','number']);
+ run_fft_shuffle = Module.cwrap("ffti_shuffle_1", [],[['float'],['float'],'number']);
+ run_fft = Module.cwrap("fft_1", [],[['float'],['float'],'number','number']);
@@ -48,7 +49,7 @@
}
function checkArr(inputData,errorOutput) {
- var strArr = inputDataI.value;
+ var strArr = inputData.value;
strArr = strArr.replace(/ +(?= )/g,'');
var splArr = strArr.split(" ");
@@ -87,21 +88,22 @@
for(let i=0,j=0;i<N,j<arrQok.data.length;i++,j++) {
myArray_q.data[i] = arrQok.data[j];
}
-
- //console.log(typeof myArray_i);
- //console.log(myArray_i);
+ console.log(myArray_i.data);
+ console.log(myArray_q.data);
+ //DFT
+ run_dft(myArray_i.offset,myArray_q.offset,N,0);
+ //FFT
+ //run_fft_shuffle(myArray_i.offset,myArray_q.offset,N);
+ //run_fft(myArray_i.offset,myArray_q.offset,N,1);
-
- run_dft(myArray_i.offset,myArray_q.offset,N,1);
-
console.log(myArray_i.data);
console.log(myArray_q.data)
function outputResult(array,output) {
- var arr = Array(array.slice(0,N-1));
+ var arr = Array(array.slice(0,N));
arr = arr.map(function(item){
return item.map(function(num){
- return parseFloat(num.toFixed(2));
+ return parseFloat(num.toFixed(4));
});
});
output.value = arr;