06-22-2007 02:28 PM
06-22-2007 03:09 PM
Riot, are you saying you want to
1) see the string of 0's/1's associated with 0.8125, or
2) make a new reference system where (for example) 0010=
0*.8125^3 + 0*.8125^2 + 1*.8125^1 + 0*.8125^0
06-22-2007 05:53 PM
06-22-2007 06:33 PM
06-25-2007 12:08 AM
Hi, it’s me again!!!
Ok , i’ve been asked to create a program (using Labview, of course) that tries to simulate a pcm- am modulation. What I have to do is work wih a .wav file ( I already did this ,and acquired 3 seg) .
I defined 16 levels ( my quantizing levels). When I acquired this 3seg ( now in .wav format) I noticed that the upper and lower limits were 1 and -1 ,correspondingly. I read this from the wave form graph.
Every level has a width of 0.125( I calculated this using a formula, since I’ll be using just four bits for representing each of the quantizing levels. Width=2/(2^4)=0.125 ).
Maybe doing this just makes no sense( since Labview already sampled the 3 voice-second and saved it as a wav file) am doing this just for academical purposes, as a final project for my DPS course .
In this program I tried to implement the ‘In Range and Coerce’ function that you previously recommended me (great tip!) and i also used a Boolean Array for representing (coding) each of the 16 quantized levels.
I decided to use just 4 bits, the idea is that every time that a sample lies within a particular quantized level this sample will be represented through the code I defined ( sample 0.624 lies in level 12 and the code for this level is 1100; I write this just as an example) so from now on the sample of magnitude 0.624 would be represented by 1100
Ok this is for the pcm part……For the AM modulation part I need to multiply my coded samples with a sine wave ,that would be used as the Carrier( just for simulating we are sending the data to a far place, where the signal will be demodulated and ,of course, decoded so finally we get the original signal, that would be my 3 voice second).
That’s why ,I think, I should convert the Boolean array into a 0’s and 1’s array, (to an array of numbers) since, I think, you can not multiply an array of booleans with an array of numbers!!
Ok basically, i am using the”Coerce “ function to activate the case structure so the array o Booleans be activated and then be converted into a 4 length array of 4 elements(containing the specific code for the particular quantized level)
…..The thing is that I should be able to save all this arrays every time that the coerce function detects that one of my samples lay in one of my quantized levels……..
lets say, for example, that 144 of my 96000 samples are between 0.5 and .625 so I should be able to keep record of this 144 samples but not with its magnitude but represented now through the four digit code …and I just don’t know how to do it,
i need something like “An array of arrays” so I can make difference between the different samples, now represented through the 4 bit code I defined …any ideas!!!!
06-25-2007 10:41 AM
Another option is manipulate your array index output data into an integer (multiply by 1000, for example) and input into a single case structure. Case structures can accept ranges, but not decimals. Then set a range for -875..-749 (instead of your -0.875..-0.75) and have 16 cases, each with your array output linked to the index as described above. This is also in the attached VI.
Final result should be an array of 4 col. and n rows, where n is the number of samples you took. The index will be in time order, too. As long as you multiply your wave by this index at the same rate at which you sampled, you should be fine.
06-25-2007 11:32 AM
Hi Riot,
I made some changes to your program to handle the data as a string converted later to a bipolar pulse train ready to be modulated. This example is simplified to a 2 bit quantization.
I hope it might be useful
06-25-2007 03:43 PM
Riot,
I am not sure you need to use the in range and coerce look-up tables at all. Take a look at the attached VI. I take a sample waveform find its min and max to compute the quantum. I then simply use the Quotient & remainder function to get the quotient. So I have converted the value to a level. By then converting it to a U8 you basically have your levels in binary. In this case the lowest level is 0, next is 1 (0001), then 2 (0010) etc. If you need the lowest level to not =0 then a lookup table or some simple subtraction may fix the levels.
I then multiply it by a sine wave like you had asked and I believe that shows the signal you where hoping for. Notice I also plotted it on a digital graph so you can look at that as well.
06-25-2007 03:56 PM
06-25-2007 04:06 PM