I would like to create a Band Limited Table Lookup Oscillator that functions much like the sin()
function in C++ works where i would inout a phase value and receive a sample value. for example Sample s = saw(x);
or Sample s = square(x);
.
To fill the table I would first generate an oversampled table by a factor of "X" that contains the wave in a non band limited state. Then I would run the table through a filter of some sort FIR or IIR most likely. Then i would decimate the table by a factor of "X" and hopefully then have a table that i could read from that would produce a band limited signal. I would also have to interpolate across the table to ensure that all phase angles will be accommodated for.
I would like to know if this theory would work? Meaning would this produce a signal that is Band limited.
I will mock up the basic code below.
double saw(double phase){
return interpolate(phase);//i know this is incomplete
}
double fillTable(){
double table[size*oversampling];
//fill table here. skipping for length of example
for(int i =0;i<tableSize;++i){
table[i]=filter(table[i]);
}
double table2[size];
int x=0;
for(int i =0;i<tableSize;++i){
table2[i]=table[x];
x+=oversampling;
}
}
//usage
sample x = saw(phase);
I know the code is incomplete and syntactically incorrect but i just wanted to give an example of what i would like to be able to do.
So again. Will this be Band limited?