예제 #1
0
def instrument(freq1, freq2, freq3):
    wave = adder(sources=[
                    sine_wave(frequency=freq1, duration=2, amplitude=0.3),
                    sine_wave(frequency=freq2, duration=2, amplitude=0.3),
                    sine_wave(frequency=freq3, duration=2, amplitude=0.3),
                    ],
                duration=2)
    return wave;
예제 #2
0
# Author:  Martin McBride
# Created: 2016-01-08
# Copyright (C) 2016, Martin McBride
# License: MIT
# Website sympl.org/pysound


try:
    import pysound
except ImportError:
    # if pysound is not installed append parent dir of __file__ to sys.path
    import sys, os
    sys.path.insert(0, os.path.abspath(os.path.split(os.path.abspath(__file__))[0]+'/..'))

from pysound.wavetable import sine_wave
from pysound.wavetable import square_wave

from pysound.soundfile import write_wav

#
# Create a tremolo effect
#
amp = sine_wave(frequency=10, amplitude=0.1, offset = 0.8)
wave = square_wave(frequency=400, amplitude=amp)
write_wav(source=wave, filename='tremolo.wav')
예제 #3
0
# Author:  Martin McBride
# Created: 2016-06-12
# Copyright (C) 2016, Martin McBride
# License: MIT
# Website sympl.org/pysound


try:
    import pysound
except ImportError:
    # if pysound is not installed append parent dir of __file__ to sys.path
    import sys, os
    sys.path.insert(0, os.path.abspath(os.path.split(os.path.abspath(__file__))[0]+'/..'))

from pysound.sequencers import sample_and_hold
from pysound.wavetable import sine_wave
from pysound.wavetable import square_wave

from pysound.soundfile import write_wav

#
# use sample and hold to vary frequency
#

params = {'duration': 10}

lfo = sine_wave(frequency=7, offset=500, amplitude=100, **params)
trigger = square_wave(frequency=2.596, **params)
freq = sample_and_hold(source=lfo, trigger=trigger, **params)
out = sine_wave(frequency=freq, **params)
write_wav(source=out, filename='sample-hold.wav')
예제 #4
0
def instrument(freq):
    wave = sine_wave(frequency=freq, duration=0.5, amplitude=0.5);
    return wave;
예제 #5
0
# Author:  Martin McBride
# Created: 2016-01-08
# Copyright (C) 2016, Martin McBride
# License: MIT
# Website sympl.org/pysound


try:
    import pysound
except ImportError:
    # if pysound is not installed append parent dir of __file__ to sys.path
    import sys, os
    sys.path.insert(0, os.path.abspath(os.path.split(os.path.abspath(__file__))[0]+'/..'))

from pysound.soundfile import write_wav
from pysound.wavetable import sine_wave

from pysound.mixers import modulator

#
# Mix the signals
#
wave1 = sine_wave(frequency=400)
wave2 = sine_wave(frequency=10)
wave = modulator(sources=[wave1, wave2])
write_wav(source=wave, filename='modulator.wav')
예제 #6
0
# Author:  Martin McBride
# Created: 2016-06-12
# Copyright (C) 2016, Martin McBride
# License: MIT
# Website sympl.org/pysound


try:
    import pysound
except ImportError:
    # if pysound is not installed append parent dir of __file__ to sys.path
    import sys, os
    sys.path.insert(0, os.path.abspath(os.path.split(os.path.abspath(__file__))[0]+'/..'))

from pysound.soundfile import write_wav
from pysound.wavetable import sine_wave

from pysound.envelopes import ramp
from pysound.music import Notes

#
# Create a ramp envelope and a ramp frequency
#

freq = ramp(start=Notes.A4, end=Notes.A3)
wave = sine_wave(frequency=freq)
out = ramp(source=wave)
write_wav(source=out, filename='ramp.wav')