Thank you,
I'm not sure it's possible to perform audio modulo with internals
only, here is a workaround with expr~
Le 07/11/2016 à 18:02, Roman Haefeli a écrit :
On Mon, 2016-11-07 at 17:49 +0100, patrice colet wrote:
Hello,
this is quite interesting but there is something I don't get in
attached patch, both 1 and -1 outputs the same thing, so I don't know
if
I've misinterpreted something or if there is a mistake in message
computing
No, you're right. The message based reference is already wrapping over.
I added a [clip -32768 32767] to avoid that.
See attachment.
Roman
Le 07/11/2016 à 16:24, Roman Haefeli a écrit :
Hi all
In order to store audio data more efficiently in netpd presets and
also
to transmit live audio through OSC, I'm thinking of ways to convert
an
signal to a 16-bit stream represented as two signals, one for each
byte, the first for MSB and the second for LSB. I already came up
with
a few solutions, but I'm not totally happy with any of them because
they are not very efficient or/and have strange edge cases. It
turns
out what seems a simple task is a bit more complex and probably has
quiet a few totally different solutions.
I would be interested to see with what solutions people come up
with.
Consider it a puzzle, a brain teaser (in case you're done writing
your
paper for pdcon and need some distraction).
Requirements:
* It must be done in signal domain (I was doing it in message
domain
yet, but performance is obviously bad)
* Only vanilla objects are allowed.
* Input is in the range -1 to 1. Input outside this range should
be
clipped and not wrapped around.
* Output is two signals, each consisting of an integer value
between
0 and 255
* The two bytes represent a 16-bit _signed_ integer
You can compare your output with the message version in attached
patch.
If this generates interest and makes some people participate, I'll
disclose my solutions after people submitted their solutions.
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/l
istinfo/pd-list
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/lis
tinfo/pd-list
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
#N canvas 31 137 582 392 10;
#X obj 53 67 hsl 300 15 -1 1 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 29431 1;
#X floatatom 52 40 5 0 0 0 - - -, f 5;
#X obj 201 104 sig~;
#X floatatom 52 256 5 0 0 0 - - -, f 5;
#X floatatom 157 228 5 0 0 0 - - -, f 5;
#N canvas 2452 575 355 239 float-to-16bit 0;
#X obj 28 94 t a a;
#X obj 28 4 inlet;
#X obj 28 190 outlet;
#X obj 91 190 outlet;
#X obj 28 134 div 256;
#X obj 28 154 mod 256;
#X obj 91 139 mod 256;
#X obj 28 27 * 32768;
#X obj 28 49 clip -32768 32767;
#X connect 0 0 4 0;
#X connect 0 1 6 0;
#X connect 1 0 7 0;
#X connect 4 0 5 0;
#X connect 5 0 2 0;
#X connect 6 0 3 0;
#X connect 7 0 8 0;
#X connect 8 0 0 0;
#X restore 52 156 pd float-to-16bit;
#X msg 83 11 0;
#X msg 20 11 -1;
#X msg 48 11 -0.5;
#X msg 113 11 0.5;
#X msg 141 11 1;
#X obj 202 228 snapshot~;
#X obj 374 234 snapshot~;
#X obj 408 199 metro 100;
#X obj 408 178 loadbang;
#N canvas 663 138 566 427 sig-to-16bit-converter 0;
#X obj 42 5 inlet~;
#X obj 40 351 outlet~;
#X obj 294 306 outlet~;
#X obj 40 157 -~;
#X obj 59 131 -~;
#X obj 78 109 /~ 256;
#X obj 39 79 clip~ -32768 32767;
#X obj 41 51 *~ 32728;
#X obj 41 221 max~ 0;
#X obj 95 221 min~ 0;
#X obj 137 247 +~ 256;
#X obj 137 267 min~ 255;
#X obj 97 286 *~;
#X obj 96 259 <~ 0;
#X obj 40 321 expr~ int(floor($v1));
#X obj 293 61 expr~ ceil(fmod(($v1+1)* 32768 \, 256));
#X obj 293 40 clip~ -1 1;
#X connect 0 0 7 0;
#X connect 0 0 16 0;
#X connect 3 0 8 0;
#X connect 3 0 9 0;
#X connect 4 0 3 1;
#X connect 5 0 4 1;
#X connect 6 0 3 0;
#X connect 6 0 4 0;
#X connect 6 0 5 0;
#X connect 7 0 6 0;
#X connect 8 0 14 0;
#X connect 9 0 10 0;
#X connect 9 0 13 0;
#X connect 10 0 11 0;
#X connect 11 0 12 1;
#X connect 12 0 14 0;
#X connect 13 0 12 0;
#X connect 14 0 1 0;
#X connect 15 0 2 0;
#X connect 16 0 15 0;
#X restore 201 158 pd sig-to-16bit-converter;
#X text 366 158 <- what to put there?;
#X floatatom 51 296 5 0 0 0 - - -, f 5;
#X floatatom 152 296 5 0 0 0 - - -, f 5;
#X connect 0 0 2 0;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 15 0;
#X connect 5 0 3 0;
#X connect 5 1 4 0;
#X connect 6 0 1 0;
#X connect 7 0 1 0;
#X connect 8 0 1 0;
#X connect 9 0 1 0;
#X connect 10 0 1 0;
#X connect 11 0 17 0;
#X connect 12 0 18 0;
#X connect 13 0 11 0;
#X connect 13 0 12 0;
#X connect 14 0 13 0;
#X connect 15 0 11 0;
#X connect 15 1 12 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list