DSPRelated.com
Forums

.WAV to delta sigma bitstream

Started by Bob Monsen December 5, 2005
I want to convert some .WAV files to a delta-sigma bitstream. The .WAV
files are typical 2 channel 16 bits per sample 44kHz audio files. I'd like
to use some kind of tool (linux preferably, windows if necessary) to
transform them into a single channel delta-sigma 8x oversampled bit
stream, and preserve as much of the original audio spectrum below 6kHz as
possible. This is for output from a microcontroller. Are there any tools
out there that will do this for me?

Thanks...

-- 
Regards,
  Bob Monsen
Bob Monsen wrote:
> I want to convert some .WAV files to a delta-sigma bitstream. The .WAV > files are typical 2 channel 16 bits per sample 44kHz audio files. I'd like > to use some kind of tool (linux preferably, windows if necessary) to > transform them into a single channel delta-sigma 8x oversampled bit > stream, and preserve as much of the original audio spectrum below 6kHz as > possible. This is for output from a microcontroller. Are there any tools > out there that will do this for me?
It might be overkill for you, but this software will do the job: http://www.weiss.ch/p2d/p2d.html It will preserve the whole audio spectrum below 20kHz if you input 44.1kHz data. Regards, Andor
Bob,

You might want to try looking at the "related" links provided by
libsndfile at

http://www.mega-nerd.com/libsndfile/

libsndfile doesn't do this. 

--Randy


Bob Monsen wrote:

> I want to convert some .WAV files to a delta-sigma bitstream. The .WAV > files are typical 2 channel 16 bits per sample 44kHz audio files. I'd like > to use some kind of tool (linux preferably, windows if necessary) to > transform them into a single channel delta-sigma 8x oversampled bit > stream, and preserve as much of the original audio spectrum below 6kHz as > possible. This is for output from a microcontroller. Are there any tools > out there that will do this for me? >
The conversion of PCM to oversampled DSM is straightforward; you can develop such convertor yourself. 44x8 oversampling is not going to have a very high quality; what kind of application your are looking for? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Suppression of artifacts like birdies, etc., modulator analyses
(e.g., of order, overload and architecture), and interpolating filter
design considerations, in addition to practical concerns such
as scaling and overflow analysis in each component, cause
me to disagree with you, Vladimir, that "DSM" is "straightforward."

--RY


Randy Yates wrote:

> Suppression of artifacts like birdies, etc., modulator analyses > (e.g., of order, overload and architecture), and interpolating filter > design considerations, in addition to practical concerns such > as scaling and overflow analysis in each component, cause > me to disagree with you, Vladimir, that "DSM" is "straightforward." >
First of all, the DSM at 44x8 is not going to be high fidelity anyway. The interpolating filter is very basic task. There is also nothing magic about noise shaping and dither. Scaling and overflow is not a big issue since you can use floating point. An experienced guy can do such PCM to DSM convertor in one evening. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
I guess you need to argue the point with folks like Bob Adams
and Steven Norsworthy since they coauthored (with others) an
entire book on the subject. This puts it far from the
"straightforward" category "in my book."

--RY

On Tue, 06 Dec 2005 17:41:55 +0000, Vladimir Vassilevsky wrote:

> > > Bob Monsen wrote: > >> I want to convert some .WAV files to a delta-sigma bitstream. The .WAV >> files are typical 2 channel 16 bits per sample 44kHz audio files. I'd like >> to use some kind of tool (linux preferably, windows if necessary) to >> transform them into a single channel delta-sigma 8x oversampled bit >> stream, and preserve as much of the original audio spectrum below 6kHz as >> possible. This is for output from a microcontroller. Are there any tools >> out there that will do this for me? >> > > The conversion of PCM to oversampled DSM is straightforward; you can > develop such convertor yourself. 44x8 oversampling is not going to have > a very high quality; what kind of application your are looking for? >
I want to be able to output sound files from a small micro, using a single pin and a few instructions out of of a 10us interrupt. I've been reading appnotes on delta sigma, and it sounds just like what I want. My uneducated guess is that I can simply replicate the 44.1kHz samples some number of times (32x?), add the channels, filter them using a digital lowpass filter, and then oversample using some kind of software delta sigma scheme. Since this all seems fairly obvious, I was hoping for a freeware solution. Also, how much SNR am I likely to lose with a scheme like this? I'd like to be able to output a bit every 10us or so into an external lowpass filter. My (again, uneducated) reading of some web sources implies that I'll get an SNR of 28dB in my frequency band using a simple 2nd order delta-sigma design and 8x oversampling. That would probably be just fine. -- Regards, Bob Monsen Mike is like the first man to discover fire. Fire was there all along after he showed them how, anybody could use it... anybody with sense enough not to get burned with it.

Bob Monsen wrote:


>>The conversion of PCM to oversampled DSM is straightforward; you can >>develop such convertor yourself.
> I want to be able to output sound files from a small micro, using a single > pin and a few instructions out of of a 10us interrupt. I've been reading > appnotes on delta sigma, and it sounds just like what I want.
If you can output one bit per 10us interrupt, then the oversampling is 1/(10us x 44.1kHz) = 2.27 times.
> > My uneducated guess is that I can simply replicate the 44.1kHz samples > some number of times (32x?), add the channels, filter them using a > digital lowpass filter,
Yes, you can do it this way if you like.
> and then oversample using some kind of software > delta sigma scheme. Since this all seems fairly obvious, I was hoping for > a freeware solution.
Nothing is more expensive then seemingly free things :-)
> Also, how much SNR am I likely to lose with a scheme like this?
Let's say you have the 2nd order DSM at 10us (100kHz). The SNR in the 0...6kHz band will be about 20dB total with the noise increasing towards high frequency with the rate of 12dB/oct.
> I'd like > to be able to output a bit every 10us or so into an external lowpass > filter.
You will need good analog LPF to suppress the audible noise at high frequencies. I would recommend the 3rd order at least.
> My (again, uneducated) reading of some web sources implies that > I'll get an SNR of 28dB in my frequency band using a simple 2nd order > delta-sigma design and 8x oversampling. That would probably be just fine.
The problem is 100kHz DSM frequency is too low. If you will tilt your audio signal to increase the high frequencies before DSM, and compensate for the tilt with the analog filter at the output, that will gain you the additional ~6dB. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Tue, 06 Dec 2005 20:17:31 +0000, Vladimir Vassilevsky wrote:

> > > Bob Monsen wrote: > > >>>The conversion of PCM to oversampled DSM is straightforward; you can >>>develop such convertor yourself. > >> I want to be able to output sound files from a small micro, using a single >> pin and a few instructions out of of a 10us interrupt. I've been reading >> appnotes on delta sigma, and it sounds just like what I want. > > If you can output one bit per 10us interrupt, then the oversampling is > 1/(10us x 44.1kHz) = 2.27 times. >
I guess I have my terminology mixed up. I meant that I would also want to filter anything above 6kHz out of the original, and pretend like it was an analog signal... then, oversample at 12*8 = 96kHz using a second order delta-sigma to get a bitstream which I could output a bit at a time into my lowpass output filter using a simple "on/off" one-bit ADC.
>> >> My uneducated guess is that I can simply replicate the 44.1kHz samples >> some number of times (32x?), add the channels, filter them using a >> digital lowpass filter, > > Yes, you can do it this way if you like. >
I just stumbled into 'sox' for linux, which will resample, and will also output and input from '.dat' files, which are an ascill representation. It does something called polyphase filtering for upsampling, which might be nice (although it is taking forever on my art-of-fugue #1 40M input file...).
>> and then oversample using some kind of
software delta sigma scheme.
>> Since this all seems fairly obvious, I was hoping for a freeware >> solution. > > Nothing is more expensive then seemingly free things :-) >
Well, for my current application, free tin is better than unobtainable gold...
>> Also, how much SNR am I likely to lose with a scheme like this? > > Let's say you have the 2nd order DSM at 10us (100kHz). The SNR in the > 0...6kHz band will be about 20dB total with the noise increasing towards > high frequency with the rate of 12dB/oct. >
Thanks.
>> I'd like >> to be able to output a bit every 10us or so into an external lowpass >> filter. > > You will need good analog LPF to suppress the audible noise at high > frequencies. I would recommend the 3rd order at least. >
Ok, thanks again.
>> My (again, uneducated) reading of some web sources implies that I'll >> get an SNR of 28dB in my frequency band using a simple 2nd order >> delta-sigma design and 8x oversampling. That would probably be just >> fine. > > The problem is 100kHz DSM frequency is too low. If you will tilt your > audio signal to increase the high frequencies before DSM, and compensate > for the tilt with the analog filter at the output, that will gain you > the additional ~6dB. >
I thought that is what delta-sigma did for me. You are saying that if I do some kind of mild highpass filtering on the input before building the DSM bitstream, it'll help with noise by moving the energy upwards into the filtered frequencies? Thanks again. I appreciate your help. -- Regards, Bob Monsen My dear, I used to think I was serving humanity, and I pleasured in the thought. Then I discovered that humanity does not want to be served; on the contrary it resents any attempt to serve it." ~ Jubal Harshaw