As part of a music festival, I have been asked to convert one of my piano compositions, titled "Fractal", into an electronic piece by playing around with timbres using MIDI data. Though I have a few ideas I would like to implement, I don't have experience with digital audio workstations nor electronic music in general.

In particular, the main idea I had in mind was to create a separate timbre -- constructed from a custom fractal-shaped waveform -- for each section of the piece. I did stumble upon this question, though I don't know how one could apply this to sections of MIDI data. Is this a viable idea?

EDIT: in response to the comments, I suppose that I really have two separate tasks I want to figure out how to do: a) I need a way to generate the waveforms for each pitch, and b) I need a way to play the MIDI data using these waveforms.

  • 1
    I'm not sure I'm understanding what you're asking. Do you mean that the sound should also be generated based on the midi data, not only (like standard sampling) its pitch? Mar 19, 2021 at 20:04
  • Without electronic music experience your best approach might be to collaborate and find a music tech to get you all set up with the custom fractal waveform patch and necessary controller and software so you can focus on performing Mar 19, 2021 at 20:39
  • 1
    Are you looking for a way to generate the waveforms, or are you looking for a way to play midi data using waveforms you've already generated?
    – Edward
    Mar 19, 2021 at 22:06
  • 3
    If you don't have waveforms and you don't know how to generate them, what do you mean by "fractal-shaped waveforms"? Perhaps all you need is to experiment with various software synthesizers, and e.g. effects as @Bennyboy1973 suggests, until you find the sounds you like? Mar 20, 2021 at 6:09
  • 1
    The problem is that for true Weierstrass waveform you'd need an infinite number of oscillators. Of course, physical sound reproduction equipment couldn't play it either and a human certainly wouldn't be able to tell it from approximation with frequencies above ~20KHz removed
    – ojs
    Mar 20, 2021 at 20:58

3 Answers 3


As you already figured out, MIDI has nothing to do with timbres or waveforms. MIDI is an interface and a command language for musical instruments to talk to each other, saying things like "Note On, C-5, velocity 100". How the recipient device reacts to that Note-On message could be literally anything. It could cause a stage light to move to a different position, or it could cause a MIDI-controlled tape deck to start playing, or it could cause a synthesizer to start making sound, or it could cause a MIDI-controlled garage door to open. I don't know if there are MIDI controlled garage doors, but if there is, the garage door will probably have an electric motor, which will produce an electrical waveform of some sort. If the waveform has a frequency between around 20Hz and 20kHz, and if it causes air vibrations at those frequencies, then the garage door motor makes a sound and the sound can be heard by a human. Whether a MIDI sequence playd on the garage door counts as electronic music, is a matter of opinion.

Notation applications can produce MIDI messages, working as sequencers. There are free notation applications such as MuseScore, which you could use for sending out the MIDI commands just fine, no "digital audio workstation" needed at all.

The device receiving the MIDI messages and producing the audio waveforms can be a piece of software or it can be an outboard MIDI synth, i.e. external hardware box or keyboard-type instrument that you connect to your computer via a MIDI interface and a MIDI cable. If it's a virtual synth or sampler or other sound-producing program, you connect it to the sequencer (for example MuseScore) via a virtual MIDI cable, which is a piece of software that routes MIDI messages from application A to application B. Or you could save out ("export") a MIDI file from the notation application and load it into a combined sequencer/synth application for playback, bypassing the need for a virtual MIDI cable.

I think this much you could have found out yourself by reading an introductory text or watching a tutorial about what MIDI is.

But then the more interesting question. How to create a waveform that you could legitimately call "fractal shaped"? Fractals are supposed to have "infinite detail", detail inside detail inside detail, reproducing variations of the same pattern or formula at many resolutions and scales, right? How do you do that, because audio only has finite resolution - how do you demonstrate fractal properties in an audio waveform? Is it enough if it just sounds weird and is accompanied by an explanation "something something fractal something", creating a science-mystic layer? Or do you have to be able to justify and defend the fractal claims?

This is just mumbling out my ad-hoc ideas, but to believe something is a fractal, I'd want to see repetitions of characteristics of a pattern occurring at many different scales of magnification. Our display screens have finite resolution just like audio, and fractal properties in images are demonstrated by zooming, i.e. changing the horizontal and/or vertical magnification scale of the display. So the demonstration cannot be just one static image, you have to provide several images or an animation with different scales. If we extend this thinking to audio, you'd have to show some kind of a display, something happening either in the time dimension (time domain) or frequency spectrum (frequency domain). Maybe if the visual shape of the waveform in time domain at some scale has a shape, and then, when looked at closer, similar shapes or characteristics could be found? Or what if the waveform itself morphed, creating a zooming in/out image, while keeping the oscilloscope zoom level the same? This would also cause changes in the sound itself, creating a morphing timbre! Or what if the spectrogram in frequency domain looked like a fractal?

One way to do this properly, in my opinion, would be by programming the audio-generating (virtual) device yourself. See topo's answer for ideas.

You had a requirement of the fractal-like properties being found in waveforms, and that suits the idea of playing an existing composition, but fractal-like properties have been claimed to be found in the rhythmic patterns/timings of Jeff Porcaro's drumming. https://phys.org/news/2015-08-fractals-patterns-drummer-music.html Fascinating? Nonsense? You decide.

  • Thank you for your response! Regarding your question "how to create a waveform that you could legitimately call 'fractal shaped'?" I was actually planning on making a waveform that looks similar to, say, the Weierstrass function or some (not totally non-differentiable) variants thereof. So I suppose, yes, this would justify the fractal claims. I doubt one could actually "hear" the fractal nature of the waveform, but it would make for an interesting experiment. The frequency domain fractal idea also seems interesting, but it wasn't what I was going for.
    – The Turtle
    Mar 20, 2021 at 18:14
  • The Weierstrass function could at least be an interesting experiment. I wonder what happens if you zoom into the function or make the a/b/c parameters adjustable? So that it would generate a single cycle of the wave, or a wavetable entry. Zooming in would take a narrower window between 0..1. This would require a bit of programming. Mar 21, 2021 at 20:39

There are quite a few ways you could go about this, depending on how much 'conventional' music technology you are happy to use.

One straightforward way to play a custom waveform using MIDI data is to load that waveform (as an audio file) into a sampler, or any other synthesizer that can load samples.

These days, pretty much any 'DAW' (Digital Audio Workstation) software will be able to load a sampler 'plug-in', and control that with MIDI data.

From your other SE accounts, it looks like you're a coder, so you should be able to write a function that generates the fractal as a 'function'.

So as a first, very simple approach, you could

  • Write some code to sample the fractal function, and (possibly using an audio library of some kind), write this to an audio file (sucn as a .wav or .aiff file). You might want to find a section of the function's domain that has the same values at the start and end, so that you get a 'smooth' waveform when that section is copied end-to-end to play a note at a certain frequency.
  • Use your sampler plug in in your DAW to load in the waveform and control it with MIDI.

There will be a few refinements that you could make to the process - you might want to write your function-sampling code in a way that uses filtering to avoid aliasing, and you will want to experiment with finding a satisfying sections of fractal 'shape' to use as your samples.

  • Thank you for your response! Your answer (along with piiperi's) seem to be the most promising so far. It seems like what I want to go for is what you outlined: somehow use a DAW to load a sampler 'plug-in', and use this to generate the final audio file. I suppose that once I generate the waveform for a specific frequency, the DAW can handle the rest and generate the waveforms for all other frequencies -- is this correct?
    – The Turtle
    Mar 20, 2021 at 18:18
  • @TheTurtle yes, that's correct. One think you could perhaps consider to incorporate some of piiperii's ideas would be using a granular synth, rather than a straight 'sampler' - the granular synth would allow you to change your grain size and potentially move along and look at different parts of your waveform.... Mar 20, 2021 at 20:31

MIDI's the wrong tree to bark up, I think. What you need is a DAW and a few good VST plugins.

I recommend taking a look at a few sample of "ring modulation" on Youtube. I like this one, from about 13:00 to 15:00 or so. My suggestion is to have a series of ring mods, so you resolve ONE to a new sound, then use the NEXT one to morph that into a new waveform:

This video is not the most musical application, but it is a pretty good explanation of how ring mods work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.