LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

can anybody help with some subtleties to this code?

Hello,

I was wondering if anyone could take a look at the code in general for me, which is to go in an 'effects' pedal.  The first while loop is for a footswitch that either reads high or low.  It controls the mode of the pedal.  the first mode is the default, where no signal manipulation occurs, and what comes in the audio input just comes out; the second mode stores data (fundamental frequency, average FFT amplitude from 3 kHz to 5 kHz) from the E string of a guitar, which is plucked after that mode is actuated; the third mode does the same for the A string; and the final mode takes in a note on the E or string, recognizes it as either on the E or A string, and adjusts the frequency content to be in tune based the data stored in modes 2 and 3.  then the new magnitude vector is put through an inverse FFT and output through the DAC and sounded.

What I'm curious to know is, are there any blatant errors I've made?  Will the signal coming out of the inverse FFT be sounded through the DAC? does it need to be changed from a double to an I32?  I am trying to debug, but right now I'm having problems getting the correct output voltages on the Blackfin (the SPORT 0 pinout doesn't seem to match what is on the board....).

also, I was wondering if I will lose any phase information on the signal that I get out compared to the signal I put in.  Will it be detectable by ear?  Or would it all sound the same?  along with the phase change for some signals, using an inverse FFT resulted in a loss of amplitude (from about 1 to on the order of 10^-5.  that's a lot!).  but when the test program was played on my computer, the phase change was not noticeable from the output signal, and neither was the magnitude change!  the output played at the same volume as in the input, despite the waveform chart on the front panel showing an amplitude five orders of magnitude less!  can you help explain that to me?  what can I do, will it matter coming out of the Blackfin and into an amplifier?

i appreciate any input anyone can give me on all this!!  thank you!!
0 Kudos
Message 1 of 3
(6,035 Views)

Hi noahgrant,

 

Maybe someone from the community can comment on your code.

For linking purposes, this is the original thread for this issue.

 

Regards,

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 3
(6,020 Views)

Hi noahgrant,

 

I've had a look at your vi and can make some suggestions that you can try.

 

From what I can see, your while loop with the wait timer of 100 ms and continue if true condition on it (we shall cool this loop 1) will always keep running.

 

The other while loop (loop 2) is nested within a couple of case structures and will only run once (false to a continue if true condition). The default case has a different condition and will always run, instead.

 

From what I can make of this, loop 2 and all its case structures will only run once (except for case 0, default). WHEN it runs will depend on how it was compiled on the Blackfin - case structure/loop2 may go first or loop 1 will go first.

 

If you want loop 2 to go first (and only go once) then you need to link the output of the case structure to the input of loop 1 - this can be done by simply wiring up a boolean to it (data flow rules).

 

If you want loop 2 to always be checking the status of the mode then you need to place the whole case structure within a while loop, to run continuously.

 

That is a very quick interpretation of what you are trying to do. There are a lot of question marks (missing vi's) and some heavy use of local variables. I would consider using sub-vi's, in particular functional global variables (FGV's).

 

I hope that helps.

 

 

0 Kudos
Message 3 of 3
(5,917 Views)