Visual dsp

Discussion in 'Mac Programming' started by onqun, Nov 15, 2008.

  1. onqun macrumors member

    Oct 13, 2006
    Hello guys, As final project, I want say say something to microphone and it will be ehard from the left speaker and it will go to the right speaker not immediately, assume a car it moves from left to right.

    in my process data, i wrote a function which will decrease the left speaker's volume while right speaker's volume increasing. however, it has a problem with incrementing. I also have doubts as well, because i still could not figure out that whether, this for function will move very fast, so i her the voice very fast, so i want to also put a timer. so i can control the cars speed.( my voices) while moving left to right.

    if some one help me i would be glad. thanks alot

    process data;

    #include "Talkthrough.h"
    #include "math.h"
    void Process_Data(void)

    iChannel0LeftOut = iChannel0LeftIn;
    iChannel0RightOut = iChannel0RightIn;
    iChannel1LeftOut = iChannel1LeftIn;
    iChannel1RightOut = iChannel1RightIn;

    void bounce(void)

    int y;
    float gl;
    float gr;
    float Leftin;
    float Leftout;
    float Rightin;
    float Rightout;
    float Rightout1;
    float Leftout1;
    float Rightout2;
    float Leftout2;



    for(y=-90; y<=90; y+=1)

    gl=( (sin(90)*cos(y)+sin(y)*cos(90)) / (2*sin(90)*cos(y)) );
    for(x=gl; x<=gl; x+=1)

    iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];
    iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];





    the think is the delay part is not configured yet, however the for function is not working, i believe there is a problem with incrementing .
  2. Sander macrumors 6502

    Apr 24, 2008
    I see a bunch of strange things in your code.

    First of all, the normal sin() and cos() functions take radians, not degrees. It looks like you're assuming degrees, seeing as you're using all those -90..+90 things in there.

    Also, the for() loops don't make any sense to me. For each y, you calculate a certain gl value, and then perform a loop:

    for (x = gl; x <= gl; x += 1)
        gr = 1 - gl;
    Are you sure this is what you mean..? Looks like this loop is always executed precisely once.

Share This Page