3 versions of a WiFi Sonification patch and a question

Kilombo's icon

Hi everybody,

I have worked on this WiFi Sonification patch for a long time now. Of course you are invited to use and build upon any of my versions and to share the results with the community. I hope this way I can give back a little while asking for advice myself.

It uses the shell object by Bill Orcutt ( https://cycling74.com/tools/bernstein-shell/#.WJzEaRDv234 ) and therefore only works on Mac OS (as far as I know). Thanks for this object!

The simple idea behind the patch is to have a constant sound playing according to the WiFi networks in reach and their signal strength. I want the 10 closest (or first to be found) networks to play a note each. When walking around a house or neighborhood, you can get a sonic idea of WiFi rays around you.

I've layed out the basic foundation in the file WLAN_sound short v1.maxpat (attached).

The problem here: With each scan, the networks appear in a new order. So a constantly available network will be routed to a different number each time. Thus, different channels will be handling the same networks, giving the impression of a lot of change, even though the available networks stay fairly constant.

Everyone who doesn't want to get too deep into my humble (and non-functioning), somewhat confusing solutions shall be encouraged at this point to come up with a nice and clean solution to this problem themselves.

For everyone else: Please first check WLAN_sound long v1.maxpat (attached). This one is working, but stupid. It sends each newly found network to a new channel, keeping this channel in charge for this network for the entire time. After the finite number of channels created in the patch, it will be "full" and not accept newly found networks anymore. I limited it to 100, but stopped pasting sub patchers after 20 and already the CPU usage is quite high. In certain areas, 100 networks will be full very quickly, rendering the patch uninteresting and highly inelegant.

Next, I tried to find a way to make a version with only 10 channels, that would each accept one network and keep looking for that network until it is out of reach and then looking for a new one, which they will keep as long as it is in range, and so on.
The result is a confusing collection of gates and regexps (see attachment WLAN_sound v21.maxpat).

In addition to it being confusing, it is also not working. One regexp will not do as told and I cannot figure out why. If anyone can find out what the problem is, I would be very grateful. (Look for the object "Print WhyIsThereNoOutputHere?" in the subpatcher "Ch" in subpatcher "Assign addresses to channels").

Thanks a lot in advance for any opinion, comment, help, etc.!

WiFi_sound.zip
zip
LSka's icon

Interesting project.
First thing that comes to mind, in order to better handle dynamic voices allocation, is to use poly~, instead of multiple subpatches.

Max Patch
Copy patch and select New From Clipboard in Max.

Then, to handle data in a simpler way, I thought of this:

that's just an example for getting the first ten values, hope you can adapt it to your other needs. Anyway, [coll] has various built-in query commands that can be useful.

Kilombo's icon

Hi Lska,

thanks so much for your reply! Very useful objects in there, that I didn't know of (buddy and deferlow!) that make life so much easier...

Your patch is a huge, huge help. I knew poly~ was something to look into, but I was afraid it wouldn't let me do it as I imagined but I guess I will give it another go.

The only problem with using slice is that the columns in the data sent from shell aren't perfectly aligned, giving you sometimes BSSIDs and sometimes the rest of some SSIDs. I guess I'll include a regexp in your version to make that 100% waterproof.

Will post this as soon as I get a chance to work on it (might take a few days because I'm travelling).

Thank you again!

Kilombo's icon

Hi everybody,

I somewhat finished the project, with one little bug concerning the recording option still nagging me.

Sometimes it works fine, sometimes the sfrecord~ spits out an error "could not finish writing header for [some symbols]".

I tried many things (interrrupting the audio when starting and/or stopping the recording, delaying some messages, very long and very short recording durations), read all the topics in these forums i could find that have something to do with it but I could not figure out why it would sometimes work fine and sometimes not.

Any ideas?

Help greatly appreciated! As stated above, feel free to use the patcher in your own work.

-K

WiFi-Sound.maxpat
Max Patch
channel.maxpat
Max Patch
Kilombo's icon

Just tried a different solution with buffer~ and record~ (cropping the buffer to the time of the recording reusing what I found here: https://cycling74.com/forums/recording-in-a-buffer-which-size-grows-as-the-recording-lasts/ )

This works around needing sfrecord~ but now the recorded audio is distorted with clicks. Does anyone know why?

WiFi-Sound-with-buffer.maxpat
Max Patch
LSka's icon

Hi, I'm having problems downloading your files... could you please use the "copy compressed" function and paste them directly on a post? Thanks!

Kilombo's icon

Hi Lska,

thanks for the reply. That probably has to do with the Amazon outage yesterday.

I will paste the patch once I get home from work today.

Best,
-K

Kilombo's icon

Here's the buffer version:

Max Patch
Copy patch and select New From Clipboard in Max.

Here's the sfrecord~ version:

Max Patch
Copy patch and select New From Clipboard in Max.

And the needed channel.maxpat:

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks!

Kilombo's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's the sfrecord~ version:

Max Patch
Copy patch and select New From Clipboard in Max.

The buffer~ version:

Max Patch
Copy patch and select New From Clipboard in Max.

And the necessary channel.maxpat for poly~:

Thanks!