Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Why I am not getting any sound?

Status
Not open for further replies.
Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
Hello!

Why I am not getting sound. I have converted a 8bit 8KHz pcm wav file array and I am loading each byte of the array to the dac and I am giving 1/8000 = 125us delay between each byte. All I get is some signal on the oscilloscope if set to 2mV. I get only noise in speakers.

Jayanth D
 

Attachments

Last edited:

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
This is a project made from several parts. You will have to troubleshoot each part to make sure it is doing its job.

1. Your waveform appears to be audio. However a speaker will produce only a soft sound at 2 mV. You must amplify the signal before it goes to the speaker.

2. Is the DAC wired correctly? (I once fried a DAC0808 because of wiring it the wrong way. I didn't purchase another one.)

3. What is the output amplitude with no speaker connected?

4. Are you certain the data (digitized audio) has sufficient amplitude? Do the values consist of a weak signal or a strong signal?
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
Hello! BradtheRad

Please have a look at my attachment. I have added 100W audio amplifier, but still cannot get the music. It is a new design with R2R network and amplifier.
I have converted a wav file to 8bit 11025Hz mono PCM wav file and then converted the .wav file to .c file using wav2c. I took a part of that array because of memory shortage and I am loading the bytes with a delay of 91us {1/11025Hz).

Do I have to improve my ladder network?
 

Attachments


BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
Your diagram hides some of the resistor network... but I think 8 bits of data go to the 8 wires at the right?

Then I see 2 wires going off to the left. R50 should go to ground. The remaining wire goes to the audio amplifier. We'll assume the amplifier has an input capacitor to block DC.

It's possible your resistor values are too low. Your signal may be getting drained to ground. Typical values are 100k rather than 1k.

At this point you need to make sure the microcontroller is sending out a strong enough signal. Make a program to generate artificial square waves (or pulses) at any frequency between 50 and 5000 Hz. See if sound comes out the speaker.

Once you get loud enough sound with square waves, then you will try it with the wav data. This is what I meant by saying you have to check performance of each part, before you can expect the entire project to work.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
here is the full circuit.

Check the attachment. I have generated a square wave using PWM of freq 5KHz, but I am getting some noise and not loud sound.

Should I change r2R resistors with 100K and 200K values?
 

Attachments

Last edited:

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
I'm trying a simulation of your R-2R network. Your resistor values are okay.

I cannot see the scale of your waveform. It has a blocky appearance, so I think it is low amplitude viewed at a magnified scale. It resembles a weak noise signal.

Are your microcontroller's output pins set for output or input?

At this point you can find out a great deal if you check the oscilloscope image of the outputs of your microcontroller. You need to make sure that a square wave is going to your R-2R resistors.

If it is okay, then you can try it with the audio data.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
Do you say that I have to generate square wave and put it at the dac input and see the output of dac using oscilloscope?
My microcontroller pins are set as output. I have sent the mikroC Code. There is a .c file in the .rar file. Open that .c file in notepad and you can see the code.

See the attached image. I am getting square waves at the 8 pins of PORTD.
 

Attachments

Last edited:

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
See the attached image. I am getting square waves at the 8 pins of PORTD.
Yes. If the pulses alternate between 0 and 5V, and are in the range of human hearing, then there will be sound getting to your amplifier.

One thing...

Looking at your two most significant bits (scope ch. A & B in your image #2)...

They are opposing each other. Or rather the B bit is halfway opposing the A bit.

I don't know what would make this happen. I cannot tell whether A is inverted, or if B is inverted.

You must solve this, or you will not get a proper audio signal.

Then see how strong a signal is going to your amplifier. It should swing a couple volts above and below a mid-level voltage.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
How to solve the inverted issue. In proteus oscilloscopr seetings I inverted ch B and tried, but then I got ch C inverted. maybe it is a bug in proteus.

- - - Updated - - -

@ BradtheRad

I am using a 8 bit 8000 Hz Uncompressed Wav file. It means 1 sec of wav data will have 8000 bytes and each byte has to be played for 125us i.e., (1/8000).
So If I have to play a music of 10 sec then I have to play 8000 * 10 = 80000 bytes. Am I right BradtheRad?

- - - Updated - - -

I used an array to store 25600 samples of 8 bit 11025 Hz uncompressed pcm wav file data

For 1 sec it is 11025 bytes so for around 2 sec = 25600 bytes. I am getting some sound for 1 sec. please check it BradtheRad. I have used a different R2R network.
Is is 10K and 20K ladder network. for value 0xFF at the dac i/p I am getting some 4.87v as o/p
 

Attachments

Last edited:

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
How to solve the inverted issue. In proteus oscilloscopr seetings I inverted ch B and tried, but then I got ch C inverted. maybe it is a bug in proteus.
One at at time, create pulses sent to each output pin. Check each one individually.

I am using a 8 bit 8000 Hz Uncompressed Wav file. It means 1 sec of wav data will have 8000 bytes and each byte has to be played for 125us i.e., (1/8000).
So If I have to play a music of 10 sec then I have to play 8000 * 10 = 80000 bytes. Am I right BradtheRad?
I believe that's what it amounts to. For monaural.

I used an array to store 25600 samples of 8 bit 11025 Hz uncompressed pcm wav file data

For 1 sec it is 11025 bytes so for around 2 sec = 25600 bytes. I am getting some sound for 1 sec. please check it BradtheRad. I have used a different R2R network. Is is 10K and 20K ladder network.
That will probably work.

If you posted an image it did not come through.

for value 0xFF at the dac i/p I am getting some 4.87v as o/p
This appears good.

To be sure you should test with all levels from 0 to 255. Confirm that you get a proportional volt level.
 

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
750
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,049
Only a step by step approach will solve ur problem quickly...
Test the DAC part at first by giving some known signals, better will be a ramp signal which is very easy to generate in software, a simple upcounter will do it...
Feed it to DAC part and make it confirm it is working properly......

Then go to wave...
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
@ BradtheRad

I changed the array data to data of 8 bit 8000 Hz uncompressed mono PCM Wav file so that at 32067 bytes I can get at least 4 seconds of music. Just to test.
It was better than the previous one. I got some music. The problem is If I read data 512 bytes at a time and feed the DAC I am not getting music but only noise.
I want to know if I read the data of wav file used in my example from 44th byte i.e., after the header is the data which I get is equal to the data I get after converting it to .c or .h file using wav2c or pcm2h?

I am attaching the simulation and project files.

Thanks
Jayanth

- - - Updated - - -

@ vinodstanur

I am getting music for 1 sec.
 

Attachments


BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,804
Helped
2,738
Reputation
5,473
Reaction score
2,648
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
103,031
It was better than the previous one. I got some music. The problem is If I read data 512 bytes at a time and feed the DAC I am not getting music but only noise.
I want to know if I read the data of wav file used in my example from 44th byte i.e., after the header is the data which I get is equal to the data I get after converting it to .c or .h file using wav2c or pcm2h?
Sorry, don't know how the formatting works, nor the length of the header.

I have opened audio files and looked at the byte values, trying to recognize whether they change in a way that resembles a waveform going up and down. Couldn't figure it out.

There are two ways the digitized audio might be represented.

(1) Unsigned values from 0 to 255. Silence would be at 127.
Positive waveforms range from 128 (min) to 255 (max).
Negative waveforms from 126 (min) down to 0 (max).

or

(2) Two's complement. Silence would be 0.
Positive waveforms would range from 1 to 127.
Negative waveforms from -1 (FF, or all bits set to 1) to -128 (MSB set to 1, all others 0).

It gets even more complicated when you move up to higher resolution (2 bytes), or stereo (2 data streams).

- - - Updated - - -

------------------------

You will need to examine your waveforms coming from the DAC output.

Can you generate an artificial sine wave inside the microcontroller? When it comes through the DAC does it look like a sine on the scope?

When you hear the sine as audio, its smoothness or harshness will tell you a great deal.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
Hello! BradtheRad

I have attached the data of wave file I got using hex editor in bot hex format and decimal format. Also I have included the actually data (array) I am using which I got from pcm2h.exe. Please have a look at it. I think the values are varying from 0 to 128 as viewed in decimal, but I am getting 4.87 volts if FF value is i/p to DAC.

A few of the bytes have changed in "actual data using in project hex value.txt" to the values in "wav data from wav file hex.txt"
Maybe it is because of pcm2h.exe.

I still have to generate sine wave and see the result.

----------------------Update-------------------

BradtheRad I think the problem is with Proteus. I tweaked a little with proteus and decreased the Fosc to 4MHz so that it doesn't eat up simulation time in proteus.
I got 2 sec of music, but it has to repeat continuosly. It is not doing so. Can you help me with the issue.

I have attached the project files.
 

Attachments

Last edited:

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top