Home |
Search |
Today's Posts |
#41
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Marc Wielage wrote:
Yes, this brings back memories of the 1980s with Ultra-Stereo, which I believe was Jack Cashin's attempt to get around Dolby's patents and creating a compatible (and much cheaper) matrixed surround system with a similar noise-reduction encoding. I believe engineer John Mosely was also a consultant for the company; Mosely had previously worked on Quintaphonic sound in the mid-1970s. Interestingly, Dolby could not patent the surround encoding itself, but did patent the noise reduction encoding (either Type A or Type B, depending on the release format), which Ultra Stereo had to mimic for their release prints. I used Ultra Stereo a few times in mastering, and it actually worked OK. Right. The Ultra Stereo decoders did the matrix properly (and Dolby could not patent it because there was an outrageous amount of prior art going back to Blumlein by way of Sanyo) but they just used a low-pass filter instead of the Dolby NR decoder. I never used any of their encoders but I bet they did something similar with a little emphasis. Kintek did just that. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#42
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Sean Conolly wrote:
wrote in message ... hank alrich: "It's a fine line between clever and stupid. I think you've crossed it. " - show quoted text - Keep your closed-minded remarks to yourself! At least others here have suggested ways to accomplish it or emulate it. Q. Why would anyone want to reinvent the wheel? A. Because it's fun, and you can learn something from it. Sticking with the example, think for a minute about how you would go about making a wheel if you were in the woods with nothing but an axe. Sean Better yet, invent an axe. -- shut up and play your guitar * http://hankalrich.com/ http://www.youtube.com/walkinaymusic http://www.sonicbids.com/HankandShaidri |
#43
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Scott Dorsey wrote:
Les Cargill wrote: hank alrich wrote: Scott Dorsey wrote: Go to film-tech.com. Download the Dolby CP-50 manual. Look at the phase shift networks on the Cat 146/150 card. Build the same networks in reverse for encoding. Sounds tricky. Y'know, if I'd practiced more, maybe I would have had to know all this. In the late eighties this sort of thing was all the rage. Everybody wanted to make their own matrix surround tracks and nobody wanted to pay Dolby the licensing fee for the encoder. There were lots of aftermarket fake Dolby encoders sold, and a lot of homebrews. But now we have 5.1 and nobody much bothers with any of that junk except as an afterthought for the occasional film optical track. So, it's sort of like the Phil Collins Drum Sound in that regard... --scott Gotcha. So I should put an Auratone in a clean, empty garbage can, along with a array of Radioshack omnis and go for it. -- shut up and play your guitar * http://hankalrich.com/ http://www.youtube.com/walkinaymusic http://www.sonicbids.com/HankandShaidri |
#44
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Scott Dorsey wrote:
wrote: Go to film-tech.com. =A0Download the Dolby CP-50 manual. =A0Look at the=20 phase shift networks on the Cat 146/150 card. =A0 Build the same networks= =20 in reverse for encoding.=20 - show quoted text - Sorry Scott - Resource not found! Actually the filters are just below 100H= z and above 7kHz. I can do that in Audacity. Okay, class! Everybody pick up your keyboard and go to this url! Yes, you have to start the browser and type it in on the top line. Type http://www.film-tech.com all the way. Yes, you have to type it all out. Now, wait for the page to load and click on WAREHOUSE up at the top. Do you see WAREHOUSE? Now, click on MANUALS... does everybody see MANUALS? That's where the manuals are stored... --scott I'm sorry. I was looking for "WHEELS", to see if there was prior art. -- shut up and play your guitar * http://hankalrich.com/ http://www.youtube.com/walkinaymusic http://www.sonicbids.com/HankandShaidri |
#45
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
недеља, 29. јул 2012. 05.06.39 UTC+2, Les Cargill је написао/ла:
Luxey wrote: To clarify my thinking, seams if you apply function twice it does nos shift signal in phase for 180deg, but rather reverses it. When the Hilbert transform is applied twice in succession to a function u, the result is negative u: H(H(u))(t) = -u(t), provided the integrals defining both iterations converge in a suitable sense. In particular, the inverse transform is H. http://en.wikipedia.org/wiki/Hilbert_transform -- Les Cargill Oh, well. Ok. So, after Fourier decomposing to sine waves, it shifts each sine separately and exactly? Cool. |
#46
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
I don't think matrix surround has any point today,
in the face of so many ways of discrete surround mixing and digital release formats. To the best of my knowledge, there is no discrete format for DVDs -- or CDs, for that matter. As long as DVDs are sold, there will be a need for matrixing. Surround encoding can be useful for stereo recordings that aren't intended for surround playback. For example, Ambisonic UHJ encoding produces a stereo mix that, when blended to mono, has only about +/- 1dB variation in level for any mix component. This is a big improvement over a conventional mix, where components panned dead-center are bumped up 6dB in mono playback. |
#47
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Mike Rivers wrote:
On 7/28/2012 11:20 PM, Scott Dorsey wrote: You can't do a Hilbert transform directly in the analogue domain. You can only use some functions that approximate it, made with Ls and Cs. Yeah, that's the problem with theory. It's different from practice. It's not theoretical if it doesn't have to be in real time with an analog source. -- Les Cargill |
#48
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
William Sommerwerck wrote:
I don't think matrix surround has any point today, in the face of so many ways of discrete surround mixing and digital release formats. To the best of my knowledge, there is no discrete format for DVDs -- or CDs, for that matter. As long as DVDs are sold, there will be a need for matrixing. What about dts and Dolby Digital? --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#49
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
There's a lot of bad information in this thread, sorry to say.
Let's break it down: Analog phase shifts 2 parallel banks of all analog pass filters can produce 90 degree phase shifts over wide frequency ranges down to fractions of a degree. There are optimization routines you can use to set the pole/zero frequencies. You can't go all the way to DC obviously, and if you try you will end up with very high order filters, but 20 hz is an achievable goal. The lower you go in frequency the more filter sections you will need and these filters may have a very long impulse response which may become audible. You can use either 1st or 2nd order filters, and an analog all pass can be done with 1 op-amp per 2nd order section. No L's or C's required, just a few R's and C's and opamps. If you plot the phase shift from the input to each of the two outputs you will see that the difference is very close to 90 degrees, but the individual phase responses will accumulate to quite a large phase shift at higher frequencies. You can make valid arguments that this may be audible, I think, even though the amplitude response is dead flat by construction. Digital phase shifts There are 2 ways to do this digitally 1) fir halbert transform filters. These filters are anti symmetric and therefore have perfect 90 degree phase characteristics, with an amplitude ripple determined by how the filter is designed. In order to make these "causal" you need to shift them by half the filter length and use a delay in the other path. In other words, you end up with 2 branches, an fir filter in 1 path and a delay in the other. The drawback of this approach is that if you want to maintain 90 degree phase shift all the way down to 20 hz the filter length will be huge and therefore require a lot of MIPS. Note that by definition an anti symmetric filter has 0 response at dc. 2) parallel all pass sections just like the analog case above. In the analog case we had a limitation that you can't get 90 degree phase shift at dc, and for the digital version there is another restriction that you can't get 90 degree phase shift at half the sample rate, and the closer to get to DC or fs/2 the more filter sections you will need, resulting in long impulse responses that may become audible. In general there are no out-of-the-box algorithms that design these filters, so you will need to master an optimization algorithm, or use the ones built in to the matlab control systems toolbox, assuming you have the luxury of owning said tool (Scilab may have an equivalent, I don't know for sure) Bob Adams |
#51
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
wrote:
In general there are no out-of-the-box algorithms that design these filters= , so you will need to master an optimization algorithm, or use the ones bui= lt in to the matlab control systems toolbox, assuming you have the luxury o= f owning said tool (Scilab may have an equivalent, I don't know for sure) The optimization algorithm is just successive approximation. Sit down with a desk calculator and plug and chug. Matlab will do it nicely, but it will take you more time to figure out their functions than to just do it by hand. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#52
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill wrote:
Octave is a free alternative to Matlab that runs most Matlab scripts. http://www.gnu.org/software/octave/ It works very, very well, and it's basically like Matlab 5 was fifteen years ago (except the graphics aren't so good). However, a lot of what makes Matlab what it is today are the toolkits and a lot of the toolkit functions haven't get been duplicated. Not that you couldn't code a binary search algorithm in an afternoon but it seems like a lot of work for a single filter design. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#53
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Scott Dorsey wrote:
Les Cargill wrote: Octave is a free alternative to Matlab that runs most Matlab scripts. http://www.gnu.org/software/octave/ It works very, very well, and it's basically like Matlab 5 was fifteen years ago (except the graphics aren't so good). However, a lot of what makes Matlab what it is today are the toolkits and a lot of the toolkit functions haven't get been duplicated. Right. So the paid version is probably worth it. Not that you couldn't code a binary search algorithm in an afternoon but it seems like a lot of work for a single filter design. --scott Dunno - the version I have seems to support a lot of filter designs. I suppose it depends on which ones you're looking for. -- Les Cargill |
#54
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! This looks like a heck of a good reference about building all-pass netowrks: http://webpages.charter.net/wa1sov/t...s/allpass.html |
#55
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
"Arny Krueger" writes:
wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! Arny, As you know, shifting one specific sine wave by 90 degrees can be done by simply delaying by the appropriate amount, depending the frequency. The trick is to shift the entire frequency band, or a wide band of frequencies, by 90 degrees! Of course this is not a simple delay. Turns out, it is a thing called a "Hilbert transform." One can never build a perfect one (the closer you get to DC, the longer your filter's impulse response becomes) , and designing a good digital Hilbert transformer is not a trivial task. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#56
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates writes:
"Arny Krueger" writes: wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! Arny, As you know, shifting one specific sine wave by 90 degrees can be done by simply delaying by the appropriate amount, depending the frequency. The trick is to shift the entire frequency band, or a wide band of frequencies, by 90 degrees! Of course this is not a simple delay. Turns out, it is a thing called a "Hilbert transform." One can never build a perfect one (the closer you get to DC, the longer your filter's impulse response becomes) , and designing a good digital Hilbert transformer is not a trivial task. Sorry, I didn't see Bob Adams' post before I blurted this out - he already covered it. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#57
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:
"Arny Krueger" writes: wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! Arny, As you know, shifting one specific sine wave by 90 degrees can be done by simply delaying by the appropriate amount, depending the frequency. The trick is to shift the entire frequency band, or a wide band of frequencies, by 90 degrees! Of course this is not a simple delay. Turns out, it is a thing called a "Hilbert transform." One can never build a perfect one (the closer you get to DC, the longer your filter's impulse response becomes) , and designing a good digital Hilbert transformer is not a trivial task. For stored wave files ( relevant to this being r.a.p ) it's not trivial, but the meat of it is about 20 lines of 'C', once you get things into an FFT and can do an RFFT. -- Les Cargill |
#58
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
On 7/27/2012 11:06 PM, Les Cargill wrote:
wrote: I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! I have no idea how you do it in analog or in real time. But a Hilbert Transform will provide a very good 90 degree phase shift. I think that there are real time and analog versions of them; I only know how to do to in the not-real time way. As to the surround decoder - turn that off and do it stereo. People still know how to do that. -- Les Cargill Here are some analogue networks that will do a 90 degree shift over a wide spectrum: http://webpages.charter.net/wa1sov/t...s/allpass.html With all good wishes, Kevin. -- http://nationalvanguard.org/ http://kevinalfredstrom.com/ |
#59
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Nice reference, wish I had found that a long time ago!
On a side note, these long chains of allpass filters are often used for fake mono-to-stereo circuits. If you form the left output from (mono in + allpass out) and form the right output from (mono in - allpass out) then you get alternating peaks and dips in the left and right responses. The founder of dbx (Dave Blackmer) was mildly obsessed with these circuits at one point in his career and claimed that you needed a 12th-order allpass for optimal results! Bob |
#60
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
writes:
Nice reference, wish I had found that a long time ago! On a side note, these long chains of allpass filters are often used for fake mono-to-stereo circuits. If you form the left output from (mono in + allpass out) and form the right output from (mono in - allpass out) then you get alternating peaks and dips in the left and right responses. The founder of dbx (Dave Blackmer) was mildly obsessed with these circuits at one point in his career and claimed that you needed a 12th-order allpass for optimal results! Bob, was Dave Blackmer the one that went on to start THAT audio? I implemented a BTSC decoder which, as you probably know, was based on a spectral compander they designed. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#61
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
Randy Yates wrote: "Arny Krueger" writes: wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! Arny, As you know, shifting one specific sine wave by 90 degrees can be done by simply delaying by the appropriate amount, depending the frequency. The trick is to shift the entire frequency band, or a wide band of frequencies, by 90 degrees! Of course this is not a simple delay. Turns out, it is a thing called a "Hilbert transform." One can never build a perfect one (the closer you get to DC, the longer your filter's impulse response becomes) , and designing a good digital Hilbert transformer is not a trivial task. For stored wave files ( relevant to this being r.a.p ) it's not trivial, but the meat of it is about 20 lines of 'C', once you get things into an FFT and can do an RFFT. Les, Think of all the possible combinations you can create from 20 lines of C code! It's like that old joke about knowing where to kick the place-device-under-repair-here. From what I have heard, there are problems with doing an order-8M-sample FFT (i.e., an entire sound file at a time), e.g., twiddle factor quantization (even in floating point). And doing it block-wise requires the impulse response, so we're back to the filter design problem. Most of the time I have heard it implemented in the time domain as an FIR. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#62
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:
Les Cargill writes: Randy Yates wrote: "Arny Krueger" writes: wrote in message ... I'm guessing you all probably know why I need to create one of the above - to trick a Pro Logic Surround decoder. Problem is, I know what a 90 - and 180 - deg phase shift looks like on a pure sinewave, but how to I achieve 90 degrees phase shift on "real world" material - a clip of ducks quacking or a 1890s locomotive roaring by? There is no simple wave - ducks, trains, and of course music - are anything but simple! Arny, As you know, shifting one specific sine wave by 90 degrees can be done by simply delaying by the appropriate amount, depending the frequency. The trick is to shift the entire frequency band, or a wide band of frequencies, by 90 degrees! Of course this is not a simple delay. Turns out, it is a thing called a "Hilbert transform." One can never build a perfect one (the closer you get to DC, the longer your filter's impulse response becomes) , and designing a good digital Hilbert transformer is not a trivial task. For stored wave files ( relevant to this being r.a.p ) it's not trivial, but the meat of it is about 20 lines of 'C', once you get things into an FFT and can do an RFFT. Les, Think of all the possible combinations you can create from 20 lines of C code! It's like that old joke about knowing where to kick the place-device-under-repair-here. From what I have heard, there are problems with doing an order-8M-sample FFT (i.e., an entire sound file at a time), e.g., twiddle factor quantization (even in floating point). I have not seen that with FFTW + libsndfile on 16 bit files. I don't remember testing it on 24 bit files. But simply doing an fft and then an rfft gets the original back - as in "fc /b file1 file2" produces no result. And doing it block-wise requires the impulse response, so we're back to the filter design problem. Most of the time I have heard it implemented in the time domain as an FIR. it actually works quite well - only tested on 16 bit for now. 24 bit is a bit inconvenient for reasons I won't bore you with, but I really should try it... https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com -- Les Cargill |
#63
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
[...] https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. 1. This is a Stockwell transform, not a Hilbert transform. 2. It's way more than 10 lines of code. 3. Line 119 is a comment. (Apparently the Stockwell transform is a form of short-term Fourier Transform.) -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#64
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:
Les Cargill writes: [...] https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. 1. This is a Stockwell transform, not a Hilbert transform. 2. It's way more than 10 lines of code. 3. Line 119 is a comment. (Apparently the Stockwell transform is a form of short-term Fourier Transform.) "Starts at line 119. Okay, *ten* lines then. " The Hilbert transform is *after the comment block*. -- Les Cargill |
#65
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
Randy Yates wrote: Les Cargill writes: [...] https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. 1. This is a Stockwell transform, not a Hilbert transform. 2. It's way more than 10 lines of code. 3. Line 119 is a comment. (Apparently the Stockwell transform is a form of short-term Fourier Transform.) "Starts at line 119. Okay, *ten* lines then. " The Hilbert transform is *after the comment block*. This is not the Hilbert transform. Yes, the author calls it a Hilbert transform, but it's not; it's an analytic signal generator. The Hilbert transform is often used when performing time-domain processing to obtain an analytic signal, but in the frequency domain it's not necessary. That said, a true Hilbert transform would be only slightly different than those "10" lines of code. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#66
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
No, Dave Blackmer was the founder of dbx, but THAT corp was founded by a core of people from dbx when dbx was going under, including Les Tyler and Gary Hebert. They are still cranking out cool audio products more than 20 years later
|
#67
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
GEQ was suggested near the begining of the thread.
OP did not ask how to build all pass filter. This, crossposting, should be illegal. |
#68
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:
Les Cargill writes: Randy Yates wrote: Les Cargill writes: [...] https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. 1. This is a Stockwell transform, not a Hilbert transform. 2. It's way more than 10 lines of code. 3. Line 119 is a comment. (Apparently the Stockwell transform is a form of short-term Fourier Transform.) "Starts at line 119. Okay, *ten* lines then." The Hilbert transform is *after the comment block*. This is not the Hilbert transform. Yes, the author calls it a Hilbert transform, but it's not; it's an analytic signal generator. The Hilbert transform is often used when performing time-domain processing to obtain an analytic signal, but in the frequency domain it's not necessary. That said, a true Hilbert transform would be only slightly different than those "10" lines of code. Ah! Now I got your meaning. I agree. It does provide a 90 degree phase shift, and the way I was evaluating it can't tell from a true Hilbert transform. -- Les Cargill |
#69
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
Randy Yates wrote: Les Cargill writes: Randy Yates wrote: Les Cargill writes: [...] https://bitbucket.org/cleemesser/stockwelltransform/src/e9adf4f71e13/stockwell/st.c Starts at line 119. Okay, *ten* lines then. 1. This is a Stockwell transform, not a Hilbert transform. 2. It's way more than 10 lines of code. 3. Line 119 is a comment. (Apparently the Stockwell transform is a form of short-term Fourier Transform.) "Starts at line 119. Okay, *ten* lines then." The Hilbert transform is *after the comment block*. This is not the Hilbert transform. Yes, the author calls it a Hilbert transform, but it's not; it's an analytic signal generator. The Hilbert transform is often used when performing time-domain processing to obtain an analytic signal, but in the frequency domain it's not necessary. That said, a true Hilbert transform would be only slightly different than those "10" lines of code. Ah! Now I got your meaning. I agree. It does provide a 90 degree phase shift, and the way I was evaluating it can't tell from a true Hilbert transform. Les, It does not provide a 90-degree phase shift. It converts a real signal into an "analytic" signal, i.e., it removes the negative frequencies (and doubles the positive frequencies to make the total energy the same). Since the input signal is real, the negative frequencies in the FFT are redundant. (More specifically, the FFT of a real signal is Hermitian symmetric, i.e., F(k) = F*(K-k-1), where F* denotes the complex conjugate of F and K = N, the size of the FFT. Therefore you lose nothing if you zero out the negative frequencies. A consequence of this operation is that the output (inverse FFT) is then necessarily complex, by the properties of the DFT. I also made an error that it "would be only slightly different". It will be quite a bit different since the FFT results would need to be converted from rectangular to polar, the phase modified, then the result converted back to rectangular. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#70
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:
Les Cargill writes: snip I also made an error that it "would be only slightly different". It will be quite a bit different since the FFT results would need to be converted from rectangular to polar, the phase modified, then the result converted back to rectangular. I am very sorry Randy. I posted the wrong link. hangs head in shame *This* is claimed to be a Hilbert transform: void hilbert(double *samples, complex *z,int n) { int i; double temp; // assign the real sample chain to the real part of z assign(z,samples,n); fft(z,n); k=n/2; // zero the DC component of the positive and negative frequencies. z[0].real=0; z[0].imag=0; z[k].real=0; z[k].imag=0; for(i=1;ik;i++) { temp=z[i].real; z[i].real=-z[i].imag; z[i].imag=temp; } for(i=k+1;in;i++) { temp=-z[i].real; z[i].real=z[i].imag; z[i].imag=temp; } ifft(z,n); deassign(samples,z,n); } it also tests to be very much like one. Again.... OOPS! I had included the original formula as _hilbert() in my code ( to preserve it without using it - note the preceding underscore ) and the code in *this* post was in a routine named hilbert(); My code is some different, but the above excerpt illustrates things better. Stolen from http://www.vbforums.com/archive/index.php/t-639223.html -- Les Cargill |
#71
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
Randy Yates wrote: Les Cargill writes: snip I also made an error that it "would be only slightly different". It will be quite a bit different since the FFT results would need to be converted from rectangular to polar, the phase modified, then the result converted back to rectangular. I am very sorry Randy. I posted the wrong link. hangs head in shame Ha! I'd be a liar if I said I never did a similar thing. [i] *This* is claimed to be a Hilbert transform: void hilbert(double *samples, complex *z,int n) { int i; double temp; // assign the real sample chain to the real part of z assign(z,samples,n); fft(z,n); k=n/2; // zero the DC component of the positive and negative frequencies. z[0].real=0; z[0].imag=0; z[k].real=0; z[k].imag=0; for(i=1;ik;i++) { temp=z[i].real; z[i].real=-z[i].imag; z[i].imag=temp; } for(i=k+1;in;i++) { temp=-z[i].real; z[i].real=z[i].imag; z.imag=temp; } ifft(z,n); deassign(samples,z,n); } Yes, that looks pretty darned close. Except..., there aren't two DC's in the FFT output; the z[k].real = 0 and z[k].imag = 0 statements are wrong. Similarly, you should start the second loop at k, not k+1. Finally, this is the negative of the Hilbert transform. H(w) is -j for positive frequencies and +j for negative frequencies. it also tests to be very much like one. Again.... OOPS! I'll bet you have some frequency anomalies and/or residual imaginary components in the inverse FFT due to that incorrect zeroing. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#72
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Randy Yates wrote:[i]
Les Cargill writes: Randy Yates wrote: Les Cargill writes: snip I also made an error that it "would be only slightly different". It will be quite a bit different since the FFT results would need to be converted from rectangular to polar, the phase modified, then the result converted back to rectangular. I am very sorry Randy. I posted the wrong link. hangs head in shame Ha! I'd be a liar if I said I never did a similar thing. [i] *This* is claimed to be a Hilbert transform: void hilbert(double *samples, complex *z,int n) { int i; double temp; // assign the real sample chain to the real part of z assign(z,samples,n); fft(z,n); k=n/2; // zero the DC component of the positive and negative frequencies. z[0].real=0; z[0].imag=0; z[k].real=0; z[k].imag=0; for(i=1;ik;i++) { temp=z[i].real; z[i].real=-z[i].imag; z[i].imag=temp; } for(i=k+1;in;i++) { temp=-z[i].real; z[i].real=z.imag; z.imag=temp; } ifft(z,n); deassign(samples,z,n); } Yes, that looks pretty darned close. Except..., there aren't two DC's in the FFT output; the z[k].real = 0 and z[k].imag = 0 statements are wrong. Right. Similarly, you should start the second loop at k, not k+1. Finally, this is the negative of the Hilbert transform. H(w) is -j for positive frequencies and +j for negative frequencies. Good deal. Thanks. it also tests to be very much like one. Again.... OOPS! I'll bet you have some frequency anomalies and/or residual imaginary components in the inverse FFT due to that incorrect zeroing. Those don't show up so far in testing, so I'll revisit later on. -- Les Cargill |
#73
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
Les Cargill writes:
[...] Those don't show up so far in testing, so I'll revisit later on. Good luck, and have fun! -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com |
#74
Posted to rec.audio.pro
|
|||
|
|||
90degree phase shifts
|
Reply |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
weird pitch shifts... | Pro Audio | |||
Interesting reading min phase vs linear phase | Pro Audio | |||
until Henry shifts the districts neither, Jimmie won't breathe any incredible missions | Car Audio | |||
Phase 88 | Pro Audio | |||
In phase? | Pro Audio |