Oatmeal

A digital pillow fort

Benjamin Sisko done Quark dirty from day fucking one.

In reply to: “THE ENVIRONMENTAL ISSUES WITH CRYPTOART WILL BE SOLVED SOON, RIGHT?" | Medium

A cryptocurrency’s energy cost is tied to its current price. This is because cryptocurrencies are designed to incentivize miners- if they were not tied together, the potential value return of a making a bitcoin could fall below the price of electricity required to make it.

Because of this, Bitcoin’s continued financial return depends on coins being harder to make in the future. The people who invest in cryptocurrencies- like any kind of futures speculation- are betting that it will be better to be holding this resource tomorrow than making it.

In reply to: The problem of CryptoArt – Studio Joanie Lemercier

It turns out my release of 6 CryptoArt works consumed in 10 seconds more electricity than the entire studio over the past 2 years.

wooden math tiles

14 - 1 = 13
14 + 1 = 15

Discoveries

Code Log: In which I explore how to make sounds

What is a code log? It is sort of like live coding, but badly done, and all in text.

I’ve drawn a heap of pixels to the screen over the years, but I haven’t made computers bleep or bloop much. Here are some notes on some quick audio explorations.

Git gets grumpy

First, a quick aside on a silly error I ran into trying to clone a git repo.

git@codeberg.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

Despite having everything properly configured in my ~/.ssh/config git wasn’t playing nice with Codeberg. To remedy I ran:

ssh-add ~/.ssh/my_awesome_key

Where my_awesome_key was the name of my private key.

This ensures that your ssh-agent is aware of the specific key you are trying to use.

Goals

My goal is to either emit 1 or more tones or to generate some sort of white noise. Ideally I would like the running program to play the audio directly, but I’d also settle for the program writing a file that can then play the audio.

The silliest/simplest way that I know of to make my computer bloop is to send the \a escape sequence to stdout. \a is the escape sequence for alert, so, at least on macOS, it triggers the OS-level alert sound.

echo -e '\a'

This, however, is lame and feels like cheating.

I know that in order to make my computer bleep and bloop I will need access to its audio APIs. Some quick searching surfaced a variety of ways to do this — the ones I’m most familiar with leverage game engines, tools like löve2d. Those also sort of feel like cheating. So, I continue onward!

A brief sampling of some stuff found in quick research mode

Hissssssss 🐍

Python is a language I don’t often use…nor have I ever really done so. It isn’t my go-to hammer. But this page brought me to simpleaudio.

After doing a quick pip3 install simpleaudio I got the sample to play what sounds like a piano!

import simpleaudio.functionchecks as fc

fc.LeftRightCheck.run()

This is very promising!

Tragedy!

Next up I tried to run one of simpleaudios more involved examples that leverages numpy, a dependency I know nothing about 🤷…and that threw the following error:

Traceback (most recent call last):
  File "/Users/eli/Desktop/noise.py", line 12, in <module>
      t = np.linspace(0, T, T * sample_rate, False)
      File "<__array_function__ internals>", line 5, in linspace
      File "/usr/local/lib/python3.9/site-packages/numpy/core/function_base.py", line 120, in linspace
  num = operator.index(num)
  TypeError: 'float' object cannot be interpreted as an integer

I MUST REMAIN FOCUSED ON THE BLOOPS! Gonna nope out of this!

WWW Audio API

If I resemble any sort of developer it is a web developer; the web calls to me!

Web Audio API 🏇

Researching the Web Audio API brought me to this excellent demo. An excellent demo that didn’t work in my default browser!? This was devastating and led me to realize (perhaps (read as most assuredly”) falsely?) that Web Audio API feels like a cheat because it isn’t my computer beeping, it is my computer as dictated by my browser…this is an absurd reason for giving up on it, but it was my reason nonetheless.

Next I took a brief excursion into ASM, thinking that if I want my computer to really bleep and bloop I gotta do it in assembly…but…wooof. It’d be rad., but perhaps not for this code log.

Diversions and sleepiness set in

With the wanderings into ASM complete I was getting sleepy — desperate times and all that — my measure became desperate.

Rather than play the tone directly what about writing it to a file and playing that back? Here is a post about generating a .wav file in C, and another post from the same source about doing it in Python.

Promising, but a bit complex.

Cheats abound

It isn’t #programming, but I know I can generate a very simple .wav file with ffmpeg!

ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" beeeeep.wav

Or, a lower tone

ffmpeg -f lavfi -i "sine=frequency=800:duration=5" bloooop.wav

In conclusion

I didn’t 100%, or even really 60% accomplish exactly what I set out to initially, but for my inaugural code log I’m willing to call this a success.

Some other programs I’d like to explore more related to computer audio:

In reply to: Everything is broken, and it’s okay

A failure is one part of a system breaking; a catastrophe is when many failures accumulate to a point beyond recovery.1 When a catastrophe happens, it often seems like something very safe failed suddenly. But when we analyze the contributing causes, we find it wasn’t really sudden at all: The warning signs were present, the early failures, but we didn’t predict how they’d combine.

In reply to: Matt Genge Uses Dust From Space to Tell the Story of the Solar System | Quanta Magazine

Astronomers have always focused on stars and galaxies. They literally are the bright sparkling bits of astronomy that everybody gets drawn to. But actually, dust is one of the most important parts of astronomy, because OK, the stars sit there producing elements that eventually make planets, but it’s the dust that delivers that stuff from stars to planets. If it wasn’t for the dust, our universe would be a pretty mundane place: flickering stars with nothing around them. The dust links stars with everything else, with all the planets, all the living things on those planets. It’s the dust that’s responsible, ultimately.

« Present Page 3 of 197 Past »