Re: [Csnd] Receiving array blob via OSC in Python

An osc blob is just a char buffer. It’s up to the receiver to convert it to usable data. The format is “documented” in the source code of OSCsend:

          ar = (ARRAYDAT *) p->arg[i];
          size = 0;
          for(j=0; j < ar->dimensions; j++) {
            size += (int32_t)ar->sizes[j]*sizeof(MYFLT);
          }
          if(buffersize + size + 12 > bsize) {
            aux_realloc(csound, buffersize + size + 128, &p->aux);
            out = (char *) p->aux.auxp;
            bsize = p->aux.size;
          }
          data = size + 8;
          byteswap((char *)&data,4);
          memcpy(out+buffersize,&data,4);
          buffersize += 4;
          memcpy(out+buffersize,&(ar->dimensions),4);
          buffersize += 4;
          memcpy(out+buffersize,&ar->sizes[0],ar->dimensions*4);
          buffersize += ar->dimensions*4;
          memcpy(out+buffersize,ar->data,size);
          buffersize += size;
          break;

From there, the format seems to be:

  • Total byte size of the data (int32)
  • dimensions (number of dimensions, int32)
  • sizes (array of int32 with size given by the dimensions)
  • the array data itself, as double (8 bytes per element)

cheers,
Eduardo

Csound mailing list Send bugs reports to Discussions of bugs and features can be posted here

Thanks for this Eduardo. At the receiving end it looks like 96 chars, which seem to be the same no matter the number of dimensions and size of array I send.

Which is strange if the blob should be able to contain arrays of different sizes and dimensions.

I will ask the guy developing the library if he can explain it to me.

Best, Andreas