Skip to content

khoin/2048fm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048b FM

Less bytes?

Smaller version of this is 1kilobyte, can be found here: khoin/1kfm

What is this?

This is a FM (PM) synthesizer that runs in your web browser. Its file size is 2048bytes (index.html). You can check out the commented source in uncompressed.html.

Features

  • 6 Operators
  • ADS (Attack, Decay, Sustain) Envelope
  • Theoretical 32-voice polyphony (on my computer, no keyboard events fired after holding down 6 keys)
  • Arbitrary operator routing. Any operators can route to any other operators, even self. They can be carriers and/or modulators.
  • Saving and loading patches
  • C4-A5 keyboard (corresponding to 2 top rows on your keyboard, Q to backslash).

Components

  • Bitmap font 0-9ADSICTO at 160 bytes + 59 bytes (for pixel drawing)
  • Bresenham line drawing at 159 bytes + 59 bytes (for pixel drawing)
  • DSP + keyboard mapping is at 668 bytes
  • The rest: GUI, mouse, patch save/load 754 bytes

Caveats

  • It is not possible for modulators (that does not go directly to output) to be silent. I did this so that we can skip calculations if an operator have zero volume.
  • No release envelope stage :c
  • No fixed frequency mode.
  • It is not a DX7 emulator :c I first wanted it to be one.
  • On my machine, if you don't have any modulation, it doesn't lag. But if you do, it usually lags out at 3-4 voices. On my machine, it appears that Firefox's script processor isn't as fast.
  • <meta charset=utf8> was added so the GUI would render correctly in Firefox and Edge.

Diagram of parameters

This part assumes you know synthesis concepts. Here's a diagram:

diagram

Example Patches

Acknowledgments

  • Thanks Werner for showing me more efficient way of PM/FM synthesis
  • p01 for such awesome 1k demos that got me into this.

License

Public Domain.

About

FM synth, in your browser, at 2048 bytes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published