Usb Filter audio

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi

   

I'm be trying go get an audio signal from my PC using USB and to filter it out to a speaker.

   

I did this project and didn't figure out how to configue the filter (input, output, dma intetput)

   

I use the usb_audio example, after change it to my speaker, and try it, I try add filter before VDAC8, but I didn't know how to configure well the Filter

   

I attach the project.

   

I would like to know how to connect it.

   

Please help me!

   

Thanks

0 Likes
45 Replies
JeCo_264681
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

 I am asking for clarification. Do you see a signal on the oscilloscope? If so, then you are doing well so far. Are you asking how to connect to a speaker? If that is your question, then you will have to supply an external amplifier to handle the 8-ohm load. Do I understand your question?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

His issue I think is streaming the audio thru USB >> DMA >> DFB >> VDAC8.

   

 

   

Getting that to work. There are example projects that handle the DMA >> DFB >> VDAC8

   

part of it, but he needs help getting DMA to capture the USB stream and forward that to the

   

chain.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Dana and 78RPM.

   

As Dana I mean to " streaming the audio thru USB >> DMA >> DFB >> VDAC8."

   

If you can help me at that, I thank you.

   

I try USB>>DMA>>AUDIO and work well on that.

   

USB >> DMA >> DFB >> VDAC8 I will thank you

   

thanks

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

 
Your project works. Check and remove J43 on the  KIT-050.
Maybe you forgot to make it active:
Right click --> Set as active project.
 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Hi and thank you All,

   

I am using psoc creator 3.0 and Psoc 5lp - cy8c5868axi-LP035   and the develeponet kit is cy8ckit-001

   

and it doesnt work for me...

   

I tried to get the data from the DMA to the filter(peripherial) and then to output it but i get on the osciloscope a square wave nor correct  and it doesn't react to the frequencies as it should react with the flter 😞

   

I added the code lines in order to connect the components in the main.c file  (//ADDED appears on the commetns)

   

attached the project with docomuntation

   

Please let me know what did I miss in the main file or schematic 

   

Besr tregards and Happy Holiday 🙂

   

 

   

 

   

     

            

0 Likes
Anonymous
Not applicable

Hi Lobo,

   

1.I found that somtimes psoc has an issue with the names

   

 so  change VDACoutDMA to DMA in main.c and in the schematic

   

2.check the NUMof BUF to 128

   

3.you left a comment on the line comment on this line

   

//while (Filter_IsInterruptChannelA() == 0) ;

   

You need to active it, to give the filter option to intterupt the dma and start the streaming

   

4. When You finish, try to change the intttreput options of filter, this can help you.

   

If you have any question, feel free to ask me in this post and I happy to help

0 Likes
Anonymous
Not applicable

Thanks on your reply

   

I read it now.

   

I have a meeting, and start to work on it immeditaly after the meeting and fix my project accoring to what you said

   

Can you be avaible in the next two hours?

   

Thanks

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Reduce the filter gain from 10 to 1 (one) and project will compile.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Hi Bob

   

I didn't explain myself well.

   

The project compile, but the result of the filter (the output) is not curreclatad to the filter and to assign wave as expceted

   

I mean, that maybe I don't know how to pass the infromation from the filter to DAC. 

   

Did I need another DMA?

   

This is any problem in the code?

   

Maybe you can send me link to another example project that work with usb and filter?

   

If not, what do I miss in my code?

   

the input is sin and the output look like a squre wave plus sin I don't understand why?

   

Thanks

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

One observation, you cannot tie speaker to a pin. Two reasons, VDAC

   

output at 4V range is 16 K ohms, not buffered unless you use an OpAmp

   

afetr VDAC8 set as follower. The other is speaker, if voice coil, is very low

   

Z and needs a power stage.

   

 

   

Here is a discussion on driving voice coil speakers -

   

 

   

    

   

          

   

http://www.cypress.com/?app=forum&id=2233&rID=105137

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Dana and thanks a lot

   

the input is sin(generator) and the output(osciloscope) look like a squre wave plus sin I don't understand why?

   

I geuess the indormation dont pass as it should

   

how can I fix this?

   

Best regards

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I do not remember the reason (I think the filter has a different byte order), but I had to swap bytes for the filter after replacing PSoC3 on PSoC5
like this:   ADC_LF = (int16)(*(LP_Filter_HOLDA_PTR+1)<<8) + *(LP_Filter_HOLDA_PTR+0);
I have already pointed to the Project   Project#102 – USB Audio using the PSoC 5LP
it uses Droop_Filter using DFB. Maybe it will help.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

PSoC3 and 5 have different endianess. On PSoC5 there is no need to swap bytes, but the DAC only accepts positive values while the filter will deliver +-integers. Can be cured by CPU intervention (No DMA) or a self-made component.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Yes, Bob. You are right again. The filter works if the signal has offset.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

As this question was raised many times, can Cypress add an optional field in the DFB component for user settable output offset value? For example 128 for 8-bit, etc. This should be trivial fix, but it shall allow for direct output to DAC without CPU intervention. For example direct ADC-DMA-DFB-DMA-DAC shall be possible after this fix. 

   

odissey1

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Consider filing a CASE on this so it gets forwarded to Creator design

   

team.

   

 

   

    

   

          

   

To create a technical or issue case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

I filed the case, will see..

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I think the filter is working properly, but has some limitations for the input signal.
In the attached project I tried to scale the input signal.
but I could not understand what the range should be the input signal and how it depends on the settings of the filter.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I am a little strapped for time but try adding a DMA channel and another

   

VDAC and DMA the same table directly to the VDAC to see if your table

   

is correct, that you see a undistorted 20 Hz sine.

   

 

   

You show a 10 uF out of the VDAC to scope. Effectively you have a HP filter

   

coupled with VDAC output Z, see datasheet for that. There is no real need to

   

AC couple output to scope, just DC couple into scope. Also if you had your

   

scope on AC coupled, it also has a high pass response in the input stage,

   

so see its spec to see its cutoff freq.

   

 

   

Lastly set your filter up with TIs online filter program with one of these -    

   

          http://www.dspguru.com/dsp/links/digital-filter-design-software, and

   

observe its response and magnitudes in BiQuad. The BiQuad has recursive fdbk

   

in its loop, so gain scaling as always to prevent saturation is a little more involved

   

in IIR filters than FIR.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Oh sorry, I forgot to remove the capacitor - it is not needed. I did this project only to
show that the filter works great if scale = 100% and shift = -128.
i.e. signal must be int8 - as said Bob.
This is only if the signal is a sine or triangle.
I had to reduce meander  signal: scale = 75% and shift = -96
otherwise I see distortion.
I.e. if the real signal will be high (turn into a square wave) I see a terrible signal to the output of the filter.
Therefore, I am interested in: how to find the maximum amplitude of the input signal (for meander) and how to affect  setting (coefficients) of the filter to it.

0 Likes
Anonymous
Not applicable

Hi pavilon.

   

Can you please attach your updated project, that I can see if it work well to me.

   

Thanks

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Dana

   

Thank on the long discussion on our code.

   

I read the whole discussion carefully, but I don't understand how to practilly change my code or my scheme?

   

What is the changes that you recomneded me to do?

   

I attach you again my project

   

Thanks

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This from datasheet on gain scaling -

   

 

   

   

 

   

You could always set up a test case and examine the output sample

   

stream. Also look at impulse and step response in the Filter GUI, that will give

   

you an idea of G you should limit to, allow you to interactivley adjust G.

   

 

   

Also offset, data samples are uint8, uint16.

   

 

   

Regards, Dana.

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I use your project without changes.
I just removed the line 221  ///////   VDAC8_SetValue(Filter_Read8(Filter_CHANNEL_A));
This created extraneous impulses.
The problem is not in the project:
How to create a sound 8 bit mono USBFS for your project?
My generator creates only 16-bit stereo, so I use a random offset to the signal turned out to be in the range int8, and this is a bad method.
p.s.  I do not know your purpose, but  I use the Sound Card Audio Adapter DAC based  CM6206

0 Likes
Anonymous
Not applicable

 Hi Pavelon

   

Thank you on your help

   

I try to convert music to 8-bit but not succes to do it.
 

   

I also try to download from 8bit music collection.
This is a 8 bit music but I afraid that the music itselft is not in 8 bit

   

I attach you the music, maybe it can help

   

 

   

Another thing. This is option to use only 8 bit on PSOC? This isn't worth a lot...

   

This is another option? Maybe of Texas Instrument

   

Thanks

   

Moshe

0 Likes
Anonymous
Not applicable

 Hi Dana

   

I see in your reply: The web site you are accessing has experienced an error.

   

I don't sure I see all your reply

   

Also, I happy if you can write me pratically, what to change.
Thanks

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The DFB is not an 8 bit engine, it is 24 bit -

   

 

   

   

 

   

If you want > 8 bit audio you will need external DAC.

   

 

   

Regards, Dana.

   

 

   

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received


I sent a signal to the ADC no use filter - and yes, I hear the 8-bit music.
This means that the music format is uint8, but the filter requires int8.
Apparently the problem is that the music written for unipolar DAC in format uint8 ((

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

As I understand a filter, every high-pass filter will calculate-off any dc-offset from inputs and deliver a signed result.

   

Can this be the source of your issue?

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I already do not understand, but this progect seems to be working.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

...and that project contains a low-pass filter which will propagate a DC-offset to the outputs

   

 

   

Bob

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I just reduced the input signal. You will need to apply PGA for a  gain.
But I do not understand why it is necessary to reduce the amplitude of the input signal.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

When you have the filter gui opened check off the impulse response and/or the

   

step response so you can see it plotted. If you see the response > 1.0 then filter

   

G has to be reduced, otherwise you will overflow the VDAC, it will wrap around, and

   

produce spikes/distortion.

   

 

   

   

 

   

The above is an example where the G is too high.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hyurica!! Cool!!

   

It work!!

   

Thanks a lot Danna!

   

Thank to pavlon and bob, you are the best!

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You are always welcome!

   

 

   

Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Thanks Dana

   

We attach you our final project

   

Now we work to add two seperate microphones to our projects. We hope that we will not need to ask you more questions...

   

Thanks again

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

If you use Filter_Write16 / Filter_Read16 then
You can listen to any music (8/16 bit).

0 Likes
Anonymous
Not applicable

Thanks Pavelon, I will try it

0 Likes
Anonymous
Not applicable

 Hi,

   

I tried the last projet and it doesnt work for me in the low frequencies(0-1000Hz) with g<1

   

someone knows why?

0 Likes