Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Implementing Band Stop Digital filter for audio wave using VC++

Status
Not open for further replies.

aneeshkm106

Newbie level 6
Joined
Jul 14, 2009
Messages
13
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
kochi
Activity points
1,380
I'm want to implement Band Stop Digital filter for audio wave using VC++.
For this Which FFT is good?
How can i manipulate audio samples?
What is the nature of samples?
When i tried ;the samples are of int type.For calculations using radix-2 fft these int values are converted to decimal-point values.Here is my doubt...While casting decimal-point to int some data lost.
Please help me ....
 

wav little endian canonical

Hello!

You want to use FFT to make a digital filter?
I don't think it's the way to go for audio, at least if you want a decent
S/N ratio.
The best way to implement a stop band filter for audio is a FIR filter.
Use Remez algorithm to calculate the coefficients and then convolve
the input with the coefficient set.

As for the samples, yes, usually they are in 16-bit (or 20) on CD.
Yes, there will be some loss of data, like in any digital (or analog)
signal processing stuff.

But you have to set your noise target and then choose the method. Not
the opposite. Concretely spoken, what is the maximal noise level you can
tolerate?

Dora.

aneeshkm106 said:
I'm want to implement Band Stop Digital filter for audio wave using VC++.
For this Which FFT is good?
How can i manipulate audio samples?
What is the nature of samples?
When i tried ;the samples are of int type.For calculations using radix-2 fft these int values are converted to decimal-point values.Here is my doubt...While casting decimal-point to int some data lost.
Please help me ....
 

digital filter

I did audio file reading as per wav format. I think samples are in little endian formate.
For manipulating samples how can i take each sample...?or Can we take it as bulk sample..? Here is my doubt...
Is it the correct method of taking each sample separately?
When taking wav samples what its nature?
I'm not sure about the noise level for hearing the wav sound clearly as possile.
Please help me..........
 

remez algorithm maximum taps

Hello!

What do you mean by "I did audio file reading as per wav format"? You mean
you played a wav file on your PC?
Yes, wav format is little endian.
You can find a link that explains the wav format .

What do you mean by bulk sample?

What do you mean by "what is its nature"?

A sample is simply a number that represents the signal value at sample time.
Sampling (and converting) is simply measuring at regular intervals. Usually
44100 Hz (CD), 48000(DAT), but also many other formats.
For instance if you measure at a sample rate of 10000 Hz a wave which is
exactly 1250Hz, you will have a sequence like this:
0, 23170, 32767, 32170, 0, -23170, -32767, -32170, 0, and so on.
(these are 16 bits values).

Now if you want to make a filter (I suppose it would be on a PC since you are
using wav files), then you have to convolve the input signal with the coefficient
set (which is logical because the coeff set is the pulse response of the FIR
filter). This is of course in the case you are using an FIR filter, what I would
highly recommend.

Dora.

aneeshkm106 said:
I did audio file reading as per wav format. I think samples are in little endian formate.
For manipulating samples how can i take each sample...?or Can we take it as bulk sample..? Here is my doubt...
Is it the correct method of taking each sample separately?
When taking wav samples what its nature?
I'm not sure about the noise level for hearing the wav sound clearly as possile.
Please help me..........
 

passband c language

I want to write code for cutting certain freq. from wav file only.

Reading wav file means as like binary file reading in c/c++ . not trying to play wav file.
I tried it using FFT .But reading and writting binary file(Wav file) as per Canonical Format. There is only this format
I tried this , but when i read Canonical Format from documents samples are in HEX values.
.First i convert HEX to DECI and manipulate using FFT radix-2 and then reconvert to HEX .
Then write it to file as Canonical Format.I suppose writing is correct .there is some doubt...
Becoz. avoiding FFT ,simply read + conversion +reconversion+ write..... resulting same file and sound.
Now i understood it is binary file . need not conversion.Simply take the samples as int
After adding FFT the file is noisy...
When read the samples one by one using array ,there is any problem with speed or anything fail?
I did this in windows programming(VC++).
Bulk reading means ,in windows programming any method for reading all sample at a time?
Please help me?
I'm a beginner...............
 

digital filter c++ code

Hello!

Sorry but I don't see clearly what you are trying to do. Let's restart: you want
to filter wav file with a stop band filter.

Why are you using an FFT? (I mean, if I have to filter a file, I would implement
a filter, not an FFT).
I know that you can do:
Input -> FFT -> frequency cut -> IFFT -> output
which is equivalent to a filter, but I think
Input -> filter -> output
is better and (depending on the filter), faster.

Dora.


aneeshkm106 said:
I want to write code for cutting certain freq. from wav file only.

Reading wav file means as like binary file reading in c/c++ . not trying to play wav file.
I tried it using FFT .But reading and writting binary file(Wav file) as per Canonical Format. There is only this format
I tried this , but when i read Canonical Format from documents samples are in HEX values.
.First i convert HEX to DECI and manipulate using FFT radix-2 and then reconvert to HEX .
Then write it to file as Canonical Format.I suppose writing is correct .there is some doubt...
Becoz. avoiding FFT ,simply read + conversion +reconversion+ write..... resulting same file and sound.
Now i understood it is binary file . need not conversion.Simply take the samples as int
After adding FFT the file is noisy...
When read the samples one by one using array ,there is any problem with speed or anything fail?
I did this in windows programming(VC++).
Bulk reading means ,in windows programming any method for reading all sample at a time?
Please help me?
I'm a beginner...............
 

band stop filter digital

We tried Input -> FFT -> frequency cut -> IFFT -> output using C language.
We thought FFT will be suitable becoz it is fast.We were not familiar with DSP.
From your suggestion FIR would suit.
Now we are going to implement Band stop filter using FIR using windows programming.



//"Input -> filter -> output
is better and (depending on the filter), faster.""//
we didn't understand the above sentence .
What did you mean by Filter?
Can we implement This Filter in software?This is actually we want to implement

we think we can cut freq. in freq. domain.
For this the input signal(time domain) --> Freq. daimain<cut the freq>-->output(time domain).
 

what makes a digital filter

Hello!

Well, by filter, I mean... filter. In this context, a digital filter that can alter
the frequency characteristics of a file, not a coffee filter.

I don't know what kind of stop band you want and I don't know what atteuation
you want. Here is an example design of a filter which cuts between frequencies
0.2 and 0.3. The stop band attenuation is 80 dB and its length is 68 taps.
If you want a greater attenuation it will cost you more taps.

A few more detail: this filter is made with a Parks - Maclellan program
(translated from the original Fortran to C).
It is therefore very flat in the passband (I have set +/- 0.1 dB).
Careful with the +/- setting, your signal output may roll over!!

And about the problems of the FFT method:
- With an FFT, you may achieve it faster. But you may also end up with phase
jumps at every block. You can correct this by using overlapping windows.
If you overlap all your windows by half, it will be therefore equivalent to
4 FFts in computing power...
- Then you will have a granularity problem, If you use an FFT, how many points?
If you choose arbitrarily 256 points, you will get 128 frequencies between 0 and
0.5. If you use 44k sampling, one frequency step will be close to 350 Hz. Is this
OK with your design? If you use larger trunks (512 points, 1024 points), you
will end up with finer granularity but it will still be 175 Hz / 90 Hz granularity.
- With FFT, you need memory. Well, you don't care because it's on a PC, but
that's worth mentioning.

Dora



Dora.

aneeshkm106 said:
We tried Input -> FFT -> frequency cut -> IFFT -> output using C language.
We thought FFT will be suitable becoz it is fast.We were not familiar with DSP.
From your suggestion FIR would suit.
Now we are going to implement Band stop filter using FIR using windows programming.



//"Input -> filter -> output
is better and (depending on the filter), faster.""//
we didn't understand the above sentence .
What did you mean by Filter?
Can we implement This Filter in software?This is actually we want to implement

we think we can cut freq. in freq. domain.
For this the input signal(time domain) --> Freq. daimain<cut the freq>-->output(time domain).
 

how to implement a filter using a fft

I don\'t know what kind of stop band you want and I don\'t know what atteuation
you want. Here is an example design of a filter which cuts between frequencies
0.2 and 0.3. The stop band attenuation is 80 dB and its length is 68 taps.
If you want a greater attenuation it will cost you more taps.


It is therefore very flat in the passband (I have set +/- 0.1 dB).
Careful with the +/- setting, your signal output may roll over!!

Sir
Are u using any special tool like MATLAB?But we cant use such tools.Our program strictly must be in ANSI C.

We are writing this code to develop as one of the plug-ins for an IVR(Interactive Voice Response) system.

We are not sure about the what kind of band stop filter and what attenuation we need.


Will Parks - Maclellan program suit for our problem?
Please give me valuable suggestions..... Keeping in mind ur great response......
 

bandstop filter digital

Hello

I suggested Parks-McLellan program because it generates FIR filters that
are optimal in many applications.
That said, If you don't know what kind of filter you want, helping you will be
very difficult, and I cannot tell you whether an FIR designed with Parks-McLellan
will be suitable for your application.
You should start by clearly explaining what your program should do, what
frequency you want to filter, etc...

By the way, I don't use Matlab. As I told you, I translated the original Parks-
McLellan program from Fortran to C. By the way, the Parks Mc Lellan algorithm
is not a filter program, but a filter design program. In other words, this algorithm
is not the program that will filter your wav file but an algorithm that generates
the filter to process your file.
You can find many version and variants of this algorithm on the net. Their
original version can be found here.


Dora.

aneeshkm106 said:
I don\'t know what kind of stop band you want and I don\'t know what atteuation
you want. Here is an example design of a filter which cuts between frequencies
0.2 and 0.3. The stop band attenuation is 80 dB and its length is 68 taps.
If you want a greater attenuation it will cost you more taps.


It is therefore very flat in the passband (I have set +/- 0.1 dB).
Careful with the +/- setting, your signal output may roll over!!

Sir
Are u using any special tool like MATLAB?But we cant use such tools.Our program strictly must be in ANSI C.

We are writing this code to develop as one of the plug-ins for an IVR(Interactive Voice Response) system.

We are not sure about the what kind of band stop filter and what attenuation we need.


Will Parks - Maclellan program suit for our problem?
Please give me valuable suggestions..... Keeping in mind ur great response......
 

little endian audio fft

Sir
The Company gave only less information
//" Implement a band stop filter as a plug-in using ANSI C" //

For example from a wav file cut the freq between 300Hz and 500Hz for avoiding noise.This is the only information we have.

Our duty is to develop maximum efficient filter with highly optimized code.
 

wave file format read c-code fft

Hello!

Then, 2 options:
- Ask "the company" to give you the cut frequencies, transition bands and gain;
- Make a variable filter allowing you to change the frequencies at runtime.
In this case, your plug in runs the Parks program to calculate the coefficients.
Then it loads the Parks output and performs the filtering.

Dora.

aneeshkm106 said:
Sir
The Company gave only less information
//" Implement a band stop filter as a plug-in using ANSI C" //

For example from a wav file cut the freq between 300Hz and 500Hz for avoiding noise.This is the only information we have.

Our duty is to develop maximum efficient filter with highly optimized code.
 

c language for fir filters

I want to develop my project as plug-in.
I tried it .But I can't touch it. I understood it is a special type DLL.I refer so many but i can't reach final
I want basic about it
Please Help me....
 

to implement low pass filter in c language

Hello!

Sorry, I was out for a while, and I didn't notice you were still stuck...

In fact, I don't know how to help you more. As far as I remember, you wanted
to make a DLL for filtering an audio file, right?

I have never built a so-called DLL. However, I have quite some extensive
experience in BeOS's add-ons (equivalent of DLLs I believe, but I can be wrong)
and also with various plugin techniques.

Once you have designed your filter with the remez algorithm (just a suggestion,
please verify that it fits your needs), then you have to implement the
convolution inside of your DLL. You convolve your input signal with the filter's
coefficient set and you get the output signal, it's as simple as I tell you, nothing
fancy here.

But first, I would advice you to write down the specs. Apparently you don't
know the frequencies you want to cut, and I think you should start with
a checklist of your specs.

Dora.

aneeshkm106 said:
I want to develop my project as plug-in.
I tried it .But I can't touch it. I understood it is a special type DLL.I refer so many but i can't reach final
I want basic about it
Please Help me....
 

high pass filter ansi-c

Sir
I'm going to implement band stop FIR filter using Remez
I have c code for band pass filter using Remez
Can i convert it to Band stop?
Please help me
 

digital filter format

Hello!

Sorry, I didn't notice your message earlier.
Usually the Remez algorithm allows you to design a filter with as
many bands as you want.
You will have to input frequencies by pairs.
Example, if you want to cut at 0.25 low pass, you will need 2 frequencies.
The first will be the highest frequency that satisfies the pass ripple,
and the second will be the lowest frequency that satisfies the stop ripple.
In other words, if you choose 0.2 and 0.25, it will generate a filter that
does not drop before 0.2 and that has at least the specified attenuation
after 0.25.

Now if you want to do a pass band (or a stop band), you will have to
specify 4 frequencies. For example, if you want to stop everything between
0.1 and 0.2, you may specify 0.05, 0,1, 0.2, 0.25.
The bands between 0.05 and 0.1 and between 0.2 and 0.25 are called
transition bands, and cannot be 0. If you want smaller transition bands
(sharper edges), then the number of coefficients will increase.

Dora.


aneeshkm106 said:
Sir
I'm going to implement band stop FIR filter using Remez
I have c code for band pass filter using Remez
Can i convert it to Band stop?
Please help me
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top