Wednesday, December 22, 2021

Colour your sound using Snap!

A computer program that transforms sound into colour and then colour back into sound would be sure to blow a few minds.

What happens then: Fun! Learning! Unpredictable but interesting pathways!

I encountered this briefly through Jay Silver / Eric Rosenbuam (who I think of as the very clever hippy digital innovators) and then later through Jens Monig (Snap! developer). I'll write up the Jens version for now and add some references from the creative hippie pair to write up later. I can see this blossoming into a fun, innovative course.

If you prefer go straight to the Snap! program (Whistle Draw) and explanatory video by Jens

Jen is a master of Snap! and I learnt a lot as well as having much fun in emulating his program. I'll document it here since I'm planning to use it at school.

The Synesthetic pair here is sound and colour. At first sound produces colour and then the process is reversed so that colour produces sound

I'm including some preliminaries and extra explanation which Jen leaves out. With Snap! colours I find it necessary to check the defaults so that the colours work. I set the pen saturation and brightness to 100 and transparency to 0. Then if hue is set to 0 it shows red and changing hue through 0 to 100 goes through a ROYGBIV spectrum.
The colours are working as they should be so now we investigate and calibrate the microphone:
I whistled a tune into the microphone and observed the range of frequencies. Since they started at around 700 Hz I subtracted 700 to obtain a starting point of zero. Then I divided by 10 so as to roughly bring the values into a 0 to 100 range. This range coincides with the full range of colour values in Snap! Here is the calibrated microphone:
Next up, write a procedure that will produce variations in colour depending on the sound frequency:
I inexpertly whistled "Twinkle twinkle little star" and recorded the colours by moving the mouse. It looked like this:
You have to untick the sprite's draggable box. This held me up for a while so I'll offer an explanation.

In everyday usage when the pen is down we want to be able to drag the sprite without drawing. That could be inconvenient. When the draggable box is unticked the sprite disappears. You can show it by right click > show on the sprite but can't drag it. When you run the procedure forever [go to mouse pointer] the sprite does show and follows the mouse pointer (not the same as being dragged)

When the pen is down and you run forever [go to mouse pointer]:
  • When draggable box is ticked drawing happens with mouse up but not mouse down.
  • When draggable box is unticked drawing happens with both mouse up and mouse down (the behaviour we want for this program)
Then I wrote a procedure that could play it back. This is the inverse of the earlier procedure, this time converting colour to sound:
Then when I ran my mouse over the image (with mouse down) my inexpert tune played back!

Finally, Jens shows how to save the image so you can try new ones and return to the saved ones later. Click on the Stage and run this code:
You can see the image is saved under the Costumes tab!

Jens goes onto make a piano by whistling the correct notes. But even if you can't whistle well (like me) all you have to do is put blobs of ROYGBIV on the screen to make a piano that might work. Try it and see.

Here is the Snap! Colour your Sound program I ended up with.

When I read up on the earlier work by Jay and Eric (references below) I can envisage lots of new themes emerging from Jen's program. I'll try to get back to this later.

LENS X BLOCK: World as Construction Kit Jay Silver PhD thesis
Eric Rosenbaum: Designing for Creative Play
NB their explanatory notes
colour code
(and there are more Jay Silver videos on the sidebar)

Saturday, December 11, 2021

from Beetle Blocks to a 3D print

I finally got my hands on a 3D printer and have printed a type of project which I think will be suitable for classroom use.

When you talk to teachers who use 3D printers they say a big problem is that they are slow. This makes them impractical since all the students want to print.

But if you print 2D shapes with a small height then that is a lot quicker.

Josh Burker has an introductory 3D print project in his “Invent to Learn Guide to More Fun” book. A rotated heptagon makes an attractive pattern. Maths and Art combined.

Josh used Beetle Blocks to make the rotated heptagon project. It is SNAP-like code. First you make a heptagon block using 360/7 as the angle. Then you spin that block ten times on the z axis,
repeat 10 [rotate z by 36]. Some great maths learning here.

I spoke to a very helpful teacher in Melbourne (thanks Veena) who runs a class with eight 3D printers. She said that the Flashforge CreatorPro2 was a worthwhile buy. They run 24/7 at her school.

My school bought a Flashforge and I setup our new printer. A couple of YouTube videos were very helpful

FlashForge Creator Pro 2 IDEX 3D Printer Review and Test
IDEX 3d Printer Review | Flashforge Creator Pro 2

A boring test print which came with the machine worked ok:

Then I tried the rotated heptagon. It printed with a base and was too small. So I had to read the printer manual to work out the correct settings.

On the third try I was happy with the outcome.
The print took 20 minutes. This is quick for a 3D printer but still not quick enough for a classroom setting. I can see why Veena has eight of them.

This is my first 3D print where I wrote the code and did the printing.

Notes on software function and formats:
You can save Beetle Blocks files in XML format and STL formats. The XML (Extensible Markup Languge) is for going back later and editing the software which made the shape. The STL stands for Sterolithography or Standard Triangle Language or Standard Tesselation Language. This is probably the most commonly used format for 3D printing.

The Flashforge program that reads the STL file is Flashprint. You can edit the STL in Flashprint. eg. view it from different perspectives, move it, rotate it, scale it etc. You then send the file to slicer software which has other features, eg. Raft, enable Wall, enable Brim and much more. I had to read the manual to understand these important features. The Flashforge slicer software format is *.gx. It's proprietary. The generic name for these sorts of files is G-code. The G-Code tells the printer what to do, where to move, how fast to move, and what path to follow.

Burker, Josh. The Invent to Learn Guide to MORE Fun: Classroom Technology Project (2018)
The Beetle Blocks Primer pdf, 68pp
Eric Rosenbaum website. Eric is one of the makers of Beetle Blocks. A very interesting person. He is also a co-creator of Makey Makey and is a digital music innovator. Click on the Media link to see his talks and papers.