News for hackers. Stuff that matters.
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Monday January 04, 2021 @11:49PM (#25642231)
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 conceptually a song track and all run chunks (from procedure calls) play at the same time. A run of a chunk can be customized by passing in arguments (ex. chords to use). The bpm, instrument, and loop amount of a run of a chunk can also be optionally set to further customize that run.

Open to questions and feedback!

Re:Show HN: Handel – A procedural programming language for w... by fergonco on Tuesday January 05, 2021 @03:21AM (#25643365)
Hi! I built something similar: https://fergonco.org/MusicJargon/. I think you will find it interesting. It compiles to midi, though. Your browser support is quite a feature, indeed.

Had long discussions with my brother (the family musician) on how to encode chords. At some point I even used the actual UTF characters for sharp and bemol and was a total nightmare to write :D

My effort is mostly abandoned (I switched to teach my kids to actually play!). Courage!

Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @12:00PM (#25647589)
Hi! Compiling to midi is also a great feature. I think having both the immediate feedback of hearing your compositions, and the ability to export to midi would be useful
Re:Show HN: Handel – A procedural programming language for w... by tartoran on Tuesday January 05, 2021 @12:14AM (#25642377)
I suggest you add a drop down with some composition examples in the editor so it kind of demos out what it is capable of. The language feels quite natural to transfer an existing score or to compose something out so it could fill out some niche. I'm not a trained musician so take this as an opinion.
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @12:29AM (#25642468)
There's an examples folder here linked to from the documentation but having examples in editor would be intuitive as well. (here's the link to the folder if you were curious: https://github.com/ddj231/Handel/tree/master/Examples)

The editor is pretty barebones at the moment

Re:Show HN: Handel – A procedural programming language for w... by undecisive on Tuesday January 05, 2021 @05:08AM (#25643954)
Definitely cool! I do like simple text-based music tools, and the fact that it has a live web player is excellent.

A couple of things I noted:

- I couldn't work out how to run two chunks in sequence - I'm presuming the language doesn't support it yet, since none of the examples do it either?

- It would be nice if the "play" keyword accepted the "loop" syntax too (or something similar)

- On the web editor, despite the song reaching the finish, you have to press stop before you can press play again. It's a little thing, but I spent an embarrassingly long amount of time thinking it was just a firefox bug, copying my song to clipboard, refreshing the page and pasting it back in!

That said, have enjoyed playing with it. Any future plans?

Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @08:32PM (#25653740)
Thanks for the feedback!

Running two chunks in sequence is currently not supported, but I've been considering a separate block (or a customization of a run of a chunk) that could allow that behavior.

Adding looping functionality to play would also be a nice addition.

Future plans wise, in the short term I'm looking to address some bugs and proposed features. But generally want to get the interpreter to a stable state

Re:Show HN: Handel – A procedural programming language for w... by ArtWomb on Tuesday January 05, 2021 @09:46AM (#25646020)
Syntax is very human readable, yet still expressive.

In terms of extending, is there an easy interface for generating custom waveforms? Or alternatively, if I generate sine oscillator raw data just using javascript math functions, can I mix the resulting waveform into a Handel chuck that's already running?

My first though was that this would make a great basis for Visual Coding! Great Work ;)

Re:Show HN: Handel – A procedural programming language for w... by p2detar on Tuesday January 05, 2021 @04:10AM (#25643650)
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.

Re:Show HN: Handel – A procedural programming language for w... by stelonix on Tuesday January 05, 2021 @04:42PM (#25651532)
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!
Re:Show HN: Handel – A procedural programming language for w... by PaulDavisThe1st on Tuesday January 05, 2021 @12:49PM (#25648404)
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?
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Wednesday January 06, 2021 @12:32AM (#25654913)
I wanted to deviate from live coding, and make a language that targets songwriting/composition. I think the end goal of live coding is slightly different, and seems to target performance (though live coding DSLs and applications can be used to do the former)
Re:Show HN: Handel – A procedural programming language for w... by stelonix on Tuesday January 05, 2021 @05:41AM (#25644143)
Am very interested! By looking at it on a glance, I'm wanting to write a mscx (Musescore) importer. I have a question though, that may have skipped my eyes: is there a way of setting a note's duration to less than a beat?
Re:Show HN: Handel – A procedural programming language for w... by mcphage on Tuesday January 05, 2021 @08:31AM (#25645278)
How do you run two runnables at the same time? Like, chords for the left hand, and then the melody for the right?
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @12:06PM (#25647676)
On a basic level the program below would accomplish that (can't promise this sounds pleasing to the ear ;) -

start

chunk lefthand

play C3, Eb3, G3 for 2b

rest for 2b

endchunk

chunk righthand

play C3 for 1b

play Gb3 for 1b

play Eb3 for 1b

play Db3 for 1b

endchunk

run lefthand with loop for 100

run righthand with loop for 100

finish

Re:Show HN: Handel – A procedural programming language for w... by mcphage on Tuesday January 05, 2021 @12:44PM (#25648344)
Which part of "run lefthand with loop for 100" makes it non-blocking? It it "run" instead of "play"?
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @01:28PM (#25648988)
Currently all run chunks play at the same time. So 'run somechunk' will create a run of a chunk that begins at the same time as all other run chunks.

Your question does bring up an interesting idea, which would be to have a 'play somechunk' command that is blocking. But that does not exist at the moment

Re:Show HN: Handel – A procedural programming language for w... by ad404b8a372f2b9 on Tuesday January 05, 2021 @09:52PM (#25654210)
Do you feel it's made it easier for you to compose? Has it changed the way you think about music?
Re:Show HN: Handel – A procedural programming language for w... by johnx123-up on Tuesday January 05, 2021 @12:39AM (#25642525)
How is this different (or better than) from ABC notation?
Re:Show HN: Handel – A procedural programming language for w... by ddj231 on Tuesday January 05, 2021 @12:52AM (#25642608)
I think in 2 ways:

1. Readability:

Ex.

start

play E3, Ab3 for 1b

rest 5b

play E3, Ab3 for 1b

finish

It is somewhat intuitive to read the above without experience with the language (or with programming in general).

2. Procedures: You can create chunks (procedures), which are reusable. For example you can create a chunk which takes 3 chord playables as parameters and run that chunk with any arguments. And also stack those runs on top of each other (because all run chunks play at the same time).