Serving the Quantitative Finance Community

 
User avatar
farmer
Topic Author
Posts: 63
Joined: December 16th, 2002, 7:09 am

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

March 29th, 2011, 8:25 pm

Does anybody know the extent to which these alternative electronics technologies - pulse width modulation and digital-to-analog voltage conversion - are used in consumer devices?To me, pwm seems cooler. d2a is like some old-school op-amp thing, whereas a low-pass filter can turn a digital pwm signal into analog audio of a lower frequency.Basically, I was wondering if I should even investigate d2a solutions, but I think I have answered my own question. But I have not actually listened to a portfolio of audio files played using the different approaches.
Antonin Scalia Library http://antoninscalia.com
 
User avatar
nosbor
Posts: 0
Joined: December 10th, 2006, 12:54 pm

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

March 29th, 2011, 10:24 pm

http://focus.ti.com/docs/prod/folders/p ... documentsi know above or something very similar is used in mobile phones. in the spec it mentions 24bit / 32 bit res, so it might be using oversampling DACs or interpolating DACs such as the delta-sigma DAC, which use a pulse density conversion technique (see wiki pedia). not sure if pwm is used. would be interesting to know what apple use in ipod / i phone, there is always a debate about who has best quality audio in these portable devices. i hear its hard to tell difference between 16 bit and 24 bit, so although these dac's can go to 32 bit, i think most just use 16 bit mode.
 
User avatar
farmer
Topic Author
Posts: 63
Joined: December 16th, 2002, 7:09 am

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 4th, 2011, 10:57 pm

I am using a DMA controller to write 16-bit voltage percentages to a pulse width modulator. The DMA is built to just race around a circular buffer, and spit those bytes on to the PWM input. But the source audio is a live feed, which might not be able to stay ahead of the buffer pointer. The obvious solution is to take over control of the DMA source pointer and move it through the buffer using regular program logic, meaning processor cycles (or I could just write dead space onto the buffer at full pace). Is there a better solution?Never mind I already have the better solution. All I gotta do is stop and start the DMA controller until there is a fresh word. I think it stops automatically after one shot. But I am using processor cycles to restart it, that seems like a ridiculous waste. So assuming I can configure it to just run silly without supervision, we are back to the original problem. There is like a ping pong setup or something, I will figure it out.It seems the achievement of the DMA is not to save processor cycles, but to get pinpoint timing. It is like having four more cores handy, that run simple memory instructions and can't be interrupted.
Last edited by farmer on April 4th, 2011, 10:00 pm, edited 1 time in total.
Antonin Scalia Library http://antoninscalia.com
 
User avatar
nosbor
Posts: 0
Joined: December 10th, 2006, 12:54 pm

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 6th, 2011, 5:43 pm

your right about pwm. i think that is used for loudspeaker, but maybe for headset pdm is used. pdm is used with the delta sigma dac. i think for speech audio, then the dac i mention above is more for audio (music) and those dac's can buffer over 200ms of audio in big off asic fifo (good for power saving). so for speech typically they use 1 bit delta sigma dac (2-3 MHz) sampling.as for you implementation, everything is usually frame based, so higher level code will deal with say 20ms- 30 ms frames (ping pong buffers) for any post processing, but the closer you get to hardware then the frames are smaller (5 ms in ping- pong buffers), and also interrupts are used to feed pcm frames to the hardware (dac's).
 
User avatar
farmer
Topic Author
Posts: 63
Joined: December 16th, 2002, 7:09 am

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 6th, 2011, 11:00 pm

The mulaw curve is designed to bring relevant fluctuations above line noise, and then curve out the noise. But when you play this crap keeping the robust line curve - without decurving it - I think it is easier to understand for the human ear also. If people had to hear themselves, maybe they would talk in a louder monotone.
Antonin Scalia Library http://antoninscalia.com
 
User avatar
farmer
Topic Author
Posts: 63
Joined: December 16th, 2002, 7:09 am

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 12th, 2011, 11:08 pm

It seems like when I hold the PWM duty cycle at a constant number, I get a faint hiss. Even 0. I have two of these op amps lined up with some resistors, I think this is what creates the low-pass filter:QuoteThe MCP6022 dual operational amplifier (op amp) has a gain bandwidth product of 10 MHzI am adjusting the duty cycle 8000 times per second, or once every 9000 ticks where the pulse width modulator is running at 72000000 ticks per second. I am guessing it is some kind of aliasing where the duty cycle is not some neat multiple, and/or my low-pass filter isn't low enough. I am trying to kill it by turning off the amplifier where there are gaps in the audio, or lowering the clock speed of the PWM or something. But maybe I need different op amps geared towards 8000 samples per second.Ever heard of anything like this?I cut the PWM clock down to 36000000 ticks a second, and I think the hiss changed. It also seem to fade in and out with a period of greater than 11 to 19 seconds, and two odd subcycles. But it also could just be my ears playing tricks on me. One question I have is about the clock speed. If I am using the onboard clock on the chip, or even a crystal, is there some variation in the actual clock speed? One time I was running it off my car electric system, and I swear the frequency changed when I turned on and off the headlights, starter, stereo, and stuff.Incidentally, I should mention that using audio to debug and understand the cadence of your programs is way better than anything you can put on a screen. I have used blinking lights, characters, a debug output, everything with this little project. And the audio beats all for telling you what is really happening. Anybody running high speed threads you should put clicks inside them, and hook a speaker up to your computer. The ear can tell the difference between a thread spinning 8500 times per second and 8600 times per second. The ear is a poor man's oscilloscope.Anyway, I begin to think the hiss is coming from the power source not the chip. It interacts with the chip's use of the power, and the proper audio's use. So the solution is some kind of a low pass filter on the power pin to the amp? Hopefully it will just go away when I switch to battery. But this must be a common problem in electronic audio equipment, no?
Last edited by farmer on April 12th, 2011, 10:00 pm, edited 1 time in total.
Antonin Scalia Library http://antoninscalia.com
 
User avatar
nosbor
Posts: 0
Joined: December 10th, 2006, 12:54 pm

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 14th, 2011, 4:48 pm

i assume your digital signal is noise free ?. hiss sounds like high frequency so maybe your cut off frequency on the low pass is no low enough ? poor grounding could be another problem. can you not simulate the pwm and low pass filter in matlab or octave. i know little about analog.
Last edited by nosbor on April 13th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
farmer
Topic Author
Posts: 63
Joined: December 16th, 2002, 7:09 am

common voice-quality audio solutions: pulse width modulation or onboard d-to-a?

April 16th, 2011, 8:56 pm

Sorry, it wasn't much code but I had to erase it!
Last edited by farmer on April 15th, 2011, 10:00 pm, edited 1 time in total.
Antonin Scalia Library http://antoninscalia.com