示例#1
0
def load_mono(filename):
    """load mono audio file with gstreamer
    
    :param filename: name of file, relative path
    :type filename: str
    :return: data -- Channel as list
    :return: samplerate -- Samplerate of audio file
    """
    data, duration, channels, samplerate = read_as_array(filename)
    log.debug("Load File "+filename+"\nduration: "+str(duration)+" seconds\nchannels: "+str(channels)+"\nsamplerate: "+str(samplerate))
    
    return data, samplerate
示例#2
0
def load_stereo(filename):
    """load stereo audio file with gstreamer
    
    :param filename: name of file, relative path
    :type filename: str
    :return: left_channel -- Left channel as list
    :return: right_channel -- Right channel as list
    :return: samplerate -- Samplerate of audio file
    """
    data, duration, channels, samplerate = read_as_array(filename)
    log.debug("Load File "+filename+"\nduration: "+str(duration)+" seconds\nchannels: "+str(channels)+"\nsamplerate: "+str(samplerate))
    
    # seperate left and right channel
    left_channel = data[0,:]
    right_channel = data[1,:]
        
    return left_channel, right_channel, samplerate