This is really cool. I like domain languages like this a lot. I basically hand rolled a very primitive version of this for a game I made. I wonder if game devs in general would find it useful for prototyping, game jams, etc. Just FYI to the author, the code samples have dead scrollbars, due to pre elements having overflow: scroll set https://i.imgur.com/2LWhKWj.png
That's an interesting use case -- though the language/interpreter is still in its early stages.
And nice catch on the scroll bars, will fix, thanks!
I suspect that a lot of HN readers may not be aware that this is just the latest example of DSL's used for "live coding" music.
There are others that have been around for a lot longer and have incorporated many (all?) of the features you will start to long for if you use this sort of tool a lot.
Live-coding is an insanely geeky way to make music, but there are people out there doing quite interesting things with it. I use "interesting" deliberately ... I haven't heard anything that I've actually liked :)
I started building Handel some weeks ago, as a simple way of writing music with code. While the livecoding movement focuses on providing solutions for performing music live with code, and making changes on the fly -- I focused on simple song writing (one reason why I wouldn't consider Handel an esoteric language). One notable aspect of Handel is the behavior of its procedures, which are called chunks. Each chunk is c…
Is there a reason you decided to start from scratch with this DSL rather than implement one of the many other live coding DSLs on top of Tone.js ? Some specific vision of the end point, or just a desire to start from the beginning?
This looks wonderful. I may be missing it from the description, but when I think "procedural" I think that I should be able to change the variables with math, or at the very least increment variables. Are there any examples of that? For example, I would think I could play a scale with something like save myPlayable = C1 for 1b do play myPlayable myPlayable.note++ while (myPlayable.note
Thanks! So by procedural what is meant is that the there are chunks (which are Handel's procedures/functions). Currently your code snippet can't be replicated in Handel. Looping is accomplished by telling a chunk to loop (giving it a number of times to loop). ex. run somechunk with loop for 100 But there is no arithmetic in the language. Adding arithmetic to playables like you mentioned could be a nice feature
Thinking a little more, I guess I would actually expect it to look a bit more like
save myNote as C1
save myPlayable = myNote for 1b
do
play myPlayable
save myNote as myNote + 1
while (myNote
(That is, the dot notation looked out of place given your language.)
I tinkered with it a bit and create this code[0] based on a song[1] that I'm learning. I think this tool is cool and has potential, but still need a lot more improvement. At least it needs a way to reduce duplicate in my code :) [0]: https://pastebin.com/9ziV0HRe [1]: https://www.youtube.com/watch?v=3t9iLEkTeAk
Nice one!
I agree, it is still in its early stages.
Looking at your code it seems it would be useful to have a way to repeat a play command without a chunk.
I think something like:
"
play E4 for 1b rep 5
"
As a way to repeat something 5 times for example (and reduce duplicates) could be a future solution.
I'm having a hard time getting instruments to synchronize in the examples—over time all the sequences drift. Is this expected / known?
It isn't expected. But I have noticed the issue as well, and I'm looking to fix. I think it may have to do with how note lengths from beats are being calculated.
The Handel interpreter uses Tone.js for scheduling and playing notes. But because there is only one Tone.Transport per page, changing the bpm of the Transport would change it for all tracks.
So instead of using Tone.js for setting bpms, the note lengths are calculated based on the bpm and amount of beats, and scheduled in seconds. Which could lead to greater imprecision over time
A try to JoJo:
start
chunk introriff
play G4, B4, E5 for 16b
play C5 for 4b
play A#4 for 1b
play C5 for 1b
play A#4 for 1b
play G4 for 5b
play F#4 for 8b
play A#4 for 12b
play E3 for 12b
play G4, B4, E5 for 12b
play C5 for 4b
play A#4 for 1b
play C5 for 1b
play A#4 for 1b
play G4 for 5b
play F#4 for 8b
play B3 for 1b
play C4 for 1b
play D4 for 2b
play F#3 for 1b
play G3 for 1b
play A3 for 2b
play C3 for 20b
play E3 for 12b
play G4, B4, E5 for 12b
play C5 for 4b
play A#4 for 1b
play C5 for 1b
play A#4 for 2b
play G4 for 5b
play F#4 for 8b
play A#4 for 16b
play F#4 for 28b
play G3, F#4 for 4b
play G4 for 1b
play G4 for 1b
play F#4 for 1b
play E4 for 1b
play D4 for 1b
play C3, E4 for 2b
play D4 for 2b
play C4 for 2b
play B3 for 2b
play B2, D4 for 2b
play B3 for 2b
play A2, C4 for 2b
play A3 for 2b
play G2, B3 for 2b
play G3 for 2b
play F#2, A3 for 2b
play B2, E3, G3, B3, E4 for 6b
play C#2, F#3, A3, B3, E4 for 2b
rest for 2b
play D2, G3, B3, B3, E4 for 2b
rest for 2b
play C#2, F#3, A3, B3, E4 for 2b
rest for 2b
play D2, G3, B3, B3, E4 for 2b
rest for 2b
play C#2, F#3, A3, B3, E4 for 2b
play B2, E3, G3, B3, E4 for 8b
endchunk
run introriff with bpm 510, sound piano
finish
I started building Handel some weeks ago, as a simple way of writing music with code. While the livecoding movement focuses on providing solutions for performing music live with code, and making changes on the fly -- I focused on simple song writing (one reason why I wouldn't consider Handel an esoteric language). One notable aspect of Handel is the behavior of its procedures, which are called chunks. Each chunk is c…
Looks great on the first glance! I'll inspect it in detail tonight. I'm looking for something that helps my get back into chip-tunes composing. I used to be an ImpulseTracker junkie in the past.
Got any songs to share? It's the kind of music I listen to most of the time, specially while coding/working on my projetcs!