Equivalent commands: SuperCollider – Clojure

A list of equivalent commands (mostly on arrays) with different names. Likely to expand over time.

SuperCollider Clojure
clump partition
collect map
choose rand-nth
flat/flatten flatten/apply concat
removeDups distinct
scramble shuffle
sum (reduce + coll) / (apply + coll)

Extempore setup on Mac OS X 10.8

These are some instructions on how to get extempore and some external libraries running with Mac OS X 10.8.

Extempore

Get a binary from the github page. Also clone the project and place the extracted binary in the root directory of the cloned repository. Just execute the binary in a terminal.

SOIL

Clone my version and build with cmake.

Horde3d rendering engine

Get svn version as the last version (1.0.0-beta5) won’t build in Mac OS 10.8:

svn co https://horde3d.svn.sourceforge.net/svnroot/horde3d/trunk horde3d

Build with cmake:

cd horde3d
mkdir build; cd build
cmake ..
make
# no make install, so just copy frameworks to the appropriate places
sudo cp -R Horde3D/Source/Horde3DEngine/Horde3D.framework /Library/Frameworks/
sudo cp -R Horde3D/Source/Horde3DUtils/Horde3DUtils.framework /Library/Frameworks/

Set new-horde to #t in libs/external/horde3d.xtm.

In the horde3d_knight.xtm example, the horde resources_path should point to

(bind-val resources_path i8* "/path/to/svn/repo/Horde3D/Binaries/Content")

Also you have to replace the h3dAdvanceEmitterTime function by h3dUpdateEmitter and you have to add a call to h3dUpdateModel in the mainLoop function, e. g. here:

(h3dSetModelAnimParams _knight 0 (* (dtof (* 0.5 _at)) 24.0) 24.0)
(h3dUpdateModel _knight 1) ;; make the knight move

Then happy knighting 🙂

Bullet physics engine

Install it with brew, but make sure you build the shared libraries:

brew install bullet --shared --build-extra

Set _extended_bullet to #f in libs/external/bullet.xtm. The example currently doesn’t work without the _extended_bullet functions.

KissFFT

Just follow the instructions in the library file ( libs/externals/fft.xtm ).

Assimp

Install with brew.

Random jpgs with SuperCollider

Hellocatfood just
described how to create jpgs in puredata. Here is a quick port of his solution to SuperCollider:

~jpgheader = Int8Array[255, 216, 255, 219, 00, 132, 00, 03, 02, 02, 03, 02, 02, 03, 03, 03, 03, 04, 03, 03, 04, 05, 08, 05, 05, 04, 04, 05, 10, 07, 07, 06, 08, 12, 10, 12, 12, 11, 10, 11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17, 19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20, 01, 03, 04, 04, 05, 04, 05, 09, 05, 05, 09, 20, 13, 11, 13, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 255, 192, 00, 17, 08, 01, 224, 02, 128, 03, 01, 17, 00, 02, 17, 01, 03, 17, 01, 255, 196, 01, 162, 00, 00, 01, 05, 01, 01, 01, 01, 01, 01, 00, 00, 00, 00, 00, 00, 00, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 16, 00, 02, 01, 03, 03, 02, 04, 03, 05, 05, 04, 04, 00, 00, 01, 125, 01, 02, 03, 00, 04, 17, 05, 18, 33, 49, 65, 06, 19, 81, 97, 07, 34, 113, 20, 50, 129, 145, 161, 08, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 09, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 01, 00, 03, 01, 01, 01, 01, 01, 01, 01, 01, 01, 00, 00, 00, 00, 00, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 17, 00, 02, 01, 02, 04, 04, 03, 04, 07, 05, 04, 04, 00, 01, 02, 119, 00, 01, 02, 03, 17, 04, 05, 33, 49, 06, 18, 65, 81, 07, 97, 113, 19, 34, 50, 129, 08, 20, 66, 145, 161, 177, 193, 09, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250, 255, 218, 00, 12, 03, 01, 00, 02, 17, 03, 17, 00, 63];

~jpgfooter = Int8Array[255, 217];

(
f = File.new(“test.jpg”, “wb”);
f.write(~jpgheader);
100.do{f.write(({255.rand}!1024).as(Int8Array));};
f.write(~jpgfooter);
f.close
)

(
f = File.new(“test.jpg”, “wb”);
f.write(~jpgheader);
f.write(
100.collect{ |i|
500.collect{ |j|
(j%i)%255 * rrand(0.9,1.1)}.sort.mirror2;
}.flop.flatten.as(Int8Array));
f.write(~jpgfooter);
f.close
)

“open test.jpg”.unixCmd

result of the second process

Thunderbird 5 folder pane and Mac OS X 10.7 (aka Lion)

Due to the new window resizing feauture of Lion, there is as strong possibility that one can’t get the folder pane back in Thunderbird if it snaps shut (because you will resize the window, not reopen the pane at the left border). One can re-enable it by editing the file in session.json in the profile directory (~/Library/Thunderbird/Profiles/*.default/session.json) and replacing “folderPaneVisible”:false with “folderPaneVisible”:true. This should probably be done with Thunderbird closed. Upon reopen, the folder pane should be back.

Hopefully this will be fixed in the next Thunderbird version…

Synced PDF-Viewer for Emacs TeXing on the Mac

As I was quite annoyed with Preview’s slow reload time, I found SyncTeX.
With it, one can sync CarbonEmacs and many other editors with the PDF-viewer Skim flagyl tablets online. Skim thus allows you to shift-command-click in the PDF and it will take you to that exact line in the .tex-file in your editor of choice. Nice! Just don’t forget to start the emacs server (M-x server-start) and ensure that the right emacsclient binary is in the $PATH or the Skim settings… and then: happy TeXing 🙂

Using a Logitech QuickCam Deluxe for Notebooks with Processing on Windows

Today I wanted to write a Processing sketch to process the input of my webcam (model number V-UBV49). As it should run on a Mac and I didn’t have one at hand, I tried my luck with Windows, because at least it uses the same video-library.

To use it, one needs QuickTime for Windows and WinVDI, a quite dead project and closed-source on top of it. The latest version (1.05) is considered broken (so the wiki tells me), and the one before didn’t work either (1.04). A mailing list message mentioned 1.01, which then finally worked. I got it from this site because no official one was to be found.

The mac driver for the webcam is known as macam btw.