PreenFM > preenfm2 and preenfm3

Formant Filter

<< < (2/3) > >>

Xavier:
I just gave a quick try on one channel but could not get any sound out of these coefs :


--- Code: ---
    case FILTER_FORMANT:
    {
        int vowelnum = params.effect.param1  * 4.0d;
        float *sp = this->sampleBlock;

        float formantMemoryLeft0 = formantMemoryLeft[0];
        float formantMemoryLeft1 = formantMemoryLeft[1];
        float formantMemoryLeft2 = formantMemoryLeft[2];
        float formantMemoryLeft3 = formantMemoryLeft[3];
        float formantMemoryLeft4 = formantMemoryLeft[4];
        float formantMemoryLeft5 = formantMemoryLeft[5];
        float formantMemoryLeft6 = formantMemoryLeft[6];
        float formantMemoryLeft7 = formantMemoryLeft[7];
        float formantMemoryLeft8 = formantMemoryLeft[8];
        float formantMemoryLeft9 = formantMemoryLeft[9];


        for (int k=0 ; k < BLOCK_SIZE ; k++) {

            //---------------------------------------------------------------------------------
            *sp = (float) ( coeff[vowelnum][0] * (*sp)  +
            coeff[vowelnum][1] * formantMemoryLeft0 +
            coeff[vowelnum][2] *formantMemoryLeft1 +
            coeff[vowelnum][3] *formantMemoryLeft2 +
            coeff[vowelnum][4] *formantMemoryLeft3 +
            coeff[vowelnum][5] *formantMemoryLeft4 +
            coeff[vowelnum][6] *formantMemoryLeft5 +
            coeff[vowelnum][7] *formantMemoryLeft6 +
            coeff[vowelnum][8] *formantMemoryLeft7 +
            coeff[vowelnum][9] *formantMemoryLeft8 +
            coeff[vowelnum][10] *formantMemoryLeft9 );

            formantMemoryLeft9= formantMemoryLeft8;
            formantMemoryLeft8= formantMemoryLeft7;
            formantMemoryLeft7= formantMemoryLeft6;
            formantMemoryLeft6= formantMemoryLeft5;
            formantMemoryLeft5= formantMemoryLeft4;
            formantMemoryLeft4= formantMemoryLeft3;
            formantMemoryLeft3= formantMemoryLeft2;
            formantMemoryLeft2= formantMemoryLeft1;
            formantMemoryLeft1= formantMemoryLeft0;
            formantMemoryLeft0= (*sp);

            *sp++ = (*sp) * mixerGain;
            *sp++ = (*sp) * mixerGain;


        }
        formantMemoryLeft[0] = formantMemoryLeft0;
        formantMemoryLeft[1] = formantMemoryLeft1;
        formantMemoryLeft[2] = formantMemoryLeft2;
        formantMemoryLeft[3] = formantMemoryLeft3;
        formantMemoryLeft[4] = formantMemoryLeft4;
        formantMemoryLeft[5] = formantMemoryLeft5;
        formantMemoryLeft[6] = formantMemoryLeft6;
        formantMemoryLeft[7] = formantMemoryLeft7;
        formantMemoryLeft[8] = formantMemoryLeft8;
        formantMemoryLeft[9] = formantMemoryLeft9;

    }
    break;

--- End code ---

If anyone see something wrong... let me know.
If not, i assume the 32bits FPU of the STM32F4 is not precise enough for this operation.

I would not bereally surprise when i look at the coef[] which goes from 8.11044e-06 to 181.6233289...
The first one must be rounded to 0.

Xavier

matrix12x:
Hi Xavier,

According to one of the comments on musicdsp.org, I changed the first coefficient to 3.11044e-06 from 8.11044e-06. Although I think you are correct about it being rounded to zero.

I also put the coefficients in the case, as well as the:    
static double memory[10]={0,0,0,0,0,0,0,0,0,0};

Also, I did this exactly as was in the original:
      memory[9]= memory[8];
      memory[8]= memory[7];
      memory[7]= memory[6];
      memory[6]= memory[5];
      memory[5]= memory[4];
      memory[4]= memory[3];
      memory[3]= memory[2];
      memory[2]= memory[1];   
      memory[1]= memory[0];
      memory[0]=(double) localV;
then a:
                localv0L = localV;

I am not sure it is the correct sound I get, but I definitely get sound.

matrix12x:
I am wondering if a better approach would be 3 parallel band pass filters?
or is that too cpu intensive?

Xavier:

Thanks, a assume it cannot work at all with floats (32 bits) as i did.
I haven't tried with double (64 bits)... which will be much slower on the preenfm2 because 64 bits is not natively suported by the ARM FPU.

Keep in mind that intel/amd FPU use 80 bits for intermediate result, so that's can be a usefull/hearable difference in that kind of calcul.

Have 3 parallels band pass is an idea... Did any one make that before for firmant filtering ? I don't know.
It will be less intessive than the formant filter we talk about.
The problem is to control preciselly  the wideness and the amplitude of the formant.

Xavier

matrix12x:
Sound on Sound has an article on this in the analog realm. http://www.soundonsound.com/sos/mar01/articles/synthsec.asp

and provides a table with the center frequencies for different formants for a man:

VOWEL SOUND AS IN... F1 F2 F3
"ee" leap 270 2300 3000
"oo" loop 300 870 2250
"i" lip 400 2000 2550
"e" let 530 1850 2500
"u" lug 640 1200 2400
"a" lap 660 1700 2400

Then they go on to discuss amplitude and the width or Q of the band pass filters. They state that the bandwidth for the filters for a man's formants are around 100Hz wide and a woman's are slightly wider.

I have seen something like this with the Freq of one or more of these BPFs ever so slightly modulated by a LFO.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version