Live data from Hacker News

Sporth: A small stack-based audio programming language

paulbatchelor.github.io

21–30 of 34 posts

Re: Sporth: A small stack-based audio programming language

#21
post #13
post #5

If you're thinking of compiling this to webassembly and making an online Sporth playground... It's already done! Works pretty well, too. You can browse a bunch of Sporth scripts and play with them here: https://audiomasher.org/browse I found the stack-based, Forth style syntax works like magic for a lot of creative audio DSP tasks. Blocks of code are like little signal chains, but denser and easier to manage than tra…

The thing I think the spaghetti visual graphs get wrong is a lack of adherence to the structured programming theorem. Most data flows are mostly linear/sequential, and DAGs - which also can be expressed linearly as "send/jump ahead but not backwards", cover most of the rest. Complex structures that need to describe comprehensive fanin/fanout/feedback functionality are exceptions, and as with uses of "goto" in structu…

Very well said. I've come to similar conclusions working with the postfix syntax of Sporth.

Is your language public at all?

Re: Sporth: A small stack-based audio programming language

#23
post #13
post #5

If you're thinking of compiling this to webassembly and making an online Sporth playground... It's already done! Works pretty well, too. You can browse a bunch of Sporth scripts and play with them here: https://audiomasher.org/browse I found the stack-based, Forth style syntax works like magic for a lot of creative audio DSP tasks. Blocks of code are like little signal chains, but denser and easier to manage than tra…

The thing I think the spaghetti visual graphs get wrong is a lack of adherence to the structured programming theorem. Most data flows are mostly linear/sequential, and DAGs - which also can be expressed linearly as "send/jump ahead but not backwards", cover most of the rest. Complex structures that need to describe comprehensive fanin/fanout/feedback functionality are exceptions, and as with uses of "goto" in structu…

Yes

Re: Sporth: A small stack-based audio programming language

#24
post #5

If you're thinking of compiling this to webassembly and making an online Sporth playground... It's already done! Works pretty well, too. You can browse a bunch of Sporth scripts and play with them here: https://audiomasher.org/browse I found the stack-based, Forth style syntax works like magic for a lot of creative audio DSP tasks. Blocks of code are like little signal chains, but denser and easier to manage than tra…

It seems like the parentheses could do a bit more work, instead of just being ignored. Suppose that at compile time, the language computes the expected stack size after each word? Then the close-parenthesis could be a compile-time assertion that the stack size matches the open paren, plus the number of arguments left on the stack by the previous word.

Re: Sporth: A small stack-based audio programming language

#25
post #15

This sounds really cool, but could use better docs. As someone who is new to programmatic music composition, I'm not sure what the value proposition here is.

> This sounds really cool, but could use better docs. I agree. As the creator, it can be hard to write documentation for a beginner audience, so I'd be great to hear your input. What would you suggest? Right now, here is the documentation that exists now: Some intro tutorials can be found in the Sporth cookbook: http://paulbatchelor.github.io/proj/cook/ An interactive version can be found here: https://audiomasher.or…

Since you're here… This looks really cool. I installed, but running the demo produced no sound (but a pause). Any thoughts? I did seemingly install the dev branch of SoundPipe first. Please feel free to redirect me to a more appropriate support channel if available.

Re: Sporth: A small stack-based audio programming language

#26
post #25
post #15

Earlier quoted context omitted.

> This sounds really cool, but could use better docs. I agree. As the creator, it can be hard to write documentation for a beginner audience, so I'd be great to hear your input. What would you suggest? Right now, here is the documentation that exists now: Some intro tutorials can be found in the Sporth cookbook: http://paulbatchelor.github.io/proj/cook/ An interactive version can be found here: https://audiomasher.or…

Since you're here… This looks really cool. I installed, but running the demo produced no sound (but a pause). Any thoughts? I did seemingly install the dev branch of SoundPipe first. Please feel free to redirect me to a more appropriate support channel if available.

I found the answer: https://github.com/PaulBatchelor/Sporth/issues/23

Re: Sporth: A small stack-based audio programming language

#27
post #9
post #8

Earlier quoted context omitted.

Thanks :D Since you're here, I would love to know what you think of adding function definition as a language feature to Sporth (in the style of Forth, or even better, Joy). As you know I've used Sporth a lot, and I think it would be pretty useful to have this kind of feature, but perhaps implementation would be a bit challenging right now.

I agree it would be a cool feature. Unfortunately, you'd have to basically rewrite everything in order to do it. I actually kind of did that. Soundpipe[0], Patchwerk[1], and Runt[2] used together builds something that syntactically resembles Sporth, sounds virtually identical, and is usually way faster. In Runt, you can add new words and build abstractions that way. In practice, I tend to avoid doing this and will te…

In acidforth, I implemented "functions" in a way that it can be handled very early in the compilation process and not have any impact on the execution environment. They look like forth colon definitions but are just macros that get expanded immediately during compilation.

Perhaps that is an approach that would work for Sporth? If nothing else it could be implemented as a separate source to source pre-processor.

Re: Sporth: A small stack-based audio programming language

#29
post #15

This sounds really cool, but could use better docs. As someone who is new to programmatic music composition, I'm not sure what the value proposition here is.

> This sounds really cool, but could use better docs. I agree. As the creator, it can be hard to write documentation for a beginner audience, so I'd be great to hear your input. What would you suggest? Right now, here is the documentation that exists now: Some intro tutorials can be found in the Sporth cookbook: http://paulbatchelor.github.io/proj/cook/ An interactive version can be found here: https://audiomasher.or…

I am a programmer and a musician. For me, syntax is easy, and understanding stack languages is easy as well (for instance I authored a long tutorial on Factor).

What is difficult for me is to understand:

* what kind of objects are available (generators and filters, I guess, anything more?)

* what generators are available, and what is their effect

* what are triggers. This sentence doesn't explain much "A single trigger is exactly one sample that is a non-zero value (typically, this value is just a '1')"

and so on. In general, much of the terminology is alien, for instance "Since everything in Sporth is sample accurate, triggers are sample accurate and can work at audio rate." or "This creates a gate signal which is then fed into the portamento filter, whose half time value is 10ms. The portamento filter (a simple one pole smoothing filter), creates the ideal exponential curves for envelope, with a convex exponential slope on the attack, and a concave exponential slope on the release."

I just do not understand half of the words in the above sentences.

What does it mean to be sample accurate? What is a portamento filter? Why there should be a convex exponential slope on the attack? By the way, what is the attack? (I know, but it wasn't explained earlier).

This looks like a tutorial written for people who are already programming audio, and only need to understand Sporth. What is missing is a tutorial for people that are programmers and musicians, but are using Sporth to start programming audio.

Post reply on HN