Forums

Spectral Shaping in freq. domain for audio input

Started by aaab December 6, 2012
Hi all, 

I have a digital audio signal sampled at 20000 Hz. I would like to increase
the amplitude by two of certain freq. components, which are from 1100 Hz to
1540 Hz. This is to be done in the Frequency domain using Matlab code.
However I am getting artefacts especially at the window edges. Please
advice as to what am I doing wrong in the following steps:

1. Identify the frequency bins that correspond to 1100 Hz to 1540 Hz. 
2. Window the input signal by 1001 sample Hanning window. 
3. Window the input signal by 1001 sample Hanning window with 50% offset. 
4. The data after windowing is zero padded to 1024 samples.
5. The 1024 point FFT of data from first window is computed. 
6. The 1024 point FFT of data from second window is computed. 
7. The bins corresponding to 1100 Hz to 1540 Hz are increased by a factor
of two. (Simply the complex bin values are multiplied by two.)
8. IFFT of freq. spectra (after amplitude multiplication of FFT bins) is
done. 
9. Only the first 1001 samples from IFFT is taken to obtain data. 
10. The output from the two windows are added. 
11. Added result saved in .wav file. 

No windowing is done after IFFT. 
Any help will be great! 
Thanks in advance, 
AV.


For transform-domain processing, the transform must be padded to at least M+N-1, where M is the length of the data segment to be processed and N is the length of the impulse response of the filter.

Your frequency domain filter is "1" everywhere except at the bins corresponding to the interval between 1100 Hz and 1540 Hz, where it is "2" -- that region where the gain is "2" is a rectangle in the frequency domain. Think about the duration of the impulse response of a rectangular window, and how much zero-padding you'll need to accommodate it.
"aaab" <52020@dsprelated> wrote in message 
news:zaSdne7NOfiJGl3NnZ2dnUVZ_oednZ2d@giganews.com...
> Hi all, > > I have a digital audio signal sampled at 20000 Hz. I would like to > increase > the amplitude by two of certain freq. components, which are from 1100 Hz > to > 1540 Hz. This is to be done in the Frequency domain using Matlab code. > However I am getting artefacts especially at the window edges. Please > advice as to what am I doing wrong in the following steps: > > 1. Identify the frequency bins that correspond to 1100 Hz to 1540 Hz. > 2. Window the input signal by 1001 sample Hanning window. > 3. Window the input signal by 1001 sample Hanning window with 50% offset. > 4. The data after windowing is zero padded to 1024 samples. > 5. The 1024 point FFT of data from first window is computed. > 6. The 1024 point FFT of data from second window is computed. > 7. The bins corresponding to 1100 Hz to 1540 Hz are increased by a factor > of two. (Simply the complex bin values are multiplied by two.) > 8. IFFT of freq. spectra (after amplitude multiplication of FFT bins) is > done. > 9. Only the first 1001 samples from IFFT is taken to obtain data. > 10. The output from the two windows are added. > 11. Added result saved in .wav file. > > No windowing is done after IFFT. > Any help will be great! > Thanks in advance, > AV. > >
i'm glad that Vlad was gentle with aaab.

On 12/6/12 8:26 AM, Greg Berchin wrote:
> For transform-domain processing, the transform must be padded to at least M+N-1, where M is the length of the data segment to be processed and N is the length of the impulse response of the filter. > > Your frequency domain filter is "1" everywhere except at the bins corresponding to the interval between 1100 Hz and 1540 Hz, where it is "2" -- that region where the gain is "2" is a rectangle in the frequency domain. Think about the duration of the impulse response of a rectangular window, and how much zero-padding you'll need to accommodate it.
just to be more explicit, the technique you want to look up (say, in Oppenhiem & Schafer) is called either "Overlap-Add" or "Overlap-Save", but recently i saw a better term for the latter called "Overlap-Scrap". i guess all of this comes under the rubric of "Fast Convolution". whether or not you want "fast" or not, this is essentially what you're trying to do. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Hi all, 

Thanks to all for your suggestions. 
While I am working towards the solution, I am somehow unable to 
see Vladimir's message. Vladimir, can you please re-send your message. 

Regards,
AV.



>i'm glad that Vlad was gentle with aaab. > >On 12/6/12 8:26 AM, Greg Berchin wrote: >> For transform-domain processing, the transform must be padded to at
least M+N-1, where M is the length of the data segment to be processed and N is the length of the impulse response of the filter.
>> >> Your frequency domain filter is "1" everywhere except at the bins
corresponding to the interval between 1100 Hz and 1540 Hz, where it is "2" -- that region where the gain is "2" is a rectangle in the frequency domain. Think about the duration of the impulse response of a rectangular window, and how much zero-padding you'll need to accommodate it.
> >just to be more explicit, the technique you want to look up (say, in >Oppenhiem & Schafer) is called either "Overlap-Add" or "Overlap-Save", >but recently i saw a better term for the latter called "Overlap-Scrap". > >i guess all of this comes under the rubric of "Fast Convolution". >whether or not you want "fast" or not, this is essentially what you're >trying to do. > > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
Hi all, 

I have been able to identify and mistake and resolve it. 
Thanks a lot for your advice and suggestions. Thanks to this comp.dsp 
platform as well. 

My mistake was that I was taking the hanning window and also taking another

complement hanning window obtained as newhann = 1- hann(1024);

Instead of this I needed to use the same hanning window, for all
operations. The data pointer needed to be shifted by offset percentage 
which in this case is 50% which gives 512 data samples ( = 0.5 * 1024 ). 
After IFFT overlap add is used. 

Regards,
Abeezar Vasi.



>Hi all, > >Thanks to all for your suggestions. >While I am working towards the solution, I am somehow unable to >see Vladimir's message. Vladimir, can you please re-send your message. > >Regards, >AV. > > > >>i'm glad that Vlad was gentle with aaab. >> >>On 12/6/12 8:26 AM, Greg Berchin wrote: >>> For transform-domain processing, the transform must be padded to at >least M+N-1, where M is the length of the data segment to be processed
and
>N is the length of the impulse response of the filter. >>> >>> Your frequency domain filter is "1" everywhere except at the bins >corresponding to the interval between 1100 Hz and 1540 Hz, where it is
"2"
>-- that region where the gain is "2" is a rectangle in the frequency >domain. Think about the duration of the impulse response of a rectangular >window, and how much zero-padding you'll need to accommodate it. >> >>just to be more explicit, the technique you want to look up (say, in >>Oppenhiem & Schafer) is called either "Overlap-Add" or "Overlap-Save", >>but recently i saw a better term for the latter called "Overlap-Scrap". >> >>i guess all of this comes under the rubric of "Fast Convolution". >>whether or not you want "fast" or not, this is essentially what you're >>trying to do. >> >> >>-- >> >>r b-j rbj@audioimagination.com >> >>"Imagination is more important than knowledge." >> >> >> >