Data logging memory collection and dumping to a PC?

Yes, 192.168.2.4 is the IP address of the computer running node.js. The port number 7123 doesn’t matter, other than it can’t already be in use by another program on the computer. You can set it to something else as long as you change it both in the node.js code and in the Photon code.

The audioServer.js file runs in node.js on your computer. It listens on a TCP network port (7123) for connections from the Photon. In this example, the data is raw binary data (8-bit audio samples) and then writes them to a binary (wav) file.

The technique can easily be extended to do comma separated values, JSON, or whatever you want, though this example program doesn’t show how to do it.

The Photon sender uses double-buffering. Each buffer is a SampleBuf. The idea is that you fill up the buffer with samples until full, then you start filling the other buffer. The complete buffer is then sent over the network, which occurs at the same time as the other buffer is being filled, so the samples are obtained a constant rate regardless of how long the network transfer takes.

2 Likes