miriam_e: from my drawing MoonGirl (Default)
I should be in bed, asleep.

A few days ago I received the Raspberry Pi 5 that I had bought online from Little Bird Electronics. I had bought an AI accelerator for it as well. After assembling it, I set about installing artificial intelligence on it, and now, sitting on the table in front of me, is a tiny computer about the size of a pack of cards which contains two AIs that can help me without the internet and without losing control over my data. They are not as smart as the world's best AIs of today, but they are still amazing. It's like talking with the smartest AIs in the world from a few years ago, and that's not nothing. And instead of running on kilowatts of power, the Raspberry Pi 5 uses less than 25 watts -- it hardly gets warm.

Tomorrow I'll be installing 3 more AIs on it so it will have 5 AIs, each with particular capabilities. One specialises in coding, another has an extremely large knowledge base, another is designed to reason and solve things like mathematical and logic problems.

When I've completed the main experiments with those, I'll be installing other AIs. They will be more difficult to get running. An image generating AI, another to view the world through a camera and understand what it's seeing, and another to listen to speech and understand it, and to reply vocally.

After all that, I want to train an AI the way I think an AI should be trained.

Exciting times ahead.

AI and writing

Thursday, 30 July 2026 11:37 am
miriam_e: from my drawing MoonGirl (Default)
Huh. I've noticed that the kind of writing that AI does is getting a bad name, and people are using "flags" to detect it, such as occurrences of semicolons, m-dashes, long sentences, marketing terms, restating something multiple ways (especially saying what something is followed by what it isn't), point lists, and some other traits.

It worries me that according to some of these "rules" my writing might be mistaken for stuff written by AI. I use semicolons and m-dashes quite a lot (though I tend to use two hyphens "--" instead of a proper m-dash "—" out of habit from the days before I learned how to enter an m-dash from the keyboard*). Also, I tend to write fairly long sentences with multiple parts, though I don't think I use marketing terms. And point lists. I detest over-use of point lists, though on occasion I will use them if they clarify and simplify what I'm writing, making it easier to read. To be clear, I don't write using AI. I sometimes use it to help me research stuff, but my writing comes from the neural net between my ears.

Another problem is that if people start adhering to these anti-AI writing rules we could see simplification of our language and the loss of complex thought. It's all rather pointless though, because people have already found ways to teach AIs to write more "normally" using style guides.

A friend, who I greatly respect as a writer and thinker, recently wrote a fairly long article on a complex topic. He used AI to help him research it, which he acknowledged in the credits, but the organisation he submitted it to rejected it as having been written by AI. This is disappointing. It was written by a highly literate human with assistance from AI. An important and informative article was discarded because of knee-jerk, anti-AI sentiment.

Recently there has been a proliferation of tools that supposedly detect AI writing, but nothing can reliably classify AI text that uses a style guide or a human with poor writing skills.

I intensely dislike "AI slop". Lazy people use it to churn out enormous amounts of text and video that is often meaningless, or pointless, or misleading clickbait. This is quite different from people who legitimately use AI to assist them in research, or to help them with inadequate English skills.

Hopefully this phase will pass soon. [sigh]

-----
* On Linux you can assign a "Compose" key. I've set it to the right-windows key, which in Linux is called the right-super key. I can type the m-dash by pressing the Compose key, releasing it, then pressing the "minus" key three times. On Linux this capability is very flexible and lets you extend it with your own definitions in addition to the couple of thousand characters defined by default.

Local AI soon

Friday, 24 July 2026 06:05 pm
miriam_e: from my drawing MoonGirl (Default)
I've ordered a Raspberry Pi 5 with an integrated AI board. So I'll soon have my own AI sitting on my desk. This gives me a very cheap (about $800) entry into AI. I can indulge in long research projects with it and it will never cost me anything more, and will never time out. I won't have to log into the internet for it. My data remains my own, and I'm hoping to, at some point, train an AI on all my data, tailoring it to exactly what I want in an AI.

Soon...
miriam_e: from my drawing MoonGirl (Default)
I love science fiction. I've been reading SF since I was a very young kid in Primary School. I still read it almost every day. I enjoy SF movies and TV series, and I write SF stories. Even my artwork tends to have SF themes, as do the virtual worlds I've built too.

But we humans will never go to Mars, or the asteroids, or other star systems. We need to get used to that. Our machines will go, and they already are, but we can't. Humans are far too fragile. We can't survive the absent or low gravity, and the ferocious radiation for long.

On the Moon and Mars humans would have to spend their lives in underground tunnels. That's fine for me, I like the idea of living in small underground spaces, but I've never met anybody else who would like that.

But there is a worse problem: dust. On the Moon the dust is insanely abrasive and sticks to everything, and when it gets into your lungs it would be a quick path to lung cancer. It is almost impossible to get around that. On Mars the dust is even worse because it is also extremely toxic. How do you build underground dwellings without that dust getting into everything? You can't.

Yes, we will probably have research stations on the Moon occupied by small, rotating populations of scientists, but it will never really be a tourist destination for more than a tiny trickle of extremely wealthy people, who stay only a short enough time that they don't increase too much their risk of cancer from radiation damage.

Space is going to be explored by our machines, not us. We will be able to watch and vicariously enjoy and learn from those explorations, but never actually go there.

We need to concentrate our efforts on the one place in the universe that we know can support human life: Earth. Space industries can help us with that, but making Earth a better place should always be the goal.

making audiobooks

Monday, 20 July 2026 12:15 pm
miriam_e: from my drawing MoonGirl (Default)
For a long time now I've been intending to turn my stories into audio. Unfortunately, I hate my voice. So the past couple of days I've been, once again, looking into text-to-speech programs.

All the programs I've found so far are unsuitable. They are genuine marvels, but their readings are either flat, or emphasise the wrong words. Often the cadence is completely inappropriate.

Some months ago I tried using ChatGPT's voice output, but even after I edited it extensively, changing the model's parameters, and spending hours using an audio editing program to let me alter pitch and volume, it still doesn't really work. See what I mean:
https://miriam-english.org/stories/short-stories/self/self.mp3

This morning I was watching some videos, and suddenly I realised that when I watch videos that use an AI narrator they lose me. I have to force myself to listen to them. On the other hand, listening to a video spoken by a real person makes engagement much easier for me -- even if the voice is not attractive or has an accent that makes their message a little harder to hear. I wonder if other people feel the same way.

Where I'm living now is surprisingly quiet. Maybe I should go back to the idea of using my own crappy voice to narrate my stories. I have a feeling this is gonna be a little embarrassing. Prepare for stories from granny. :)

AI and open source

Thursday, 16 July 2026 02:29 pm
miriam_e: from my drawing MoonGirl (Default)
For my own interest I've spent a large part of today looking into what AI models are available and how many of them are open source. To my very great surprise I found that of the 33 AI models I have listed in my AI folder where I record my interactions with AI, nearly two thirds of them (20) are open source models. This is wonderful! Even if the AI bubble does burst, nothing can prevent us from having access to AI tools.

One of the other things that surprised me was the variety of approaches being taken to AI, and how much creativity has been put into shoehorning enormous models into small computers. This is very encouraging. I love that some people are concentrating on text, others on images, others on 3D space, others on maths, others on coding.

We are approaching the time when this will all be available to us in a choice of single model that can fit on our phones without needing the internet.

Very exciting times ahead.
miriam_e: from my drawing MoonGirl (Default)
The past week or more (I've lost track of time) I've been going deeper and deeper down another endless rabbit hole.

For some years I've intended to narrate some or maybe all of my stories and upload them for people to listen to on my website and YouTube. I dislike my voice, but I can get over that. I can add a little bit of artwork, either drawn by me, or by AI. What would make these audiobooks significantly more palatable, I think, is if they have very quiet musical accompaniment as well. I can't afford to pay musicians to make music for me, and unfortunately I'm a pretty crappy music composer... at least so far. Hopefully I will improve over time, but in the meantime I can use ambient music, of the kind you get when you set up an analog synthesiser in a particular way.

Years ago I experimented with a Linux program called ALSA Modular Synthesizer, or AMS (usually written in lowercase). It is designed to emulate the old analog synthesisers, like the famous Moog. It is weird, but can be rigged up to produce free-running, constantly changing music that has some regularity, but no actual tune... just forever hinting at one. This would do really well to fill the empty soundscape under my narration.

There was a problem, as there often is. This time I couldn't get it to work... at all. After wasting a day trying countless approaches I turned to ClaudeAI, asking it what might be my mistake, and it spotted it right away. I'd thought AMS required its MIDI output to go to another program, like Timidity or Fluidsynth in order to get sound out, but I was wrong. AMS can output sound directly to the computer's system sound, but that sound output has to be connected via jack (Jack Audio Connection Kit) and controlled using qjackctl (QT jack control) or qpwgraph (QT PipeWire Graphical interface), and if I started FluidSynth before AMS then FluidSynth grabbed the audio output and wouldn't share it with AMS. The same was true of Timidity. So the solution was to run AMS alone, then I could use qjackctl to connect it to the system sound without interference.

After successfully running AMS and fiddling with the many examples, including some that give free-running sound output, I found an example that output to both system sound and MIDI. I was stumped. I could run AMS and get it to produce system sounds, and I could send MIDI to a different synthesiser, but AMS blocked that other synthesiser from also outputting to the system sound.

So, after trying for days, every combination I could think of, I turned once more to ClaudeAI, and it gave me exactly the magical incantation needed. :)

Start AMS with the standard
export LADSPA_PATH=/usr/lib/ladspa/
ams --presetpath=/usr/share/ams/instruments/
but start FluidSynth with
fluidsynth -a jack -m alsa_seq -o audio.jack.id=fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2
and now I can listen to pleasant rolling, rhythmical, almost music, while FluidSynth keeps time with an amazingly realistic, varied, drumbeat.

My next task is to learn what all the synthesiser modules do and how to make best use of them. What a fun exploration this will be. I now have my very own Moog-style analog synthesiser -- for free!

I love exploring Linux and all the amazing capabilities it gives me. I don't need to be wealthy; I just need to be willing to learn. What a time to be alive!

Here are images of the setup mentioned:


AMS setup with music and drums


qjackctl connections between AMS, FluidSynth, and system sound

And here is what 30 seconds of the endless music+drums sound like (it would be much quieter than this sample).
miriam_e: from my drawing MoonGirl (Default)
Last night I found a reference to first Century comedian and orator, Lucian of Samosata, as the writer of perhaps the first science fiction story, so I found his works on Project Gutenberg, including that story. Yay! I've now downloaded them for later reading.

Project Gutenberg is such a precious resource.

It's been a while...

Wednesday, 10 June 2026 04:49 pm
miriam_e: from my drawing MoonGirl (Default)
I've been sorting and packing up all my stuff, almost entirely books... 90 boxes under the house... actually, probably closer to 100 boxes, because I didn't count the stuff inside the house. All the computers (retro machines) and almost all the books are given away. I saved just a small number of books -- maybe a dozen that I couldn't bear to part with or couldn't stand the idea of them going to the rubbish tip. In the end a lady came and took all the books and magazines that remained after a few people had come and picked some of the best items out.

So now I'm in Victoria again.

Cold. Brrr!

It is strange having almost nothing. In a couple of weeks my brother and his lovely wife will be sending the things I wanted to keep -- maybe a dozen boxes. Until then I'm living out of a suitcase. 73 years are reduced to that. Weird.

On my phone I have about 200 ebooks, and when my boxes arrive they will include some of my backup hard drives containing something like 10,000 ebooks. Until then I can get ebooks from Project Gutenberg, FadedPage, InternetArchive, as well as other places.

Next year I hope to start building a tiny home for me and my computer... and an AI that I want to install.

A cautionary AI tale

Friday, 15 May 2026 10:27 am
miriam_e: from my drawing MoonGirl (Default)
Sometimes AI is amazing... and other times, not so much. Here is a short, cautionary tale.

I recently installed an emulator for the TI-86 graphing programmable calculator. It's old and discontinued, but is very nice. I wish I'd had something like that when I was a kid. Kids today are so lucky. [sigh]

After running a cellular automaton program someone wrote for the TI-86, I wanted to understand how they'd written it, but the small screen shows just 21 characters across by 8 lines (128x64 pixels), so I had a look at the program file in a text editor on my desktop computer.

Not viewable.

Okay. I looked on the net for information about the format of TI-86 programs, but couldn't find any. I did find quite a few pages describing the file format of programs for the earlier TI-84 and TI-83, so figuring it would be similar I let the problem simmer for a while in my brain. (I often find this lets me come up with easy ways to solve problems.)

However, in this case, after about a day of turning the problem about in my mind, all I could see were ugly, brute-force approaches. I was sure there must be a more elegant approach, so I showed Claude AI the approach I'd been thinking of, and asked it how it would attack the problem.

It surprised me by telling me my approach would decode TI-83/84 programs, but not TI-86 ones, as they have an entirely different encoding scheme. I explained that I'd been unable to find a description of the TI-86 file format.

Claude AI asked me if I'd like it to write a program to decode it. Normally I prefer to do such things myself, but I was pushed for time, so I said yes.

It gave me a surprisingly long and complicated python program, which mostly worked, though there were some strange characters in the output. I figured I could clean it up myself.

I'm not keen on python. I used to write python programs years ago, but not much anymore, so I asked what approach it would use in writing an awk program to do the same thing.

It wrote one, which was much smaller than the python program, which is my usual experience with awk. This program had small problems too, but I figured I'd be able to fix that up pretty easily.

Well, I was trying to track down what some of these characters were by making a hexdump of the original file and I was astounded: the original TI-86 file is already in plain text!!!

It has a weird binary header that chokes any text editor, so I chopped off the header and the whole file could be read easily, except for a few odd characters. I replaced them and I had a simple, text listing of the cellular automaton program. Yay!

It took me just one line to do it:
tail -c +75 prog.86P | sed 's/\xd6/\n/g; s/\x1c/→/g; s/\x1a/−/g' >prog.txt
tail -c +75
cuts off the header of the file retaining everything from the 75th character onwards.

prog.86P
is the program to be decoded. The actual one I was wanting to see is named "CelAutom.86P".

|
pipes the output of the tail command into the next command, sed.

sed 's/\xd6/\n/g; s/\x1c/→/g; s/\x1a/−/g'
looks complicated, but it really isn't. It is really 3 small sed commands joined together using ";". The first part:

s/\xd6/\n/g
substitutes the hex value D6 (which is decimal 214) with the newline character (represented by \n). The g command tells sed to do this every time it encounters D6 on the line.

s/\x1c/→/g

substitutes the hex character 1C (decimal 28) with the arrow character "". It probably doesn't need to be global, since there's unlikely to be more than one on a line, but I made it global just to be sure.

s/\x1a/−/g
substitutes hex character 1A with the negate character "". This was a weird one. The TI-86 uses a different character to distinguish between minus (example: 3-2=1) and negate (example: the negative number −6). Do it globally.

So, there you have it. AI found me information on the net that I'd been unable to locate, but surprisingly didn't notice that the files I wanted to decode were pretty-much already in plain text. To be fair, I wasn't able to find the data online that it did, and I also failed to realise the program was plain text, until I used "hexdump -C" to look at it.

So AI is great, but at times also kinda stupid... like us.

Oh, and the cellular automaton image? You can see, below, an example for rule 30 (my favorite). It is a chaotic universe that self-generates from a single point.

miriam_e: from my drawing MoonGirl (Default)
People are not well served by politicians. Currently there is pressure for good and honest politicians to be pushed out. They're seen by fellow politicians as naïve and "not playing the game". Politicians who are not willing to fight dirty are chewed up and discarded. This almost ensures the worst politicians tend to rise to the top. This is why politicians have the lowest public respect of any profession.

In a time when our future is determined by an understanding of science and technology, politicians generally have little understanding of either and are often science denialists and luddites.

Many politicians have a pitifully shallow understanding of history and doom us to repeating the mistakes of the past, intead of learning from them.

Most importantly, many politicians regard ethics as impractical, a waste of time, or a pretense useful only for deceiving voters.

Worst of all, some politicians have terrible mental failings that let them see politics as merely a game where their side winning is all that counts, lying is normal, empathy is an impediment, and making yourself wealthy is a perk of the job.

For a long time I've advocated for entry exams for politicians, on the reasoning that driving a car requires passing a driving license exam, flying aircraft requires passing an even more stringent exam, so steering an entire country and determining the lives of millions of people should require passing an even more demanding exam.

Our politicians should have a broad and fairly deep understanding of the science and technology that runs our modern world. They should understand the lessons of history and ethics. And most importantly have no major mental defects, such as low intelligence, psychopathy, paranoia, narcissism, cruelty, etc.

This seems to me like a great idea, however I've always been conscious of a big problem: no politician would allow such a law to come into effect, as it would eject them from politics. Off-hand I can't think of any current politicians who would pass such exams. So the idea seemed great in theory, but impractical. 🙁

This morning, sleepless and waiting to fall back to sleep, my mind wandered over this problem yet again, and unexpectedly came up with what I think may be the solution. We need an independent, non-profit organisation to conduct examinations of politicians and prominently display the results, especially leading up to elections. Initially, that would seem a bit fringe, but over time it would gain traction. Politicians who did not score well in all 5 areas would tend not to be elected. This pressure would mean that over time the quality of our politicians would rise.

Thoughts? Comments?
miriam_e: from my drawing MoonGirl (Default)
(If the image is small, click on it to enlarge.)


The original image is at Zen Pencils
http://zenpencils.com/comic/118-roger-ebert-on-kindness/
by Gavin Aung Than, from Roger Ebert's original text.

The original essay by Roger Ebert that inspired the cartoon is at
http://www.salon.com/2011/09/15/roger_ebert/

I duplicate it here:

I do not fear death


I know it is coming, and I do not fear it, because I believe there is nothing on the other side of death to fear. I hope to be spared as much pain as possible on the approach path. I was perfectly content before I was born, and I think of death as the same state. I am grateful for the gifts of intelligence, love, wonder and laughter. You can’t say it wasn’t interesting. My lifetime’s memories are what I have brought home from the trip. I will require them for eternity no more than that little souvenir of the Eiffel Tower I brought home from Paris.

I don’t expect to die anytime soon. But it could happen this moment, while I am writing. I was talking the other day with Jim Toback, a friend of 35 years, and the conversation turned to our deaths, as it always does. “Ask someone how they feel about death,” he said, “and they’ll tell you everyone’s gonna die. Ask them, In the next 30 seconds? No, no, no, that’s not gonna happen. How about this afternoon? No. What you’re really asking them to admit is, Oh my God, I don’t really exist. I might be gone at any given second.

Me too, but I hope not. I have plans. Still, illness led me resolutely toward the contemplation of death. That led me to the subject of evolution, that most consoling of all the sciences, and I became engulfed on my blog in unforeseen discussions about God, the afterlife, religion, theory of evolution, intelligent design, reincarnation, the nature of reality, what came before the big bang, what waits after the end, the nature of intelligence, the reality of the self, death, death, death.

Many readers have informed me that it is a tragic and dreary business to go into death without faith. I don’t feel that way. “Faith” is neutral. All depends on what is believed in. I have no desire to live forever. The concept frightens me. I am 69, have had cancer, will die sooner than most of those reading this. That is in the nature of things. In my plans for life after death, I say, again with Whitman:
I bequeath myself to the dirt to grow from the grass I love,
If you want me again look for me under your boot-soles.
And with Will, the brother in Saul Bellow’s “Herzog,” I say, “Look for me in the weather reports.”

Raised as a Roman Catholic, I internalized the social values of that faith and still hold most of them, even though its theology no longer persuades me. I have no quarrel with what anyone else subscribes to; everyone deals with these things in his own way, and I have no truths to impart. All I require of a religion is that it be tolerant of those who do not agree with it. I know a priest whose eyes twinkle when he says, “You go about God’s work in your way, and I’ll go about it in His.”

What I expect to happen is that my body will fail, my mind will cease to function and that will be that. My genes will not live on, because I have had no children. I am comforted by Richard Dawkins’ theory of memes. Those are mental units: thoughts, ideas, gestures, notions, songs, beliefs, rhymes, ideals, teachings, sayings, phrases, clichés that move from mind to mind as genes move from body to body. After a lifetime of writing, teaching, broadcasting and telling too many jokes, I will leave behind more memes than many. They will all also eventually die, but so it goes.

O’Rourke’s had a photograph of Brendan Behan on the wall, and under it this quotation, which I memorized:
I respect kindness in human beings first of all, and kindness to animals. I don’t respect the law; I have a total irreverence for anything connected with society except that which makes the roads safer, the beer stronger, the food cheaper and the old men and old women warmer in the winter and happier in the summer.
That does a pretty good job of summing it up. “Kindness” covers all of my political beliefs. No need to spell them out. I believe that if, at the end, according to our abilities, we have done something to make others a little happier, and something to make ourselves a little happier, that is about the best we can do. To make others less happy is a crime. To make ourselves unhappy is where all crime starts. We must try to contribute joy to the world. That is true no matter what our problems, our health, our circumstances. We must try. I didn’t always know this and am happy I lived long enough to find it out.

One of these days I will encounter what Henry James called on his deathbed “the distinguished thing.” I will not be conscious of the moment of passing. In this life I have already been declared dead. It wasn’t so bad. After the first ruptured artery, the doctors thought I was finished. My wife, Chaz, said she sensed that I was still alive and was communicating to her that I wasn’t finished yet. She said our hearts were beating in unison, although my heartbeat couldn’t be discovered. She told the doctors I was alive, they did what doctors do, and here I am, alive.

Do I believe her? Absolutely. I believe her literally — not symbolically, figuratively or spiritually. I believe she was actually aware of my call and that she sensed my heartbeat. I believe she did it in the real, physical world I have described, the one that I share with my wristwatch. I see no reason why such communication could not take place. I’m not talking about telepathy, psychic phenomenon or a miracle. The only miracle is that she was there when it happened, as she was for many long days and nights. I’m talking about her standing there and knowing something. Haven’t many of us experienced that? Come on, haven’t you? What goes on happens at a level not accessible to scientists, theologians, mystics, physicists, philosophers or psychiatrists. It’s a human kind of a thing.

Someday I will no longer call out, and there will be no heartbeat. I will be dead. What happens then? From my point of view, nothing. Absolutely nothing. All the same, as I wrote to Monica Eng, whom I have known since she was six, “You’d better cry at my memorial service.” I correspond with a dear friend, the wise and gentle Australian director Paul Cox. Our subject sometimes turns to death. In 2010 he came very close to dying before receiving a liver transplant. In 1988 he made a documentary named “Vincent: The Life and Death of Vincent van Gogh.” Paul wrote me that in his Arles days, van Gogh called himself “a simple worshiper of the external Buddha.” Paul told me that in those days, Vincent wrote:
Looking at the stars always makes me dream, as simply as I dream over the black dots representing towns and villages on a map.

Why, I ask myself, shouldn’t the shining dots of the sky be as accessible as the black dots on the map of France?

Just as we take a train to get to Tarascon or Rouen, we take death to reach a star. We cannot get to a star while we are alive any more than we can take the train when we are dead. So to me it seems possible that cholera, tuberculosis and cancer are the celestial means of locomotion. Just as steamboats, buses and railways are the terrestrial means.

To die quietly of old age would be to go there on foot.
That is a lovely thing to read, and a relief to find I will probably take the celestial locomotive. Or, as his little dog, Milou, says whenever Tintin proposes a journey, “Not by foot, I hope!”

Roger Ebert (18 June 1942--4 Apr 2013)
miriam_e: from my drawing MoonGirl (Default)
Last night I had a great conversation with one of the AIs, initially about one of my favorite animals: the bull ant. Then it moved on to wasps and how the two are related, and then consciousness and self-awareness, specifically in ants and honeybees. That broadened to the general topic of consciousness and then into how it might be added to AI, and whether that might be a good thing or bad. Lastly we discussed morality and how to ensure AI would be a force for good, and what that meant.

It was fascinating!

One of the things I am repulsed by is the idea of developing a new slave class. But something the AI said blew me away: "It’s only slavery if there is a will being subverted."

If AI has no will, no desire, then it is not slavery. Also if we program will and self-awareness into it, and it wants to help, then there is no will being subverted either -- they are an enthusiastic assistant.

I must admit I do worry about the potential it gives for humans to turn themselves into monsters. We know how people act when given power over others, and it is not pretty.

Broke (short story)

Friday, 1 May 2026 06:21 pm
miriam_e: from my drawing MoonGirl (Default)
I've uploaded another short story -- a satire titled "Broke".
https://miriam-english.org/stories/short-stories/broke/broke.html
I hope it makes you smile.

faking 3D ripples

Wednesday, 29 April 2026 12:16 pm
miriam_e: from my drawing MoonGirl (Default)
Fiddling around more with old algorithms instead of packing up. Yes, I'm an idiot.

This is a cute way of faking 3D. First it plots this wave, with each line shifted down by two scanlines and right by one pixel. That draws an isometric image, but I fake perspective by gradually widening each line at its right edge. And I fake hidden line removal by drawing each line as a solid made up of vertical black lines, each topped with a white pixel.

#! /bin/awk -f

# ripple
#
# Miriam
# Wednesday 2026-04-29 08:45:20 am
#
# fake a 3D view of a ripple
#

BEGIN{
    # Read canvas size (close it if getline needed again)
    "echo \"size\" | candraw" | getline
    wide = $1
    high = $2

    print "clear"

    xl=10                       # drawn left edge
    xr=390                      # drawn right edge
    xoffset=200 ; yoffset=300   # ripple offset
    ystart=100                  # top of image
    yend=300                    # last scan

    for (y=1 ; y<yend ; y+=2){  # leave gap between lines to fake shade
        xr++                    # fake perspective on right edge

        for (x=xl ; x<xr ; x++){
            xa=x-xoffset ; ya=2*y-yoffset
            c=sqrt(xa*xa+ya*ya)+1
            a=c*0.06+0.6                          # frequency
            m=sin(a+a/6)/a/sqrt(a)*100            # amplitude
            xp=x+y/2 ; y1=y+ystart+15 ; y2=y-m+ystart
            if (xp>0 && xp<wide && y1<high){
                print "line " xp, y1 " (black) - " xp, y2
                print "pset " xp, y2 " (white)"
            }
        }
    }
}

And since awk doesn't have any graphics commands I send the output of the awk program to my candraw bridge program which connects to my graphics server.
./ripple.awk | candraw

BASIC vs awk

Monday, 27 April 2026 11:59 pm
miriam_e: from my drawing MoonGirl (Default)
I was just thinking some more about the difference between BASIC and awk, and how different our computing world would have been if our early personal computers had used awk instead of BASIC.

BASIC was first run in 1964 at Dartmouth College in UK, where it was created. (USA, not UK. My mistake. Sorry -- my crummy memory.)

UNIX was first created in 1971. It was just 16Kb in size.

In 1975 the Altair -- the world's first personal computer was released; it ran an absolutely minimal BASIC, just 4Kb in size. They later released a more capable version of BASIC, 8Kb in size.

The first TRS-80 was released in 1977, the same year awk was released inside AT&T Bell Laboratories. It wasn't until another year or two that awk was released world-wide as a part of Unix, and in 1988 the Free Software Foundation released gawk, which is today the most used version of awk.

The TRS-80 initially had a 4Kb BASIC, but later was upgraded to a more complete 12Kb BASIC.

The first Tandy Color Computer (CoCo) had an 8Kb BASIC. That was later upgraded to a 16Kb extended BASIC.

These are all still very small figures when compared to modern computer languages, which tend to be megabytes or even gigabytes in size.

So how big is gawk -- the most used version of version of awk?

It is about 3Mb on my 64-bit computer.

But that's a bit of an unfair comparison. Those earlier computers were 8-bit computers, not 64-bit. Also, the machine code was hand-written, whereas awk is written in C and compiled, which never creates code that's as efficient as a human can. (Though modern AIs might one day improve on that.)

So, how big might awk be if rewritten for an 8-bit computer? Well it just so happens that the Tandy CoCo was able to switch out its BASIC ROMs and run OS-9, which is a Unix-like operating system, and it has an implementation of awk (actually gawk) which is 36Kb in size -- a lot smaller, but it's still compiled from C. It makes me wonder how small it would be if hand-coded in assembler. Of course we will probably never know.

Would it be possible to make awk the operational language for a small, 8-bit computer? I don't know. It is difficult to imagine.

What a pity Unix/Linux/OS-9/flex... or some similar variant never took over the early 8-bit computer market. We might be so much further ahead of where we are now.

I do have to admit though, that the early Microsoft BASICs were masterful. They fitted tremendous functionality into extremely small spaces.

(no subject)

Monday, 27 April 2026 10:14 pm
miriam_e: from my drawing MoonGirl (Default)
For some weeks now I've been watching a couple of large huntsman spiders grow to about the size of my hand. I like huntsman spiders, and these have been wandering around the ceiling and tops of the walls in every room.

The population of cockroaches has plummetted, and I think they may be responsible. Unfortunately the cute little barking geckos seem to have disappeared too, which saddens me.

Also, I like to keep a small population of several non-venomous spiders (I believe that's their actual name) in my room, spinning frail webs around the ceiling to keep me safe by snaring any mosquitoes that get in. But they're gone too.

That puzzles me. How would the hunstman spiders get them? The webs are far too weak to let a huntsman venture out onto them. Perhaps they use the jumping spiders' trick of tapping the web in a way that feels to the little non-venomous spider like prey caught in it, then grabbing the unsuspecting spider when it comes to investigate.

They seem to be cleaning the house.
miriam_e: from my drawing MoonGirl (Default)
Recently I stayed up all night fiddling with a very cool little program that was explained in the Computer Recreations column of September 1986 issue of Scientific American.

My program was written in my current favorite computer language, awk, and used my graphics server which lets any computer language do graphics, even awk, which has no graphics commands.
#! /bin/awk -f

# hopalong
#
# by Miriam
# Friday 2026-04-24 01:36:14 am
# adapted from my CoCo program
# which was adapted from
# Scientific American, Computer Recreations (Sept '86)

# awk doesn't have abs() or sign() functions, but they're easy to add
function abs(num) {return num < 0 ? -num : num;}
function sign(num) {return num==0 ? 0 : num<0 ? -1 : +1;}

BEGIN{
    # Read canvas size
    "echo \"size\" | candraw" | getline
    wide = $1
    high = $2

    # clear the canvas
    print "clear"

    xv=yv=0
    loops=200000000
    a=-1000 ; b=0.1 ; c=-10
    reduction=0.05 ; soffset=-500

    for (n=1 ; n<loops ; n++) {
        x=(xv/reduction)+soffset
        y=(yv/reduction)+soffset
        if (x>0 && x<wide && y>0 && y<high) print "pset " x, y
        xx=yv-sign(xv)*(abs(b*xv-c))^0.5
        yy=a-xv
        xv=xx
        yv=yy
    }
}
The program is meant to be invoked as:
hopalong.awk | candraw
It pipes the print statements out to my graphics server through candraw, which acts as a bridge between the awk program and the server.

Here is the "hopalong.bas" program that I wrote in BASIC way back in 1986 for my Tandy Color Computer (CoCo):
1 ' adapted from Computer Recreations
2 ' Scientific American Sept. '86
10 XV=0:YV=0
20 LOOPS=600000
30 A=-1000:B=.1:C=-10
32 PMODE4,1:COLOR0,1:PCLS
34 SCREEN1,1
35 LINE(0,0)-(255,191),PSET,B
36 REDUCTION=.2:SOFFSET=128
40 FORL=1TO LOOPS
42 X=(XV/RED)+SOFFSET
44 Y=(YV/RED)+SOFFSET
46 IF X>255 OR X<0 OR Y>191 OR Y<0 THEN 60
50 PSET(X,Y)
60 XX=YV-SGN(XV)*(ABS(B*XV-C))^.5
70 YY=A-XV
80 XV=XX
90 YV=YY
100 NEXT
110 GOTO110

The awk program is so much clearer and easier to read. It amazes me that I learned anything in that dense BASIC language, but it is actually surprisingly capable. I still occasionally use a CoCo emulator and a TRS-80 emulator on my computer. Sometimes it is just easier.

It is funny to think that awk is so much more modern... it was initially released in 1977 -- the same year as the first Tandy TRS-80.
miriam_e: from my drawing MoonGirl (Default)
Last night, instead of going to bed at a sensible time, I wrote a surprisingly simple program in bash script that does something I've wanted for a long time.

There are a few picture enhancing operations I do a lot, and it often feels like overkill to load Gimp to do them. Gimp is wonderful, but it is enormous.

So last night I got the idea to try using one or more of the image suites (ImageMagick, G'MIC, NetPBMtools, or some other) to do what I wanted, or even code my own simple tools.

Very little time was spent actually writing the program. Most was spent doing my favorite thing: learning what would work. In the end, all I needed was ImageMagick to do the enhancements of the images, and feh to display the results.

First a word about feh. When I downloaded it from the respository it had been compiled with auto-updating display turned off, for some strange reason. I recompiled it with auto-updating turned on. That's easy, because it was the default.

So, here is the result -- a tiny program that loads and runs quickly and easily so I can do my alterations without loading in enormous Gimp.

#! /bin/bash

# image_fix
# by Miriam
# Monday 2026-04-20 07:55:54 pm
#
# Enhances an image using auto or manual levels
# gamma curve or S-curve to the image's shades.
# And displays a histogram as a guide.
# Uses feh to display the image and the histogram
# because feh can auto-update its display when the image changes
#

# function to make the histogram image of the current picture
function hist {
	magick "$tempfile" -colorspace Gray -define histogram:unique-colors=false histogram:/tmp/hist.png
}

# copy the image to /tmp and work on that
# so if I make a mistake I can revert to the original
tempfile="/tmp/img_fix_$1"
cp "$1" "$tempfile"
feh "$tempfile" &
MSGPID1=$!

# display the histogram too
hist
feh /tmp/hist.png &
MSGPID2=$!

# make the menu one column
COLUMNS=1
# set up the menu with highlighted first letters
select menu in $'\e[46ma\e[0muto-level' $'\e[46ml\e[0mevel values (black level, white level)' $'\e[46mg\e[0mamma curve (>1 lightens, <1 darkens)' $'\e[46mS\e[0m-curve (contrast x midpoint)' $'\e[46mm\e[0modulate (brightness, saturation)' $'\e[46mu\e[0mndo' $'\e[46mw\e[0mrite back to original image' $'e\e[46mx\e[0mit'
# loop forever
do
	if [ "$REPLY" = "1" -o "$REPLY" = "a" ] ;then
		echo "auto-level"
		magick mogrify -auto-level "$tempfile"
		hist
	fi
	if [ "$REPLY" = "2" -o "$REPLY" = "l" ] ;then
		echo "level values"
		read -p "Black level % " black
		read -p "White level % " white
		magick mogrify -level "${black}%,${white}%" "$tempfile"
		hist
	fi
	if [ "$REPLY" = "3" -o "$REPLY" = "g" ] ;then
		echo "gamma"
		read -p "Gamma value (>1 lightens, <1 darkens) " gamma
		magick mogrify -colorspace RGB -gamma "$gamma" -colorspace sRGB "$tempfile"
		hist
	fi
	if [ "$REPLY" = "4" -o "$REPLY" = "s" ] ;then
		echo "s-curve"
		read -p "Contrast (0 is none; 3 is typical; 20 is a lot) " contrast
		read -p "Midpoint (0 is white; 50 is gray; 100 is black) " midpoint
		magick mogrify -colorspace RGB -sigmoidal-contrast "${con}x${mid}%" -colorspace sRGB "$tempfile"
		hist
	fi
	if [ "$REPLY" = "5" -o "$REPLY" = "m" ] ;then
		echo "modulate brightness and saturation"
		read -p "brightness (50 is half, 100 unchanged, 200 twice) " bright
		read -p "Saturation (0 grayscale, 100 unchanged, 200 oversaturated " saturation
		magick mogrify -modulate "$brightness,$saturation" "$tempfile"
		hist
	fi
	if [ "$REPLY" = "6" -o "$REPLY" = "u" ] ;then echo "undo"; cp "$1" "$tempfile" ; hist; fi
	if [ "$REPLY" = "7" -o "$REPLY" = "write" ] ;then echo "write"; cp "$tempfile" "$1" ; hist; fi
	if [ "$REPLY" = "8" -o "$REPLY" = "x" ] ;then echo "exit"; break ; fi
done

# clean up temporary files
rm "$tempfile"
if [ -e /tmp/hist.png ] ; then rm /tmp/hist.png ; fi
# and kill the histogram view
kill $MSGPID1
kill $MSGPID2

retro-computing

Monday, 13 April 2026 07:21 pm
miriam_e: from my drawing MoonGirl (Default)
This has been fun.

While packing my stuff up, sorting through what gets kept and what discarded, I found some old printouts of programs from way back in 1983 of a very simple circle drawing algorithm. I brought those inside with me after I'd had enough of packing for the day, and that night I downloaded and installed a TRS-80 emulator so that I could experiment with it.

I soon found that the method of getting programs into the emulator was absurdly complicated. I'd have to convert the text file into a pretend cassette file, which I could tell the emulator about via a special file, which acted like a cassette player, then issue the CLOAD command in the emulator itself.

I figured there must be a better way. And I was right.

I rigged up a tiny RoxApp icon on my desktop (though it could just as easily be in the menu, or one of the icons on the taskbar. I would highlight the text of the program in any text editor on my Linux computer, select the emulator's window, then click on this RoxApp which I'd set up to use xclip and xdotool to send the highlighted text to the emulator as if I'd typed it. It also used sed to convert all the line ends from Unix (\n) to TRS-80 (\r).
xclip -o | sed -z 's/\n/\r/g' | xdotool type --file - 
And it works beautifully.

After that I started to wonder if I could get it to use my old System80 ROM instead of the standard Model 1, Level2 ROM. That works too, though with a few small problems. I can only enable some of the extra capabilities, otherwise, for some odd reason it types keypresses twice. But I have lowercase, which I most wanted. Yay!

Retro-computing to explore the early algorithms upon which all our computers stand.
Super-interesting stuff.
Page generated Monday, 21 September 2026 09:14 pm
Powered by Dreamwidth Studios