alexa-tracking

gan,, minta tolong nih, gimana ya implementasi DSP di pyhton?

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/53e43beb12e257c5558b457f/gan-minta-tolong-nih-gimana-ya-implementasi-dsp-di-pyhton
gan,, minta tolong nih, gimana ya implementasi DSP di pyhton?
ane newbi nih gan, jadi maaf kalo ada yang salah2 rule disini,,
jadi gini gan, ane mau implementasiin filter Bandpass FIR di raspberry ane,, tapi gimana ya cara implementasiinya ?
ane udah dapet koefisiennya di matlab, nah implementasiin k python gimana ya ?
nih, sebelumnya udah ada program nya pake bahasa C implementasi ke mbed,, skrg mau coba ke raspberry pake python,, mohon bantuannya agan2 semuaa..

#include "mbed.h"
#include "math.h"
analogIn Ain (p20);
analogOut Aout(p18);
Ticker s20khz_tick;

float LPFFIR(float LPFFIR_in) {

float b1[4]={0.0466, 0.4534, 0.4534, 0.0466};
static float LPFFIR_out;
static float x1[4], y1[4];

x1[3]=x1[2];x1[2]=x1[1];x1[1]=x1[0]; //move x values by one sample
y1[3]=y1[2];y1[2]=y1[1];y1[1]=y1[0];

x1[0]=LPFFIR_in;
y1[0]=(b1[0]*x1[0])+(b1[1]*x1[1])+(b1[2]*x1[2])+(b1[3]*x1[3]);

LPFFIR_out=y1[0];
return LPFFIR_out;
}

//function prototypes
void s20khz_task(void);

//variable and data
float data_in, data_out;

//main program
int main() {
s20khz_tick.attach_us(&s20khz_task,50); //attach task to 50us tick
}

//funtion 20khz_task
vois s20khz_task (void) {
data_in= Ain-0.5;
data_out=LPFFIR(data_in);
Aout=data_out +0.5;
}