Readit News logoReadit News
lifthrasiir · 5 years ago
Two-dimensional programming languages like Funges are a fruitful ground for live coding, but I was unsure how to achieve that until Ocra [1] appeared. Funge-98 does support threaded execution (via `t`), but its threading model is cooperative and thus requires meticulous synchronization for most uses of live coding. For example, you can "park" each instruction pointer to some position until the next beat, but you can't really control time to next note from there because it would be proportional to the number of instructions executed (and you need noticable delay to show the IP's movement).

Orca cleverly avoided this issue by making every instruction running simultaneously. If I understood correctly, NoiseFunge seems to found another solution out: it queues notes to play by the next beat and moves on. As I'm not really a live coding person I can't see this approach is easier than Orca or not though. Anyway, an interesting attempt indeed.

[1] https://100r.co/site/orca.html

rev_null · 5 years ago
Creator here. I just updated the README and name for this project since it is the legacy implementation. I started the new implementation in Rust earlier this year.

If you're interested in seeing it in action, here's a recent video (there are more on my youtube page): https://www.youtube.com/watch?v=qeseWGmcIbY

pabs3 · 5 years ago
Could you say something about the switch from Haskell to Rust? Was it motivated by performance? or type system complexity? or something else?
rev_null · 5 years ago
Honestly, I was just looking to learn Rust and this seemed like a reasonable project for it. It's small enough that I could conceivably rewrite it in a couple of months and the stakes were low if it didn't work out.

Mostly, I'm just sticking with the Rust implementation now because it has a couple of new features that I wanted. Also, it should theoretically (I have not tested) be able to run on other OSes, since it is built around JACK instead of ALSA.

AlphaGeekZulu · 5 years ago
It looks extremely interesting! Is there any sort of documentation, like a quick introduction, tutorial or reference? I found the Wikipedia page about Befunge and I just don't get, how this transforms into sound in Noisefunge...
nexuist · 5 years ago
Ahh, this reminds me of my own attempt in Brainfuck!

http://nexuist.github.io/brainsynth/

Been a year or two since I touched it, so I have no idea if it still works. Last I remember it was extremely slow; I think eventually I wanted to rewrite it in Vue or Svelte or even WebAssembly.

I think it's a fun concept, just need to work on the execution to make it painless to play with.

gnramires · 5 years ago
Hey, that's very nice. I think obfuscated languages (esolangs) lend themselves really well to this, because while doing seemingly trivial "logic" is quite difficult, creating algorithmic patterns and structures is not -- i.e. it's difficult to "steer" the structure in a canonical one but easy to get repetition, patterns and progression, which lends itself very well to art (and perhaps genetic programming as well? but that's a story for another time).

Just a heads up:

1 ) your synth seems out of tune (in particular the 'Octave', when selecting 'all notes' you have a chromatic progression, i.e. all notes seem to be 1/2 tone apart). I don't have a well trained ear, but most notes seem off, e.g. C4 to D4 doesn't seem like a whole tone. The way scales work is quite simple for (approximate) equal temperament: each note in a chromatic scale (that includes all notes) should be 2^(1/12) the frequency of the previous ones (called a semitone interval).

2 ) What you have there is not a "valid" octave either :) An octave in western music is usually played using either of two patterns of notes: a) a major scale, or b) a minor scale (there are other scales as well, less used). The most "obvious" choice is to start with a major scale (which generally has a positive-ish mood). Each scale has a fixed interval pattern which sets its mood.

What's confusing is that the letters A,B,...,G, don't correspond to whole tones (two semitones, or 2^(2/12)) apart. The letters were assigned on the basis of a specific scale, the C major scale. The full scale (chromatic scale) composing all notes starting at A therefore isn't either A,B,...,G or A,Bb,B,Cb,C,...Gb,G (a flat represents a semitone below a note). That's because the major scale has a pattern of Tone,Tone,Semitone,Tone,Tone,Tone,Semitone (completing an octave, 2x the frequency).[1]

The C major scale is simply (starting at C) C,D,E,F,G,A,B,C. This means there are half-tones between E and F, and between B and C. To build a A major scale, you get: A, B, C#, D, E, F#, G#, A. (sharps and flats are equivalent in alphabetic order, except for the E/F and B/C intervals, where E# = F != Fb and B# = C != Cb), and finally the names on the chromatic scale are A,Bb,B,C,Db,D,Eb,E,F,Gb,G,Ab (start anywhere in order), all a semitone apart.

As for frequency naming, the convention is that A4 = 440Hz (in modern orchestra), so A3 = 220Hz, A5 = 880Hz, etc. (this is the fundamental frequency). The rest I leave up you :)

Hope this was useful and not some confusion of mine or minor technical quirk!

[1] This tone/semitone pattern is a bit complicated for a compact explanation, although I think you can find online (I intend to write an accessible blog post about it sometime...) -- it has to do with how our ears identify overtones and we find matching (integer-related) overtones aesthetically pleasing/attractive.

nexuist · 5 years ago
Thank you for the advice! I'm not a musical person at all; I will try to remember to get to this whenever I get back to this project!
qdot76367 · 5 years ago
I have just been informed that there is now a new version written in Rust.

Complete with its own rust based Befunge compiler.

https://github.com/revnull/noisefunge.rs

gnramires · 5 years ago
This is really, really good (in particular the composition). So good I envy you for not thinking of it earlier! :)

Keep on the algorhythm <3

(I have hacked together scripts in python for a few incomplete compositions and experiments with harmony. I even make the samples from scratch using basic math and waveforms -- I encourage you to try deriving the raw samples as well! waveform shape and phase interactions are surprisingly complex)

stevehiehn · 5 years ago
I'm intrigued, but its not 100% clear to me what this is. Is this essentially parallel to Sonic PI? What generates the actual sound? Does it control synths via MIDI or are synths/oscillators in the codebase? Thx
lioeters · 5 years ago
From what I understand of the Rust implementation of Noisefunge, it has a MIDI engine but no audio synthesis. It appears synthesizers and effects are external.

https://github.com/revnull/noisefunge.rs/blob/master/src/fun...

Rochus · 5 years ago
What exactly is it? Is it an algorithmic composition tool? Is there a description?
rev_null · 5 years ago
It's a music live-coding environment that is part of the befunge family of (obfuscated) languages.