コード例 #1
0
ファイル: main.py プロジェクト: chrisnorman7/synthizer-fx
def reverb_main() -> None:
    """Provide the main entry point."""
    with initialized():
        a: App = App()
        ctx: Context = Context()
        f: ReverbFrame = ReverbFrame(ctx)
        f.Show(show=True)
        f.Maximize(maximize=True)
        a.MainLoop()
コード例 #2
0
"""Read a file into memory in Python, then ask the buffer to decode it for us.
Demonstrates how to decode encoded data from places that aren't the disk, e.g.
the result of an http request.

usage: buffer_from_memory.py myfile."""
import sys

import synthizer

with synthizer.initialized():
    ctx = synthizer.Context()
    with open(sys.argv[1], "rb") as f:
        data = f.read()
    buffer = synthizer.Buffer.from_encoded_data(data)
    gen = synthizer.BufferGenerator(ctx)
    gen.buffer = buffer
    src = synthizer.DirectSource(ctx)
    src.add_generator(gen)
    print("Press enter to exit")
    input()
コード例 #3
0
ファイル: echo.py プロジェクト: Keithcat1/synthizer
"""Demonstrates how to configure echo in a  relatively real-world scenario akin to what a reverb would do for early reflections.

By setting taps up in various configurations, it's possible to get a number of different effects.

Usage is echo.py myfile.
For best results, use a music file or something that's long enough to play as long as the sleeps at the end of this file."""
import synthizer

import time
import random
import sys
import math

with synthizer.initialized(log_level=synthizer.LogLevel.DEBUG,
                           logging_backend=synthizer.LoggingBackend.STDERR):
    # Normal source setup from a CLI arg.
    ctx = synthizer.Context()
    gen = synthizer.BufferGenerator(ctx)
    buffer = synthizer.Buffer.from_file(sys.argv[1])
    gen.buffer = buffer
    src = synthizer.Source3D(ctx)
    src.add_generator(gen)

    # create and connect the effect with a default gain of 1.0.
    echo = synthizer.GlobalEcho(ctx)
    ctx.config_route(src, echo)

    # Generate uniformly distributed random taps.
    # Remember: echo currently only allows up to 5 seconds of delay.
    n_taps = 100
    duration = 2.0
コード例 #4
0
"""Example demonstrating how to load Libsndfile. To use, provide two
parameters: load_libsndfile.py libsndfile_path file_path"""
import sys

import synthizer

libsndfile_path = sys.argv[1]
file_path = sys.argv[2]


with synthizer.initialized(
    log_level=synthizer.LogLevel.DEBUG,
    logging_backend=synthizer.LoggingBackend.STDERR,
    libsndfile_path=libsndfile_path,
):
    ctx = synthizer.Context()
    buffer = synthizer.Buffer.from_file(file_path)
    gen = synthizer.BufferGenerator(ctx)
    gen.buffer = buffer
    src = synthizer.DirectSource(ctx)
    src.add_generator(gen)
    print("Press enter to exit")
    input()