Example #1
0
    seconds = vf.time_tell() - startTime
    return (sampleRate, seconds, [[float(v) / maxValue for v in data[x::channelCount]] for x in xrange(channelCount)])

if __name__=='__main__':
    
    def powerOfTwo(i):
        i = int(i)
        l = math.log(i, 2)
        if math.floor(l) != l:
            raise ValueError('Must be power of two: {0}'.format(i))
        return i
        
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="Create a spectrum view from an ogg/vorbis file.",
        epilog=u"Available filters:\n {0}".format(u"\n ".join(u"{0}:\n  {1}".format(filterType, samplerate.convertor_description(filterType)) for filterType in samplerate.available_convertors()))
    )
    
    inputGroup = parser.add_argument_group("Input settings")
    inputGroup.add_argument(
        dest='infile', 
        metavar='INPUTFILE',
        type=argparse.FileType('rb'),
        help='Input file of type audio/vorbis'
    )
    inputGroup.add_argument('-s', '--skip',
        metavar='SECONDS',
        type=float,
        help='seconds to skip at the start of the file',
        default=0.
    )
Example #2
0
from scikits.samplerate import available_convertors, convertor_description

for type in available_convertors():
    print convertor_description(type)
if __name__ == '__main__':

    def powerOfTwo(i):
        i = int(i)
        l = math.log(i, 2)
        if math.floor(l) != l:
            raise ValueError('Must be power of two: {0}'.format(i))
        return i

    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="Create a spectrum view from an ogg/vorbis file.",
        epilog=u"Available filters:\n {0}".format(u"\n ".join(
            u"{0}:\n  {1}".format(filterType,
                                  samplerate.convertor_description(filterType))
            for filterType in samplerate.available_convertors())))

    inputGroup = parser.add_argument_group("Input settings")
    inputGroup.add_argument(dest='infile',
                            metavar='INPUTFILE',
                            type=argparse.FileType('rb'),
                            help='Input file of type audio/vorbis')
    inputGroup.add_argument('-s',
                            '--skip',
                            metavar='SECONDS',
                            type=float,
                            help='seconds to skip at the start of the file',
                            default=0.)
    inputGroup.add_argument(
        '-t',