MusicalPlaying
API documentation for MusicalPlaying.
MusicalPlaying.sineMusicalPlaying.AbstractNoteMusicalPlaying.NoteMusicalPlaying.TuningSystemMusicalPlaying.ar_generatorMusicalPlaying.equal_temperedMusicalPlaying.mk_tuningMusicalPlaying.tuning_system
MusicalPlaying.sine — Constant
sine is an instrument with a sine wave extended to always end at 0 value (no discontinuities)
MusicalPlaying.AbstractNote — Type
AbstractNote covers Note and ChordMusicalPlaying.Note — Type
`Note(pitch::Int, duration::Float32, volume::Float32)`
`pitch` is the pitch number. MIDI sets pitch 69 to A4 and 440 Hz. This can be modulated by a Tuning.
`loudness` is relative volume. A note of loudness 2 has twice the amplitued as one of loudness 1.
`duration` is the duration in beats. Typically a quater note has a duration of 1, and a half note a duration of 2.MusicalPlaying.TuningSystem — Type
TuningSystem{T}Data structure for a tuning system. A tuning system is defined by a vector of scalings of the type T (probably <: Number). The scalings are frequency rations within the octave of the pitches of the tones in the octave. It also includes names of each scaling. In case of the 12 tone equal temperement, it could be the names of the notes: C, C#, D, D#, E, ..., B. It also includes a name of the tuning (used for plotting etc).
Preferably use the constructor function tuning_system to construct it.
MusicalPlaying.ar_generator — Method
ar_generator Attack-Release generator: takes a 1-periodic function being zero in 0 and in 1 and applying an attack, release envelope. Simplified version of ADSR with D=0 and S=1. Resurns an instrument funciton, ie a function takin Tone, tempo (bpm) and start time, and return a Sound struct playing the tone in that tempo starting at the start time.
MusicalPlaying.equal_tempered — Method
equal_tempered(n)Constructs an equal tempered tuning of length n.
If the length n is 12, the names of the scalings are set to the standard names of the notes: "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B".
The scalings of and equal tempered scale of length n divides the octave evenly on a log scale. This means the ratio between successive scalings are 2^(1/n).
So the vector of scalings is:
scalings = [(2^(1/n))^x for x in 0:(n-1)]MusicalPlaying.mk_tuning — Method
mk_tuning: Generate Tuning based on TuningSystem
MusicalPlaying.tuning_system — Method
tuning_system(v::Vector{T}, [n::String], [s::Vector{String}]) where T <: Number -> TuningSystemConstruct a TuningSystem.
Arguments
v::Vector: The vector of scaings defining the function.n::String: The name of the tuning system. Defaults to "tuning"s::Vector{String}: The names of the scalings. Defaults tostring.v()