Example #1
0
def expect(*notes):
    """
    Expect one or more notes to be heard.
    """
    
    notes = [Note.parse(note) for note in notes]
    _current_run.expect(notes)
Example #2
0
                profile = Profile(profile_name, path=path)
            else:
                raise
        except ProfileReadError, e:
            parser.error("invalid profile: %s" % e)

    capturer = Capturer(create_listener(options))

    targets = []
    is_range = False
    for arg in args:
        if arg == "-":
            is_range = True
            continue

        note = Note.parse(arg)
        if is_range:
            start = targets[-1].semitone + 1
            for i in xrange(start, note.semitone + 1):
                targets.append(Note.from_semitone(i))
        else:
            targets.append(note)

    capturer.start()
    try:
        for target in targets:
            if options.harmonics:
                harmonics = target.get_harmonics(options.harmonics)
            else:
                harmonics = None
Example #3
0
     help='FFT interval')
 parser.add_option('-w', '--window-size', metavar='SAMPLES', type='int',
     help='FFT window size')
 parser.set_defaults(interval=1024, window_size=4096, track=False,
     debug=False, peaks=False, profile='piano')
 
 options, args = parser.parse_args()
 
 profile = None
 if options.profile:
     try:
         profile = load_profile(options.profile)
     except Exception, e:
         parser.error('error reading profile: %s' % e)
 
 watched = [Note.parse(arg) for arg in args]
 
 def show_components(components):
     watched_components = [components.get(note) for note in watched]
     
     def describe(component):
         if component is None:
             return ' ' * 14
         
         desc = '%-14s' % ('%5.1f, %s' % (component.intensity,
             component.state))
         if component.state is FADING and component.previous_state is RISING:
             return color('purple!', desc)
         elif component.state is RISING:
             return color('green', desc)
         elif component.state is FADING: