Пример #1
0
import numpy
import pyaudio
import wave
import sys
import analyse
import matplotlib.pyplot as plt
import msvcrt
from boxbeat import Pitch, Modes, Notes, MidiControl, snap_to_values
from time import sleep


midi_player = MidiControl()

# constants
CHUNK_SIZE = 1024
DURATION_THRESHOLD = 10
RECORDING = False
TIMESTEP = 44100.0 / CHUNK_SIZE
LAG = 10

# plot visualizations
def VIS_temp_note(time, pitch):
	plt.annotate(pitch.to_tone_string(), xy=(time,pitch), color="0.6")
def VIS_note(time, pitch):
	plt.annotate(pitch.to_tone_string(), xy=(time,pitch))
def VIS_loudness(loudness):
	plt.plot(loudness)
def VIS_pitch(pitch):
	plt.plot(pitch, "ro")
def VIS_beat(interval, max):
	for x in range(0, max, interval):
Пример #2
0
import numpy
import pyaudio
import wave
import sys
import analyse
import matplotlib.pyplot as plt
import msvcrt
from boxbeat import Pitch, Modes, Notes, MidiControl, snap_to_values
from time import sleep


midi_player = MidiControl()

# constants
CHUNK_SIZE = 1024
DURATION_THRESHOLD = 10
RECORDING = False
TIMESTEP = 44100.0 / CHUNK_SIZE
LAG = 10
SILENCE = -25.0
VOLUME_THRESHOLD = -15.0

# plot visualizations
def VIS_temp_note(time, pitch):
	plt.annotate(pitch.to_tone_string(), xy=(time,pitch), color="0.6")
def VIS_note(time, pitch):
	plt.annotate(pitch.to_tone_string(), xy=(time,pitch))
def VIS_loudness(loudness):
	plt.plot(loudness)
def VIS_pitch(pitch):
	plt.plot(pitch, "ro")