# [PD] Converting PCM to delta sigma

Dario Sanfilippo sanfilippo.dario at gmail.com
Mon Nov 25 00:41:45 CET 2019

```Hi, Martin.

A first-order digital delta-sigma modulator would be a difference followed
by an integrator and a quantiser in a feedback loop. The difference is
between the input (multi-bit) and the output (1-bit); the integrator is a
unit-gain, 1-sample feedback loop, so [rpole~ 1]. Particularly, I'm talking
about a bipolar DDSM where the quantiser gives 1 for signals >= 0, -1
otherwise.

<http://dariosanfilippo.tumblr.com>
You can convert a 1-bit signal into a multi-bit one by averaging the
impulses. For that, you can use a low-pass filter that would also remove
the shaped noise introduced by the quantisation. The cutoff of the filter
gives you the bandwidth of the resulting signal; the resolution of the
coefficients of the low-pass filter determines the sample depth resolution.

I am not aware of designs where a low-pass is used before quantisation.

In PD, it would be something like this:

[image: image.png]

Cheers,
Dario

On Sat, 23 Nov 2019 at 19:35, Martin Dupras <martindupras at gmail.com> wrote:

> Thanks Miller!
>
> I don't particularly understand the math behind biquad filters, so
> might you be able to elaborate on how that works? Am I right in
> understanding that the first yields the first derivative of the
> signal?
>
> That's not quite what I'm trying to do; I think perhaps I need to
> explain myself better.
>
> Here's what I'm trying to do.
>
> As I understand it, to convert a PCM signal into a (say) 1-bit sigma
> delta equivalent, you'd upsample it by some power of 2 (say 32),
> low-pass filter it, and then quantize to 1 bit whether the signal goes
> up or down. So what I'd like to do is store the resulting delta signal
> numerically in an array of the same size, but where each index is
> storing, instead of a single 32-bit value, the 32-bit numerical
> equivalent of the sequence of 0s and 1s that happens in the space of 1
> sample.
>
>
> Many thanks!
>
> - martin
>
>
> On Sat, 23 Nov 2019 at 17:07, Miller Puckette <msp at ucsd.edu> wrote:
> >
> > biquad~ 0 0 1 -1 0
> >
> > then to convert back,
> >
> > biquad~ 1 0 1 0 0
> >
> > (this may differ by a DC offset fromt eh original).
> >
> > cheers
> > Miller
> >
> > On Sat, Nov 23, 2019 at 04:29:32PM +0000, Martin Dupras wrote:
> > > I was wondering if anyone has tried converting PCM signals to
> > > delta-sigma and vice-versa in PD? Are there any examples of how one
> > > would do that?
> > >
> > > To be clear, I don't need it to be realtime as such; what I'd like to
> > > do is be able to copy the PCM values of one array as a delta-sigma
> > > version in another.
> > >
> > > Any ideas or pointers?
> > >
> > > Thanks,
> > >
> > > - martin
> > >
> > >
> > >
> > > _______________________________________________
> > > Pd-list at lists.iem.at mailing list
> > > UNSUBSCRIBE and account-management ->
> https://lists.puredata.info/listinfo/pd-list
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management ->
> https://lists.puredata.info/listinfo/pd-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20191125/79d7d5d5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 153550 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20191125/79d7d5d5/attachment-0001.png>
```