Example #1
0
def rising_chords(vol=1, tremolo=False, echo=False):
    '''Simple test wave, similar to rising(), but with chords and effects.

    Args:
        vol - set volume between 0 and 1
        tremolo - enable or disable tremelo
        echo - enable or disable echo
    Returns:
        None
    '''
    tremolo_freq = 5 if tremolo else 0

    time = timing.Timing(175, 3)
    abc_notes = ["C, D, E, F,|G, A, B, C|D E F G|A B c d|e f g a|b c' d' e'|f' g' a' b'| c'']",
                 "E, F,|G, A, B, C|D E F G|A B c d|e f g a|b c' d' e'|f' g' a' b'| c'']",
                 "G, A, B, C|D E F G|A B c d|e f g a|b c' d' e'|f' g' a' b'| c'']"]

    # hacking around the fact that abc.c doesn't parse chords yet
    notes = zip(*map(abcp.parse_str, abc_notes))
    chords = [[note[0] for note in chord] for chord in notes]

    # play the wave
    pa, stream = play.open_stream()
    wave = BeatingSynth(time, chords, detune=1, vol=.3,
                        tremolo_freq=tremolo_freq)
    if echo:
        wave = effects.echo(time, wave, vol=0.3, delay=1/4)
    play.source(stream, wave)
    play.close_stream(pa, stream)
Example #2
0
 def _post_process(self):
     '''Effects added to the instrument. They can linger beyond notes.'''
     if self._tremolo_freq > 0:
         self._wave = effects.tremolo(self._wave, self._tremolo_freq)
     if self._slow_intro:
         attack = adsr.linear_envelope(0, 1, self._total_dur)
         self._wave = mixer.multiply((self._wave, attack))
     self._wave = effects.echo(self._timer, self._wave, .2, 1/4)