[PD] fast way to convert two 8 bit data to one 16 bit data in big lists ?

Roman Haefeli reduzent at gmail.com
Fri Sep 25 11:23:14 CEST 2020



On Fri, 2020-09-25 at 00:30 +0200, Benjamin ~ b01 wrote:
> 
> I'm looking for a fast way to convert two 8 bit data to one 16 bit
> data
> in big lists
> a device send continuously packets of 16 000 bytes threw the network
> to
> udpreceive
> at the moment, to reconstitute from two bytes a 16 bit value, I'm
> using
> a list-drip and a counter to discriminate the MSB and LSB and do the
> *256 and + operation
> the aim is to feed a table with the result (see attached) and produce
> sound from it
> it works with packets of 2 000 bytes but pd freeze with bigger
> packets
> I'm wondering if there is a better way to achieve this ?


You may have a look at netpd-tabwrite16.pd from [1]. It uses signal
objects in [switch~]ed subpatch. This seems more efficient than
iterating with control objects. 

Please note the following caveats:

* It detects whether DSP is on and falls back to control object
iteration when not. This works only when actually running in netpd. You
might want to skip that [spigot]s

* Since it was designed for audio, the resulting values in the table
are scaled to -1 and 1. You can skip the scaling to get values from 0-
65535.

Roman


https://github.com/reduzent/netpd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200925/0f852ca2/attachment.sig>


More information about the Pd-list mailing list