LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i correct this?

Hi
 
i have an X number of arrays (256 samples each) that represent a speech signal broken down into this X number arrays. I have also another array of Y elements that each element represents the pitch period length (in samples) of each of the arrays mentioned earlier, therefore X=Y.
 
I would like the arrays (of 256 samples length) when they are represented by a pitch period other than zero, to be broken down into pieces/subarrays of length equal to that of their pitch period. i.e to break down the 256 array into subarrays of 64,64,64,64 samples if that array's pitch period length was 64 samples.
 i tried to do that but i am able to get only the very first subarray. they should be repeated but i couldnt do it.
 
Could somebody take a look at my code and maybe tell me where im wrong?Any help is appreciated.
 
Cheers
Download All
0 Kudos
Message 1 of 9
(3,465 Views)
Your FOR loop dies not do anyting except taking the same subset over and over again, a total of N times. Right? If you want all the subsets, you need to do two things:
  1. Increment the offset with each iteration by the lenght of the subset. Conveniently done my multiplying with [i]. See Image.
  2. Enabling autoindexing at the output tunnel so you keep all the slices in a 2D array. Now you can use index array to get each slice as needed.

Of course the same operation can be done in one simple operation using "reshape array" from the array palette. Check the online help. No loop needed at all!.


Your VI is also full of race conditions that can bite you due to abuse of local variables. Have a look at the image below. Your code does not guarantee that the local variable is read only after the corresponding terminal has received current data. There is a 50% change that you read a stale value! Dataflow can ensure proper execution order very easily. Just use wires instead of local variables and all parts of the code are immediately guaranteed to receive the correct and current value. Makes sense?

Message Edited by altenbach on 03-17-2007 07:29 PM

Download All
0 Kudos
Message 2 of 9
(3,447 Views)
thank you altenbach
 
i will do the changes you suggesting
0 Kudos
Message 3 of 9
(3,443 Views)
Altenbach
 
The other case though (True), the input is 1-D array and the output of the False case is a 2-D array. What can i do for that?
0 Kudos
Message 4 of 9
(3,439 Views)
Insert a "built array" node, resized to a single input. This will change a 1D array with N elements into a 2D array containing 1 row and N columns.
 
(Most likely, you can just wire it up with a broken wire, then right-click on the broken wire. One of the options to fix it is "insert built array". Just do it! :))
Message 5 of 9
(3,434 Views)
Altenbach
 
Thats what i needed. thank you for all your help
0 Kudos
Message 6 of 9
(3,432 Views)

Altenbach or anyone else, something more

is it possible to get adjacent arrays and break them down to a mean pitch period of them instead of taking each array and segmenting it alone according to its period?

i mean if i have lets say 4 adjacent arrays of 256 samples each and they have a mean period of 64 samples, is it possible to break these 4 arrays to pieces of 64 samples each?

 

0 Kudos
Message 7 of 9
(3,406 Views)


@madgreek wrote:

i mean if i have lets say 4 adjacent arrays of 256 samples each and they have a mean period of 64 samples, is it possible to break these 4 arrays to pieces of 64 samples each?

 



hi madgreek,

It IS possible to break these 4 arrays to pieces of 64 samples each.

Try using Decimate Array function from the Array palette & see if it fits Ur requirement.

Else, use the Index Array function & wire four indices as 0, 63, 125, 189 to split it into 4 pieces of 64 elements each.

- Partha ( CLD until Oct 2027 🙂 )
Message 8 of 9
(3,387 Views)
thank you. i will try that
0 Kudos
Message 9 of 9
(3,382 Views)