scaleless_music

Crates.ioscaleless_music
lib.rsscaleless_music
version0.0.8
sourcesrc
created_at2016-08-11 22:34:18.112674
updated_at2016-11-24 02:11:43.681653
descriptionA library for building music with precise harmonies, without the limitations of any musical scale.
homepage
repositoryhttps://github.com/tiborgats/scaleless_music
max_upload_size
id5956
size194,127
Tibor Gáts (tiborgats)

documentation

https://tiborgats.github.io/scaleless_music

README

scaleless_music

A library for building music with precise harmonies, without the limitations of any musical scale.

Crates.io Linux & OS X build status Windows build status Dependency Status Crates.io Join the chat at https://gitter.im/tiborgats/scaleless_music

:construction: It is in a very early stage, but will change a lot as soon as I have some free time. I would be happy to work on this full-time, but I don't know how can I get money for supporting my life at the same time. If you have any idea, please share it with me.

Overview

I was always annoyed by the slightly false notes that came out from electronic musical instruments. When I wanted to compose some overtone flute music I also realized, that music composing software (MIDI editors) are limited to the western chromatic music scale. They miss not only some harmonies of the overtone flute, but also many of those, which are present in other types of music (e.g. Arabic). And so this project was born...

The aim of this software is to create music according to the following perfectionist principles:

  1. Music shall contain only harmonic intervals between notes.
  2. All harmonic interval variations shall have the possibility to be created.

The first rule means that the music shall not contain false sounds.

Pure intervals are important in music because they naturally tend to be perceived by humans as "consonant": pleasing or satisfying. Intervals not satisfying this criterion, conversely, tend to be perceived as unpleasant or as creating dissatisfaction or tension. (Wikipedia)

The second rule provides the freedom to use harmonies which are missing from the chromatic scale.

The realization of these conditions is mathematically impossible when using musical scales. In this new "scaleless" concept, the frequencies of the notes are not chosen from a fixed set (or scale), they are calculated dynamically, based on the relation of the previous notes to achieve pure intervals.

Counterexample: the popular equal temperament (used by MIDI) contains only one type of pure harmonic interval: the octave, all the other frequency intervals are slightly disharmonic in it (multiplies of ¹²√2). It is also limited to a small set of intervals. For a deeper understanding of the problem of equal temperament and musical scales in general, you can read about the just intonation approach.

Sound synthesis

scaleless_music uses additive synthesis, with an additional rule:

  • Frequency can be time-varying, but the intervals must remain harmonic.

Note: this kind of synthesis is very resource demanding. So, for real-time sound generation smaller sample rate (eg. 48kHz) and lower number of overtones are desirable (to prevent buffer underrun). This can change after the speed optimization of the algorithm.

Later on I would like to complement it with sample-based synthesis. But it must be used carefully, because of the following possible problems:

  • It can contain noise and disharmonic intervals.
  • It can contain echoes, effects of the recording space (which interfere with the space we want to add to it).

Henceforward, I plan to create a tool for analyzing recorded samples, finding closest mathematical representation, and building harmonic sound structures with similar output. This way we can eliminate noise and have the option to use precise 3D spacial effects.

Installation

scaleless_music can be built with different sound output backends:

  • without backend: cargo build
  • with PortAudio: cargo build --features "be-portaudio". If for some reason the building of rust-portaudio fails, you can check it's README for further instructions.
  • with SDL2: cargo build --features "be-sdl2"
  • with rsoundio (libsoundio): cargo build --features "be-rsoundio" - not available yet

Examples

Documentation

Todo Items

  • thread safety
  • basic effects, building blocks of music structure
    • note
    • amplitude functions
    • frequency functions
      • vibrato
      • linearly changing (ascending or descending) pitch
    • sequences of notes, rhythm functions
    • polyphony (mixer)
    • smooth start and end of sine waves, which are physically possible (no zero time jumps in amplitude, to avoid infinite acceleration of the speaker membrane)
  • speed optimization of the playback routines
    • benchmark routines
    • parallel processing, SIMD
  • backends for sound output
  • OS support
    • Linux
    • Windows
    • OS X
    • Android
    • iOS
  • test coverages
  • more examples

Future work

  • file format, parser
  • converter from chromatic scale (eg. midi file) formats to scaleless music structure
  • a software for finding the closest mathematical representation of sound samples (from real instruments)
  • editor, with a correct, user friendly visual representation of music structure (not sheet music)
  • handling some low-latency input devices
    • midi keyboard
  • 3D audio space, instrument location effects, echo
  • a lot of other stuff
Commit count: 183

cargo fmt