Пример #1
0
# Dotted notes can be written in two ways:
# 1.33 = -2 = dotted half
# 2.66 = -4 = dotted quarter
# 5.33 = -8 = dotted eighth
"""

import wave
from math import ceil, cos, floor, log, pi, sin

import numpy as np

from Players.PySynth.demosongs import *
from Players.PySynth.mixfiles import mix_files
from Players.PySynth.mkfreq import getfreq

pitchhz, keynum = getfreq()


def linint(arr, x):
    "Interpolate an (X, Y) array linearly."
    for v in arr:
        if v[0] == x:
            return v[1]
    xvals = [v[0] for v in arr]
    ux = max(xvals)
    lx = min(xvals)
    try:
        assert lx <= x <= ux
    except:
        # print lx, x, ux
        raise
Пример #2
0
# 'r' is a rest.

# Note value is a number:
# 1=Whole Note; 2=Half Note; 4=Quarter Note, etc.
# Dotted notes can be written in two ways:
# 1.33 = -2 = dotted half
# 2.66 = -4 = dotted quarter
# 5.33 = -8 = dotted eighth
"""

from __future__ import division

from Players.PySynth.demosongs import *
from Players.PySynth.mkfreq import getfreq

pitchhz, keynum = getfreq(pr = True)

##########################################################################
#### Main program starts below
##########################################################################
# Some parameters:

# Beats (quarters) per minute
# e.g. bpm = 95

# Octave shift (neg. integer -> lower; pos. integer -> higher)
# e.g. transpose = 0

# Pause between notes as a fraction (0. = legato and e.g., 0.5 = staccato)
# e.g. pause = 0.05