def playNote(freq, duration, base):
    """play a note of freq (hertz) for duration (seconds)"""
    snd = tkSnack.Sound()
    if bsound ==1:
        filt = tkSnack.Filter('generator', freq, 44100, 0.0, 'sine', int(11500*duration))
    elif bsound==2:
        filt = tkSnack.Filter('generator', freq, 44100, 0.5, 'rectangle', int(11500*duration))
    elif bsound==3:
        filt = tkSnack.Filter('generator', freq, 44100, 0.0, 'triangle', int(11500*duration))
    
    snd.stop()
    for i in range(delay) :
        snd.play(filter=filt, blocking=1)
        sleep(delay2)
示例#2
0
def playNote(freq, duration):
    """play a note of freq (hertz) for duration (seconds)"""
    snd = tkSnack.Sound()
    filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine',
                          int(11500 * duration))
    snd.stop()
    snd.play(filter=filt, blocking=1)
示例#3
0
def playNote(freq, duration):
    global mySound
    mySound.stop()
    mySound.flush()
    #mySound = tkSnack.Sound()
    filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine',
                          int(11500 * duration))
    #mySound.stop()
    mySound.play(filter=filt, blocking=0)
    root.update()
示例#4
0
def playnote(freq, duration):
    # Initialize sound interface
    snd = tkSnack.Sound()
    # Generate a sound of given frequency for given duration
    # Sound is produced using a sine wave
    filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine',
                          int(10000 * duration))
    # Stop all sound definitions
    snd.stop()
    # Play sound, block all other sounds except this
    snd.play(filter=filt, blocking=1)
示例#5
0
def playNote(freq, duration):
    snd = tkSnack.Sound()
    filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine', int(11500*duration))
    snd.stop()
    snd.play(filter=filt, blocking=1)
示例#6
0
def play_freq(freq, duration):
    """play a note of freq (hertz) for duration (seconds)"""
    global snd
    filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine',
                          int(11500 * duration))
    snd.play(filter=filt, blocking=1)