Exemplo n.º 1
0
def test_tone_tone():
    assert Tone.from_string("E♭4").value == 600
    assert Tone.from_string("A4").value == 0
    assert Tone.from_string("C102").value == 117900
    assert Tone.from_string("C♯2").value == -2000
Exemplo n.º 2
0
from muse.tone import Tone

from fluidsynth.aio import AsyncSynth
import asyncio
import time

synth = AsyncSynth("/home/tag/piano/Full Grand Piano.sf2",
                   config={
                       "audio.driver": "pulseaudio",
                       "synth.reverb.active": "yes"
                   })
synth.start()

time.sleep(1)

A3 = Tone.from_string("A3")
D3 = Tone.from_string("D3")
F2 = Tone.from_string("F2")


@asyncio.coroutine
def play_chord(note, chord_, duration, lag):
    yield from asyncio.sleep(lag)
    yield from synth.chord(0, [x.to_midi() for x in note.chord(chord_)], 80,
                           duration)


@asyncio.coroutine
def main():
    yield from asyncio.gather(
        asyncio. async (play_chord(D3, MAJOR_SEVENTH, 5.0, 0)),
Exemplo n.º 3
0
from fluidsynth.aio import AsyncSynth
import asyncio
import time

synth = AsyncSynth("/home/tag/piano/Full Grand Piano.sf2", config={
    "audio.driver": "pulseaudio",
    "synth.reverb.active": "yes"
})
synth.start()


time.sleep(1)


A3 = Tone.from_string("A3")
D3 = Tone.from_string("D3")
F2 = Tone.from_string("F2")


@asyncio.coroutine
def play_chord(note, chord_, duration, lag):
    yield from asyncio.sleep(lag)
    yield from synth.chord(0, [x.to_midi() for x in note.chord(chord_)], 80, duration)


@asyncio.coroutine
def main():
    yield from asyncio.gather(
        asyncio.async(play_chord(D3, MAJOR_SEVENTH, 5.0, 0)),
        asyncio.async(play_chord(A3, MAJOR, 5.0, 2)),