[PD] floats getting forced into int
Hey, I am working on a project that sends OSC messages from PD, and for some reason, when dealing with message lists of mixed objects, such as [send /OSC/blah 0.0 1.0 1.0], PD turns the floating point numbers into int, but only when they represent whole numbers. Can anyone think of a work around where they stay as floating point, or is there some simple solution that I am missing (I can't be bothered to hack up an external just to solve this). thanks, db ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
hi david pd doesn't distinguish between floats and ints, since all numbers are 32-bit-floats in pd (whereas max/msp DOES distinguish between floats and ints). so what actually happens in your example, is that all numbers are converted to floats (ints are converted to floats, not the other way around). afaict, this shouldn't be a problem as long as you stay in pd. a problem might occur, when you want to send numbers from pd to another app like max/msp. when you want to send '1.0', this is turned to '1' by pd, so the app on the other side might think, it is an int, though it is meant to be a float. i don't know of a nice way yet to overcome this. roman On Wed, 2007-02-14 at 08:35 -0500, David Brynjar Franzson wrote: Hey, I am working on a project that sends OSC messages from PD, and for some reason, when dealing with message lists of mixed objects, such as [send /OSC/blah 0.0 1.0 1.0], PD turns the floating point numbers into int, but only when they represent whole numbers. Can anyone think of a work around where they stay as floating point, or is there some simple solution that I am missing (I can't be bothered to hack up an external just to solve this). thanks, db ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list ___ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
Hi all, newer versions of the CNMAT OSC objects or Max implement type tag strings, which helps to overcome type misinterpretation. No idea though whether the PD OSC objects at hand understand these type tags. greetings, Thomas Am 14.02.2007 um 15:57 schrieb Roman Haefeli: hi david pd doesn't distinguish between floats and ints, since all numbers are 32-bit-floats in pd (whereas max/msp DOES distinguish between floats and ints). so what actually happens in your example, is that all numbers are converted to floats (ints are converted to floats, not the other way around). afaict, this shouldn't be a problem as long as you stay in pd. a problem might occur, when you want to send numbers from pd to another app like max/msp. when you want to send '1.0', this is turned to '1' by pd, so the app on the other side might think, it is an int, though it is meant to be a float. i don't know of a nice way yet to overcome this. roman On Wed, 2007-02-14 at 08:35 -0500, David Brynjar Franzson wrote: Hey, I am working on a project that sends OSC messages from PD, and for some reason, when dealing with message lists of mixed objects, such as [send /OSC/blah 0.0 1.0 1.0], PD turns the floating point numbers into int, but only when they represent whole numbers. Can anyone think of a work around where they stay as floating point, or is there some simple solution that I am missing (I can't be bothered to hack up an external just to solve this). thanks, db ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/ listinfo/pd-list ___ Telefonate ohne weitere Kosten vom PC zum PC: http:// messenger.yahoo.de ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/ listinfo/pd-list Thomas Grill http://g.org ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
David Brynjar Franzson wrote: Hey, I am working on a project that sends OSC messages from PD, and for some reason, when dealing with message lists of mixed objects, such as [send /OSC/blah 0.0 1.0 1.0], PD turns the floating point numbers into int, but only when they represent whole numbers. Can anyone think of a work around where they stay as floating point, or is there some simple solution that I am missing (I can't be bothered to hack up an external just to solve this). The simplest way is to add a very small number to your integers so they don't get turned into floats. I'm going to add some kind of type-forcing mechanism to [packOSC] as soon as I can. Martin ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
We've just had a big discussion about this subject on the OSC list. There is currently no solution for Pd, but perhaps there is something in the works. http://www.create.ucsb.edu/pipermail/osc_dev/2007-February/thread.html Steve On 2/14/07, David Brynjar Franzson [EMAIL PROTECTED] wrote: Hey, I am working on a project that sends OSC messages from PD, and for some reason, when dealing with message lists of mixed objects, such as [send /OSC/blah 0.0 1.0 1.0], PD turns the floating point numbers into int, but only when they represent whole numbers. Can anyone think of a work around where they stay as floating point, or is there some simple solution that I am missing (I can't be bothered to hack up an external just to solve this). thanks, db ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote: Maybe you can be bothered to make a tiny modification to sendOSC.c as in attached patch %$§#§$§#!#?, forgot the patch. Why does this always happen at least once every two days? Ciao -- Frank Barknecht _ __footils.org_ __goto10.org__ --- sendOSC.c 2007-02-08 16:38:09.0 +0100 +++ sendOSC-no-conversion.c 2007-02-14 17:13:17.0 +0100 @@ -411,17 +411,8 @@ case A_FLOAT: f = atom_getfloat(a); - i = atom_getint(a); - if (f == (t_float)i) - { // assume that if the int and float are the same, it's an int -returnVal.type = INT_osc; -returnVal.datum.i = i; -} - else - { returnVal.type = FLOAT_osc; returnVal.datum.f = f; -} return returnVal; case A_SYMBOL: s = *atom_getsymbol(a); ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
Thank you all for your suggestions. I'm going to try Frank's patch, but the only sendOSC.c I can find is since 2002, and I cannot find it in any of the code trees. Where does it live nowadays? db ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
David Brynjar Franzson wrote: Thank you all for your suggestions. I'm going to try Frank's patch, but the only sendOSC.c I can find is since 2002, and I cannot find it in any of the code trees. Where does it live nowadays? It's in cvs under externals\OSCx\send+dump Martin ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] floats getting forced into int
On Wed, Feb 14, 2007 at 05:53:47PM +0100, Frank Barknecht wrote: %$§#§$§#!#?, forgot the patch. Why does this always happen at least once every two days? Maybe we should hack mutt to search for the string [Aa]ttach and warn the user if there is no attachment before sending! Chris. --- [EMAIL PROTECTED] http://mccormick.cx ___ PD-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list