.WAV to delta sigma bitstream
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
.WAV to delta sigma bitstream
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP
Author Message
Bob Monsen
Guest





Posted: Tue Dec 06, 2005 8:25 am    Post subject: .WAV to delta sigma bitstream Reply with quote

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
Back to top
Guest






Posted: Tue Dec 06, 2005 3:41 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Bob Monsen wrote:
Quote:
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
Back to top
Randy Yates
Guest





Posted: Tue Dec 06, 2005 5:16 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

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
Back to top
Vladimir Vassilevsky
Guest





Posted: Tue Dec 06, 2005 11:41 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Bob Monsen wrote:

Quote:
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
Back to top
Randy Yates
Guest





Posted: Wed Dec 07, 2005 12:13 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

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
Back to top
Vladimir Vassilevsky
Guest





Posted: Wed Dec 07, 2005 12:36 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Randy Yates wrote:

Quote:
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
Back to top
Randy Yates
Guest





Posted: Wed Dec 07, 2005 12:53 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

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
Back to top
Bob Monsen
Guest





Posted: Wed Dec 07, 2005 1:16 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

On Tue, 06 Dec 2005 20:17:31 +0000, Vladimir Vassilevsky wrote:

Quote:


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.

Quote:

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...).

Quote:
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...

Quote:
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.

Quote:
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.

Quote:
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
Back to top
Vladimir Vassilevsky
Guest





Posted: Wed Dec 07, 2005 1:16 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Bob Monsen wrote:


Quote:
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.

Quote:

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.

Quote:
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 :-)

Quote:
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.

Quote:
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.

Quote:
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
Back to top
Bob Monsen
Guest





Posted: Wed Dec 07, 2005 1:16 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

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

Quote:


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.
Back to top
Randy Yates
Guest





Posted: Wed Dec 07, 2005 5:16 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Hi Rocky,

Quote:
I have had a look at your article. It seems that all the 'clever stuff'
is done in the modulator and essentially the bitstream out of the
processor pin only needs to be low pass filtered. Is that right?

It is true that all you have to do is low-pass filter the processor
output pin. And it is true that the modulator is the most complex
piece of the design.

However, you can create a delta sigma system that utilizes the
interpolator for "most" of the SNR. In fact, you could use
ONLY oversampling (without the modulator/noise-shaping) if you
can handle the computational load (e.g., if it is non-realtime, or
if you have gobs of spare MIPS).

Quote:
If the oversampling rate is even lower (say 4 times) is CVSD a better
option?

Couldn't tell you - I don't have much experience with CVSD.

--Randy
Back to top
Rocky
Guest





Posted: Wed Dec 07, 2005 5:16 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Hi Randy,

I have had a look at your article. It seems that all the 'clever stuff'
is done in the modulator and essentially the bitstream out of the
processor pin only needs to be low pass filtered. Is that right?

If the oversampling rate is even lower (say 4 times) is CVSD a better
option?

Regards
Rocky
Back to top
Randy Yates
Guest





Posted: Wed Dec 07, 2005 5:16 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Bob Monsen <rcsurname@comcast.net> writes:
Quote:
[...]
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.

You're confused. E.g., where did 32x come from? And delta sigma is more
than oversampling - it is oversampling followed by noise-shaping. The
noise-shaping block is called the modulator. The oversampling block
is just an interpolator.

It also makes more sense to sum the channels and filter before you do
anything else.

Quote:
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.

A second-order modulator with 8x oversampler will provide about 34 dB
SNR, or almost 6 bits. A third-order modulator with 8x oversampling
will provide about 45 dB SNR, or almost 8 bits. If you could go to
10x oversampling (hack your input signal bandwidth down to 5 kHz)
and use a third-order modulator, you could get about 55 dB SNR -
almost bearable...
--
% Randy Yates % "Midnight, on the water...
%% Fuquay-Varina, NC % I saw... the ocean's daughter."
%%% 919-577-9882 % 'Can't Get It Out Of My Head'
%%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra
http://home.earthlink.net/~yatescr
Back to top
Randy Yates
Guest





Posted: Wed Dec 07, 2005 5:16 pm    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

Randy Yates <yates@ieee.org> writes:
Quote:
[...]

PS: You can read the presentation I made at the comp.dsp
conference on delta sigma conversion here:

http://home.earthlink.net/~yatescr/presentation.pdf

See especially Figure 9 on page 18, which is the top-level guide in
making decisions on the modulator order and oversampling ratio.
--
% Randy Yates % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC % the Beatles on 'Hey Jude'"
%%% 919-577-9882 %
%%%% <yates@ieee.org> % 'Shangri-La', *A New World Record*, ELO
http://home.earthlink.net/~yatescr
Back to top
Bob Monsen
Guest





Posted: Thu Dec 08, 2005 12:45 am    Post subject: Re: .WAV to delta sigma bitstream Reply with quote

On Wed, 07 Dec 2005 12:52:19 +0000, Randy Yates wrote:

Quote:
Bob Monsen <rcsurname@comcast.net> writes:
something confused

Randy Yates replies:
Quote:
You're confused. E.g., where did 32x come from? And delta sigma is more
than oversampling - it is oversampling followed by noise-shaping. The
noise-shaping block is called the modulator. The oversampling block is
just an interpolator.

It also makes more sense to sum the channels and filter before you do
anything else.



The problem I was worrying about was getting a bitstream with a bitrate

that was not a simple multiplier of the original sampling rate. So, I
figured that making the sampling rate be some huge number (this is in the
preprocessing phase in software, on linux, so it isn't real time), and
applying a lowpass filter would approximate an analog stream, which I
could then sample at my preferred rate. I was guessing that simply
replicating the samples would retain the same harmonic content (while
adding higher frequences), and then lowpass filtering would remove those
high frequencies.

However, I've since learned that there is free software to do this kind of
thing (using the resample and polyphase options to sox), so I can get the
audio resampled at my preferred 'natural' bitrate, and then run a
delta-sigma algorithm over it to change it into a 'noise shaped'
bitstream.

The bitstream will then be pumped out a microcontroller port (or even
directly from a flash, using a shift register and a bit clock) into a
simple low pass filter at a 'natural' rate. That is my aim with all of
this.

Quote:
Bob Writes:
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.



Randy Yates replies:
Quote:
A second-order modulator with 8x oversampler will provide about 34 dB
SNR, or almost 6 bits. A third-order modulator with 8x oversampling will
provide about 45 dB SNR, or almost 8 bits. If you could go to 10x
oversampling (hack your input signal bandwidth down to 5 kHz) and use a
third-order modulator, you could get about 55 dB SNR - almost
bearable...

Thanks for the analysis, the suggestions, and for the link to your
presentation. I'm gonna go buy Rick Lyons's book. I'm currently reading
the online book entitled "The Scientist and Engineer's guide to Digital
Signal Processing" by Steven W. Smith, but haven't finishied it, so I'm
currently the poster child for the old saying

"A little knowledge is a dangerous thing"...

So, thanks for bearing with these silly questions.

--
Regards,
Bob Monsen

Jill looked puzzled. "I don't know how to express it. Yes, I do! Ben,
have you ever seen an angel?" "You, cherub. Otherwise not." "Well,
neither have I but that is what he looked like. He had old, wise eyes
in a completely placid face, a face of unearthly innocence." She
shivered.
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB