|
|||||||
| Home | Forums | Rules | Articles | Store | Gallery | Blogs | Register | Donations | FAQ | Calendar | Search | Today's Posts | Mark Forums Read | Search |
| Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc. |
|
|
Please consider donating to help us continue to serve you.
Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#111 | |
|
diyAudio Member
Join Date: Nov 2007
|
Quote:
I'm not too well read in DSP so I can't answer your other questions. For learning, I'd suggest Octave, which is the open-source equivalent of Matlab. You should be able to run WAV files through a filter treatment and play them back without too much trouble. |
|
|
|
|
#112 | |||
|
diyAudio Member
Join Date: Mar 2003
Location: Southwest, UK / York, UK / Edinburgh, UK
|
Quote:
Quote:
Quote:
I think the thing to remember is that it's all conceptual. When multiplying two B-bit numbers in two's-complement format, you're going to end up with a result which is 2B bits long. All architectures calculate this double-length result internally, and the bit-pattern will be the same regardless of whether the inputs are integer or have some decimal point in them somewhere. Whether you get an integer or a fractional value overall just depends on whether you take the bottom-half or the top-half, respectively, of this long result as your output.
__________________
Wingfeather |
|||
|
|
|
#113 |
|
diyAudio Member
Join Date: Aug 2003
Location: Santa Cruz, California
|
Also recall that q15 represents numbers between -1.0 and 0.999..., so that multiplier results must also represent correct numbers in that format.
For example, consider 1/2 in q15 = 0x4000. Multiply by 1/2, you get 0x10000000, and taking the top 16 bits as your q15 representation means the 0x1000 converts to 1/8 instead of 1/4! What happened? Well, it turns out multiplying a 1.15 number by another 1.15 number generates a 2.30 number, which means the result is shifted to the right by 1 with respect to the proper result for a 1.31 number (which you would truncate to 1.15). So the proper thing to do after the multiplier is to shift the result left by 1 before truncation. Try it for yourself. |
|
|
|
#114 |
|
diyAudio Member
Join Date: Jul 2005
Location: Devon
|
Hi, DSP_Geek,
I understand the need for the shift / taking the 16 bits directly (ignoring the MSB). I'm still a bit hazy at times because I get confused by Windoze calculator, but if I'm programming things in Verilog I know what I'm "asking" the software to do to the bits directly. (if that makes sense! )My main hurdle was understanding the concept of how Q15 numbers work and what Q format really is.... Many people / web sites just say something like: "The binary point is effectively moved during calculation", whereas I like to think of it as "Magnifying the original (real) value to bring it towards the binary point during calculation". In reality, what you're doing is magnifying the original (real) values beforehand, then reducing them again after the result. This makes best use of the 16 bit resolution (well, 15 bits + sign) and also "allows" the maths work correctly using the usual integer binary multipliers etc. (The only extra logic you really need to add for Q15 multiplies is for taking the top 16 bits of the Q30 result.) So, as long as you take the top 16 bits and ignore the MSB of the multiplied result, it should all work. ie. the full 32-bit result of 0x4000 (0.5) multiplied by itself is.... 0001 0000 0000 0000 0000 0000 0000 0000 Take the top bits (ignoring MSB), or shift to the left by 1 bit first.... = 001 0000 0000 0000 0 = 0x2000 (hex result) = 0.25 (real number) Again, this is somewhat confused by the fact that taking the top bits is not actually producing your "real-world" (original) value. The reason for taking the top bits is only to convert the Q30 result back to Q15 format again. You have to do this because when the multiply occurs with two Q15 values, the Q15 "scaling factor" (32768) also gets multiplied at the same time. I hope this is mostly correct. Again, this is only my understanding of it so far, and I'm posting this from a definite learners point of view (I'm NO expert!) I've actually got a nice DSP board on the way to me now (TMS320C6711 DSK). I'll try to get some long filters running on that first, then hopefully I can come back to the FPGA stuff with a better understanding. The FPGA design is actually producing results now though (with a very short FIR). OzOnE. P.S. I now have a nice Mauro RevC stereo kit built with a 300VA toroid and Twisted Pear PCBs !!! For anyone wondering about power output from these little LM3886 chips - it easily beats my Denon AVC-A11SR for sheer dynamics and output (before clipping). The Denon is rated at 125 Watts RMS into 8 ohms (20hz-20KHz), so the RevC amp must be doing some sort of voodoo, or just shows that it's much better designed? |
|
|
|
#115 |
|
diyAudio Member
Join Date: Jul 2005
Location: Devon
|
(I tried to change the above post, but the evil 30 minute rule kicked in.)....
Corrections - "Scaling the original (real) value to best fit your 15 fixed bits." + "and also allows you to "keep" the same multiplier logic as you were using for integers." New - OK, so some Q format "prerequisites" are: 1. Convert all your original coeffs to fractional values (confine to between -1 and 1 to help prevent overflow of final results)... 2. Convert these fractions to Q15 format by multiplying by 32768 (will loose a small amount of precision when fit into 15 bits) 3. When two Q15 values are multiplied, take the top 16 bits of the 32-bit result (ignore extended sign / MSB). You don't necessarily have to "see" the real coeff values at all during the processing inside the DSP, you just keep them in Q15 right the way through. If you need to see or check the real values again, just divide the Q15 value by 32768. (for an example; you would normally only see the real coeff values when you initially generate your filter taps on the PC.) I now also get the point about the audio samples - because they are (usually) already confined to a 16-bit signed number (15-bits + sign), they can generally be thought of as already "being in" Q15 format. Because of this you can process them with Q15 methods (as long as it doesn't introduce things like large DC offsets or clipping at the output etc.) OzOnE. |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free Digital Room Correction And PC based Xover | kipman725 | Multi-Way | 3 | 7th August 2009 12:13 PM |
| Digital Room Correction and Foobar2000 Convolve | mr.duck | Digital Line Level | 1 | 23rd June 2009 04:49 PM |
| Audyssey MultEQ XT Digital Room Correction | wigginjs | Multi-Way | 37 | 24th February 2008 06:10 PM |
| I need help with digital Room-correction | Radian | Multi-Way | 1 | 7th February 2007 07:10 PM |
| New To Site? | Need Help? |