Segmod - "a non-standard sound synthesis that embraces the discrete nature of digital sound."

This is absolutely wonderful. Endless gratitude!


This reminds me of how SID Wizard for the C64 handles ‘instrument tables’ by allowing you to switch between waveforms inside an instrument!


If I recall correctly one of the things that gave SID chip its distinctive sounds is that the fastest that any updates could happen (changing waveform, filter frequency etc.) was at TV refresh rate (so 50Hz for PAL region).

1 Like

UI is online and waveforms now also work, next up wave-dsl (so the two bottom left text areas part aren’t working yet) :slight_smile: Can’t wait to add a simple sharing functionality so we can start sharing patches :smiley: Oh and you can drag and drop different themes on using @neauoire’s theming system.


I checked it again and I see that you already implemented sharing patches, that’s really cool!
I won’t comment on internals because I see that you are still working on it, but on UI side there is this weird thing that on safari the row with frequency, controls and scope has a height of 0. Setting flex-basis to auto for row class style fixes this.
And while we are on topic maybe someone could shed some light why following behaviour was implemented in css:
default values for flex are 0 1 auto but if you set it to single value like flex: 1 then the two latter values become 1 0 so effectively when you type flex: 1 you define flex: 1 1 0. That is totally not what I would expect. I would expect the values that were not defined to default to default values which seems to not be the case with flex-basis.

1 Like

Hi, thanks for porting this, looks awesome! :smiley:

Does this iteration produce sound or is it just a UI concept?
Can’t get any audio playback or download functionality to work. :confused:

Here’s my console output: image

It should work, but the defaults are a bit broken at the moment. :innocent: Here’s a link which should work, just add a space to the waveforms formula (left text field) and hit play.

edit: Screenshot didn’t load before, it seems like something else is going wrong. What browser/os are you using?

1 Like

Thanks fixed it! :raised_hands:

Would it be possible to add a random seed parameter to wave-dsl? That way I can make the share links for determinate? I’m hashing the wave-dsl strings now, but they get different random values applied; I think it may be nicer to have idempotent links :slight_smile:


Managed to get it working… sometimes. Sorry, I know it’s not the most helpful answer! :neutral_face:

Currently tested on Chrome and Microsoft Edge between two different windows machines.

Here’s what I’ve encountered:

  • Inconsistently I mange to get audio to play and download to work (although scope never works).
  • When audio is playing back, eventually editing the code will have no effect on the audio output.
  • Adding whitespace at the end of the DSL code causes the output to change in unpredictable ways.
  • Browser refreshes the page on code change; my browser history is now a long list of ‘Segmod’ :laughing: Is this intended behavior?

Let me know if there’s anything you want me to test/do from my end. :slight_smile:

1 Like

Sure, I think it should be doable so I will try to add it in the evening. Maybe I will also improve a parser a little.

mac seg faults when i run it from terminal

That’s why it’s called segmod :crazy_face:

I also had this problem (on Arch Linux) and it turned out that I used some wrong command line arguments. So be sure to double check those, maybe then you’ll get it up and running!

yeah, just running it results in seg fault, you need to pass at least one input file. You could try running example with using sine as a wave by calling:

./segmod -w 0 -i examples/sequence_A_mid.txt

EDIT: @lijnenspel I added possibility to pass seed as an second argument to parse so the links should give repeatable results now (already pushed it to GH). I used some PRNG lifted from stack overflow which might not be ideal but at least it shouldn’t block you with your work. Also it should be possible now to enter comments with spaces in them.

Thanks for all the reports! Did some work on stabilizing the web UI yesterday, so please let me know if there are things which feel buggy :slight_smile: Here’s a small celebratory snippet

Some other things I’ve added:

  • Sharing is consistent using a random seed (Thanks @karol!)
  • Make quick variations on your patch by changing the seed in the UI (arrow keys should work)
  • Made the scope reactive to the playing sound, not just the buffer.

Next up:

  • Make it a bit more performant so longer audio can be generated
  • Add some explainers to make it more user friendly
  • Thinking how to turn this into a more polyphonic instruments (multiple layers)
  • Effects?

I’d love your ideas :slight_smile:


I really like what you have done already!
But as you are asking for suggestions:

  • Explanations are always helpful, maybe a tab with few example commented programs?
  • About polyphony: one of the things that might be interesting to check is to provide two ways of declaring indexes - by absolute value (as this is done now) and by relation to other track. So for example you could write something like:
# first track
<si 1> <si 2> <si 3> <si 4>
#second track
<si +1> <si -1> <si *2>

where first track would output: 1 2 3 4 the second track would output 2 1 6. Of course this rises question how should second track be looped. Should it be looped as 2 1 6 2 1 6... or it should read consecutive values from first track so 2 1 6 5 and then loop.

  • Maybe drawing custom waveforms might be also a nice feature? Or allowing users to drop files which would then be treated as wavetables? On the other hand judging that rather simple waveforms were included in segmod I would say that was one of the aesthetics choices for the whole synthesis method for it to be rather raw.
1 Like

the AudioContext wasn’t able to resume. but it looks gorgeous.

1 Like