[announce] The sadam Library, version 2014-04-30


    May 07 2014 | 9:27 pm
    Dear Maxers,
    I have just finished a major upgrade to The sadam Library, which you can download from my website: http://www.sadam.hu/software . Most important improvements:
    • All objects support Max 64bit, both on the Mac and on Windows.
    • All audio objects support the 64bit audio chain.
    • The networking objects support IPv6 as well.
    • The UDP networking objects support multicast and broadcast (i.e. you need only one sender to reach multiple receivers on different hosts).
    • [sadam.rapidXML] can fully synchronise its content with the vanilla [dict] object (i.e. now you can parse and serialise XML files with [dict]).
    • [sadam.canvas] now runs fine on Max 6.
    • Lots of minor bugfixes.
    For those who don't know The sadam Library, this is a collection 30+ externals covering different topics, including:
    • Lots of different objects for IP-based networking (binary streaming through TCP and UDP).
    • [sadam.rapidXML]: Parses, creates, modifies and outputs XMLs in a highly efficient way.
    • [sadam.canvas]: An interactive canvas (the [lcd] object you've always dreamed of).
    • [sadam.lzo]: Lossless data compression/decompression.
    • [sadam.standardMap~]: A chaotic synthesizer based on the so-called Chirikov Standard Map.
    • Fast math tools (greatest common divisor, least common multiple, prime factorisation, linear/spline/Bézier interpolation and extrapolation etc).
    • And many more...
    Objects are supposed to work on both Max 5 and 6 (the distribution includes different builds for the two) as well as on the Mac and on Windows. Note that PPC support has been dropped, and some of the objects (particularly, the networking suite) will not run on Windows XP; the last version which fully supports PPC and/or Windows XP is version 2012-10-30 (also available on my website).
    All externals are licensed under the Creative Commons Attribution 3.0 Unported License, except the LZO compressor/decompressor, which is a GPLv2 project.
    I would like to take this opportunity to say a big thanks once again to those users who have contributed with their donations and comments to this project during the past few years! I can assure you that I have converted your contributions into the best code I could have written. :-)
    Comments, bug reports and donations are more than welcome!
    Enjoy! Ádám
    P.S. Did you find these tools useful? Maybe you used some of them in a performance? If you could leave a comment in this topic and tell me your story with The sadam Library... That would be great for me! It would give me courage and inspiration for future development.

    • May 08 2014 | 7:07 am
      Wonderful, thanks a lot!
    • May 09 2014 | 8:00 am
      My story: I wanted to use a WiFly module to transmit serial to Max wirelessly over an existing network without the need for supporting micro controllers or send and receive hardware. Max's inbuilt UDP receive only accepts OSC type data, but the sadam.udpReceiver object can get at the raw message. Thanks Siska!
    • May 09 2014 | 10:34 am
      Thanks Adam, love the to byte from byte objects; donation pending :-)
    • May 12 2014 | 2:07 am
      I created a piece a few years ago that used sadam.standardMap~ as the only actual synthesis source. It received a very generous review in the CMJ (http://www.computermusicjournal.org/reviews/36-2/riggs-rosenberg.html) but it never would have existed if not for Adam's hard work and guts. Long live SADAM.
    • May 17 2014 | 10:21 am
      Hi, thanks a lot for the stories and the feedback (also for those which I've received in private). In fact, I've been considering for a while whether or not to abandon this project, as I've felt sometimes that I became lately the only user of these tools... So, thanks, and let me know how I could improve these tools in the future!
    • Sep 03 2014 | 10:25 am
      Hi Sadam, I was looking for a way to send the gyroscope, accelerometer and magnetometer data from my smartphone to max over UDP and basically I came across your external sadam.udpreceive which gets the udp stream from the android app but how do I convert that to the actual data I need?
      Example UDP packet: 890.71558, 3, 0.076, 9.809, 0.565, 4, -0.559, 0.032, -0.134, 5, -21.660,-36.960,-28.140 Timestamp [sec], sensorid, x, y, z, sensorid, x, y, z, sensorid, x, y, z
      Example of data received from sadam.udpreceive
      received: 49 51 57 55 56 46 49 52 54 51 55 44 32 51 44 32 32 45 48 46 48 57 57 44 32 45 48 46 48 50 54 44 32 49 48 46 53 50 50 44 32 52 44 32 32 32 48 46 48 51 48 44 32 45 48 46 48 49 54 44 32 32 48 46 48 48 49 Sender IP & port: 192.168.137.4 50303 received: 49 51 57 55 56 46 49 53 56 51 52 44 32 51 44 32 32 45 48 46 48 56 54 44 32 45 48 46 48 49 55 44 32 49 48 46 53 49 56 44 32 52 44 32 32 32 48 46 48 50 57 44 32 45 48 46 48 49 53 44 32 32 48 46 48 48 50 44 32 53 44 32 32 32 57 46 51 48 48 44 32 50 52 46 57 48 48 44 45 53 50 46 52 48 48 Sender IP & port: 192.168.137.4 50303
    • Sep 03 2014 | 8:56 pm
      Hi,
      my networking objects act as raw binary tools, i.e. they will give you the exact stream as it has been sent by the other party (in this case, your Android device). The objects are format-agnostic in the sense that, whatever is received, they would output it as a sequence of bytes (numbers between 0 and 255). It is up to you to decode what you get -- in other words, you have to know the format in which the other application is encoding its data in order to find out their meaning.
      With that said, I have experimented a little bit with the examples which you've sent, and I had the impression that your Android app uses a very simple encoding: it treats the data as a simple character message, which gets transmitted character-by-character. You may try therefore to send the incoming messages to the [itoa] object. But to be 100% certain, you should consult your Android app's documentation to find out the exact format which it uses to transmit data.
      Hope this helps, Ádám
    • Sep 04 2014 | 9:13 pm
      Hi Sadam,
      Thanks for the fast answer and the great suggestion for itoa. It is indeed transmitted as ASCII text.
      Cheers!
    • Oct 20 2014 | 9:08 pm
      Hi Adam
      Firstly, thanks for your contribution. Secondly, I know this sounds like a real Noob question, but please bear with me.
      I'm trying to use the UDPReceiver to get Leap Motion javascript into M4L. I'm really new to Max programming and I'm struggling to figure out where to put your externals so that I can find them in the Object Browser. I'm using Live 9 with M4L (latest Max 6.1). I've tried copying the sadam.udpReceiver.mxo file into the max-externals folder, restarted, but nothing shows if I search for sadam or up (except the default live object). I've also tried putting it it in the m4l-externals folder, but that didn't work either. Could you perhaps give me some help as to where the .mxo files go if I'm using Max 4 Live?
      BTW, I'm on a Mac OSX Yosemite.
      Thanks kindly.
      Zayne
    • Oct 21 2014 | 5:35 am
      Hi Zayne,
      the answer might sound even more noobish, but my most honest answer is that I have no idea... :-)
      As far as I know, it wouldn't matter where you put the externals (as long as they can be 'seen' by Max, i.e. they are in the search path); the feature depends on adding an extra JSON file somewhere which tells Max if and how an external should be included in the Object Explorer. I've never dealt with this, so I can't give you more details, but if you search the forums, I'm sure you'll find an answer. To start with, I'd probably go for this thread: https://cycling74.com/forums/explorer-autocompletion-and-basic-attributes-in-max6 (this brings up many more questions than the Object Explorer, but it also deals with that).
      Cheers, Ádám
    • Oct 21 2014 | 6:35 am
      have you tried actually typing the name of the object into a new empty object; you may need to do this before it shows up in object browser (this is just a guess)
    • Oct 21 2014 | 7:04 pm
      Thanks for the response, Adam. I guess for now it doesn't have to show up in the browser - I thought that it had to in order for it to work. However, I've followed Floating Point's instructions (thanks, FP) and it does appear when I start typing, so I assume that it will work this way too.
      I'm just getting into Max/MSP programming - done quite a bit of Ruby web stuff a while back but rusty as all hell! Enjoying the challenge of figuring this all out, but it's slow going at the beginning!
      Thanks again for the help.
    • Jan 18 2016 | 3:41 pm
      Dear Adam,
      just wanted to have a look at your library but I can't manage to download from your website. I tried with different browser, but still can't get it. It shows : Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /home4/sadamhu/public_html/includes/database/mysql/database.inc on line 46
      Is there another way to get the lib ? I would appreciate.
      Thanks jo
    • Jan 19 2016 | 8:02 am
      Dear Joha,
      thanks for letting me know. I can confirm that the website seems to be dead a little bit, or at least it does a few nasty things like rejecting download requests. Unfortunately, I'm not a CMS expert and have no idea how to fix the page -- it will possibly take me a while until I bring it back into a fully operational state (in the worst case, I'll just rebuild it from scratch, but that will possibly take me months as this is currently a very low-priority project from my side).
      In the meantime, feel free to simply follow the link which is being displayed on the page (the link itself works, it's just some webpage stat-count logic which makes it fail if you click on it on the website itself): http://www.sadam.hu/download/sadamlib.zip
      Best wishes, Ádám
    • Jan 19 2016 | 2:01 pm
      Thanks for the updated link --- I'm planning on using some of your objects in my new course so glad to have the latest version
    • Jan 19 2016 | 2:59 pm
      you should post that new link on your website.....thank you though :-)
    • Jan 20 2016 | 8:51 am
      Hi, like said earlier, the link itself is on the website. The problem is that the CMS engine will not work if you click on the link displayed on the website, as there's some stat-counting mechanics which came with the template and I don't know how to fix/disable it. But the same link as above is also displayed on the site, you just need to copy-paste it instead of clicking on it directly...
      It's not very elegant but that's all what I can offer for the time being. ;-)
      Cheers, Ádám
    • Jan 20 2016 | 10:00 am
      Yesterday I played a little bit with standard map synth - and it's really great.
    • May 18 2016 | 9:36 pm
      Hi there.
      I'm using the sadam.udpReceiver to get values from an adafruit huzzah esp8266 board to max. It's a range sensor and in the code that is uploaded to the board, I have a serial print and an udpwrite and they both send the same value ("distance")
      F.i. In the serial view, I have 2206.35 and that is seen in as 158 in max. I have a print object reading the sadam.udpReceiver. Is there a way to have these match. Either changing the code for the huzzah board or doing something clever in max?
      Also, the receiver only works, when the computer and the board are sharing network. Not when I'm doing an adhoc network with my computer. Any ideas about that?
      I've attached the code for the board below:
      #define triggerPin 13 #define echoPin 16 #include #include
      unsigned long duration; float distance; int status = WL_IDLE_STATUS; const char* ssid = "hsn"; // your network SSID (name) const char* pass = "hellodolly"; // your network password
      unsigned int localPort = 2390; // local port to listen for UDP packets
      IPAddress ipMulti (169,254,53,236);
      byte packetBuffer[512]; //buffer to hold incoming and outgoing packets
      WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP
      void setup() { Serial.begin (115200); pinMode(triggerPin, OUTPUT); pinMode(echoPin, INPUT); // setting up Station AP WiFi.begin(ssid, pass);
      // Wait for connect to AP Serial.print("[Connecting]"); Serial.print(ssid); int tries=0; while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); tries++; if (tries > 30){ break; } } Serial.println();
      Serial.println("Connected to wifi"); Serial.print("Udp server started at port "); Serial.println(localPort); Udp.begin(localPort);
      }
      void loop() { digitalWrite(triggerPin, LOW); delayMicroseconds(2);
      digitalWrite(triggerPin, HIGH); delayMicroseconds(10);
      digitalWrite(triggerPin, LOW); duration = pulseIn(echoPin, HIGH, 500000); distance = duration * 0.0343 / 2;
      Serial.println(distance); delay(350);
      int noBytes = Udp.parsePacket(); if ( noBytes ) { Serial.print(millis() / 1000); Serial.print(":Packet of "); Serial.print(noBytes); Serial.print(" received from "); Serial.print(Udp.remoteIP()); Serial.print(":"); Serial.println(Udp.remotePort()); // We've received a packet, read the data from it Udp.read(packetBuffer,noBytes); // read the packet into the buffer
      // display the packet contents in HEX for (int i=1;i Serial.print(packetBuffer[i-1],HEX); if (i % 32 == 0){ Serial.println(); } else Serial.print(' '); } // end for Serial.println(); // Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Send answer to Packet-Sender Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Send Answer to Network (Broadcast) Udp.write("answer"); Udp.endPacket(); } // end if Udp.beginPacket(Udp.remoteIP(), 2395); Udp.write(distance); Udp.endPacket();
      }
    • Aug 29 2016 | 4:39 pm
      Hello! I'm impressed of this library, I'm trying to download it from sadam.hu, but this web-site gives me HTTP ERROR 500.
      I'm creating realy unexpensive Midi Reciever on ESP8266 (wifi module), and it worked fine with built-in Max Msp udpsend. But It looks slowed down; cause It takes 8 times more bytes, that It's really need. (Cause of OSC, osc message takes 32 bytes, and MIDI need only 8)
      I need to send lot of Midi Notes at the time to control NeoPixel lights from ableton midi clips. Now maximum is 50 notes at 1 time. It's impressive, but I hope I can increase it up to 200!
      Is there some way I can get this udpSender library? I will be realy thankful, I'll give this library all credits, and show all source codes.
      Regards, Paul.
    • Aug 29 2016 | 7:17 pm
      Hi,
      unfortunately my website broke a while ago and as I'm not a CMS expert (and also, a bit short of time these days) I was unable to fix it so far. I'll get some time during the autumn to re-build the site... Until that happens, you can always access the library using the following direct link:
      (the link points to the most recent version.)
      Happy Maxing, Ádám
    • Aug 30 2016 | 8:59 am
      @$adam in regards to your udpSender object. I'm running into an annoying error that whenever the object loses connection with the device i'm sending to, it won't reconnect with the device even when the device comes back online. I think the only solution was to actually delete the udpSender object, and put a new one back in or just restart max altogether. Have you run into this issue before?
    • Sep 05 2016 | 9:11 am
      just wanted to update my previous post, i think the error was because of the terrible ethernet shield. i upgraded to a better one and it would never get stuck in that error if i disconnected and reconnected the arduino to the network.
      cheers.
    • Sep 30 2016 | 9:08 pm
      Hello Adam! Please help solve the problem, after disabling and enabling network cards sadam.udpClient stops working and gives the following message (screenshots), to restore the work helps only restarting MAX. Is it possible zhto to eliminate?
    • Oct 01 2016 | 7:30 am
    • Oct 05 2016 | 11:54 pm
      Hi Konstantin,
      somehow the screenshots aren't displaying properly. Can you please paste a small example patch which reproduces the error, together with the error message you're experiencing?
      Thanks, Ádám
    • Oct 10 2016 | 8:50 am
      Нi Ádám. Аfter reconnecting the network card, when the broadcast returns an error, "sadam.udpClient: Could not setup UDP broadcast.", when connecting to a specific IP error "sadam.udpClient: poll(): the specified sender socket is invalid.". Errors are dumped only if the customer hands again to dial the host.
    • Nov 22 2016 | 2:31 pm
      Нi Ádám . Where can I download the The sadam Library version 2012-10-30 for Windows XP?
    • Nov 24 2016 | 6:45 am
      Hi, unfortunately my website is still broken, but luckily enough the links still do work! :-)
      The one for the 2012-10-30 version is at http://www.sadam.hu/download/sadamlib_20121030.zip
      Enjoy! Ádám
    • Nov 24 2016 | 6:28 pm
      Ádám thank you very much, but there is one problem. In the sadamlib_20121030.zip not sadam.udpClient. Is there a sadam.udpClient for XP?
    • Nov 24 2016 | 10:06 pm
      Hi,
      sadam.udpClient and sadam.tcpServer were only added in version 2015-02-03, at the same time when I redesigned the internals of the networking objects, specially on the Windows side. My understanding is that Windows 7 has a substantially different API for networking than what Windows XP had, and it would have taken a huge effort to support both. As Microsoft dropped support for Windows XP on the 8th April 2014 (almost a year before the 2015-02-03 release of my library) I decided not to invest that effort.
      Best wishes, Ádám
    • Feb 02 2017 | 12:24 am
      Hi Adam,
      I've been using the tcpClient and it's been working flawlessly for sending and receiving. However if the connection isn't found, it takes a while for it to timeout and Max hangs for a while. I was wondering if there a possibility of changing the timeout length? I've got a setup to talk to 50+ projectors, pinging them on a loop essentially, and if a couple aren't on the network due to whatever reasons (loose ethernet cable perhaps) the whole process gets caught up for a while with the rainbow spinning wheel of doom.
      Let me know if anything is possible. Cheers.
    • Apr 22 2017 | 1:52 pm
      Hi Adam,
      I'm not sure if you will see this, but I am using your sadam.RapidXML object in Max7, to parse xml weather files downloaded from the internet. After I have my patch open for a while, I get this error whenever I try to use the object.
      "sadam.rapidXML: File 'Newcastle.xml' not found!"
      Even though I can see the xml file in the root directory of the patch, and it was working 5 minutes before. Have you come accross this error before? I need the patch to be open for long amounts of time to record the weather. Closing the patch and opening it again gets rid of the error but it is not a solution. :(
      Any help would be great.
      Sam