Parameters
        -----------
        audio_abs_path : str

        Returns
        -------
        bit_rate : int
161093
def _get_audio_bit_rate(self, audio_abs_path):
        
        bit_Rate_formatted = subprocess.check_output(
            """sox --i {} | grep "{}" | awk -F " : " '{{print $2}}'""".format(
                audio_abs_path, "Bit Rate"),
            shell=True, universal_newlines=True).rstrip()
        bit_rate = (lambda x:
                    int(x[:-1]) * 10 ** 3 if x[-1].lower() == "k" else
                    int(x[:-1]) * 10 ** 6 if x[-1].lower() == "m" else
                    int(x[:-1]) * 10 ** 9 if x[-1].lower() == "g" else
                    int(x))(bit_Rate_formatted)
        return bit_rate
139872
public int bitrate_instant(){
    int _link=(seekable ? current_link : 0);
    if(samptrack==0)
      return (-1);
    int ret=(int)(bittrack/samptrack*vi[_link].rate+.5);
    bittrack=0.f;
    samptrack=0.f;
    return (ret);
  }
318854
protected AudioFileFormat getAudioFileFormat(InputStream bitStream, int mediaLength, int totalms) throws UnsupportedAudioFileException, IOException {
        Map<String, Object> aff_properties = new HashMap<>();
        Map<String, Object> af_properties = new HashMap<>();
        if (totalms == AudioSystem.NOT_SPECIFIED) {
            totalms = 0;
        }
        if (totalms > 0) {
            aff_properties.put("duration", (long) totalms * 1000);
        }
        oggBitStream_ = bitStream;
        // init jorbis
        oggSyncState_ = new SyncState();
        oggStreamState_ = new StreamState();
        oggPage_ = new Page();
        oggPacket_ = new Packet();
        vorbisInfo = new Info();
        vorbisComment = new Comment();
        buffer = null;
        bytes = 0;
        oggSyncState_.init();

        index = 0;
        try {
            readHeaders(aff_properties, af_properties);
        } catch (IOException ioe) {
            LOG.log(Level.FINE, ioe.getMessage());
            throw new UnsupportedAudioFileException(ioe.getMessage());
        }

        String dmp = vorbisInfo.toString();
        LOG.log(Level.FINE, dmp);
        int ind = dmp.lastIndexOf("bitrate:");
        int minbitrate = -1;
        int nominalbitrate = -1;
        int maxbitrate = -1;
        if (ind != -1) {
            dmp = dmp.substring(ind + 8, dmp.length());
            StringTokenizer st = new StringTokenizer(dmp, ",");
            if (st.hasMoreTokens()) {
                minbitrate = Integer.parseInt(st.nextToken());
            }
            if (st.hasMoreTokens()) {
                nominalbitrate = Integer.parseInt(st.nextToken());
            }
            if (st.hasMoreTokens()) {
                maxbitrate = Integer.parseInt(st.nextToken());
            }
        }
        if (nominalbitrate > 0) {
            af_properties.put("bitrate", nominalbitrate);
        }
        af_properties.put("vbr", true);

        if (minbitrate > 0) {
            aff_properties.put("ogg.bitrate.min.bps", minbitrate);
        }
        if (maxbitrate > 0) {
            aff_properties.put("ogg.bitrate.max.bps", maxbitrate);
        }
        if (nominalbitrate > 0) {
            aff_properties.put("ogg.bitrate.nominal.bps", nominalbitrate);
        }
        if (vorbisInfo.channels > 0) {
            aff_properties.put("ogg.channels", vorbisInfo.channels);
        }
        if (vorbisInfo.rate > 0) {
            aff_properties.put("ogg.frequency.hz", vorbisInfo.rate);
        }
        if (mediaLength > 0) {
            aff_properties.put("ogg.length.bytes", mediaLength);
        }
        aff_properties.put("ogg.version", vorbisInfo.version);

        //AudioFormat.Encoding encoding = VorbisEncoding.VORBISENC;
        //AudioFormat format = new VorbisAudioFormat(encoding, vorbisInfo.rate, AudioSystem.NOT_SPECIFIED, vorbisInfo.channels, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true,af_properties);
        // Patch from MS to ensure more SPI compatibility ...
        float frameRate = -1;
        if (nominalbitrate > 0) {
            frameRate = nominalbitrate / 8;
        } else if (minbitrate > 0) {
            frameRate = minbitrate / 8;
        }

        // New Patch from MS:
        AudioFormat format = new AudioFormat(VORBISENC, vorbisInfo.rate, AudioSystem.NOT_SPECIFIED, vorbisInfo.channels, 1, frameRate, false, af_properties);
        // Patch end

        return new VorbisAudioFileFormat(OGG_AUDIOFILEFORMAT_TYPE, format, AudioSystem.NOT_SPECIFIED, mediaLength, aff_properties);
    }
1175339
def load_randomly_augmented_audio(path, sample_rate=16000, tempo_range=(0.85, 1.15),
                                  gain_range=(-6, 8)):
    
    low_tempo, high_tempo = tempo_range
    tempo_value = np.random.uniform(low=low_tempo, high=high_tempo)
    low_gain, high_gain = gain_range
    gain_value = np.random.uniform(low=low_gain, high=high_gain)
    audio = augment_audio_with_sox(path=path, sample_rate=sample_rate,
                                   tempo=tempo_value, gain=gain_value)
    return audio
588391
def translate_device_rates(val, numeric_rate=True):
    '''
    
    '''
    val = map_vals(val, 'Path', 'Rate')
    for idx in range(len(val)):
        try:
            is_abs = os.path.isabs(val[idx]['Path'])
        except AttributeError:
            is_abs = False
        if not is_abs:
            raise SaltInvocationError(
                'Path \'{Path}\' is not absolute'.format(**val[idx])
            )

        # Attempt to convert to an integer. Will fail if rate was specified as
        # a shorthand (e.g. 1mb), this is OK as we will check to make sure the
        # value is an integer below if that is what is required.
        try:
            val[idx]['Rate'] = int(val[idx]['Rate'])
        except (TypeError, ValueError):
            pass

        if numeric_rate:
            try:
                val[idx]['Rate'] = int(val[idx]['Rate'])
            except ValueError:
                raise SaltInvocationError(
                    'Rate \'{Rate}\' for path \'{Path}\' is '
                    'non-numeric'.format(**val[idx])
                )
    return val
222165
def info(self, abspath=True):
        
        logger.debug(str(''))
        return self._call_and_parse(['info', '--json'], abspath=abspath)
740390
def avg_receive_rate(self):
        
        if not self._has_data or 'sum_received' not in self.result['end']:
            return None
        bps = self.result['end']['sum_received']['bits_per_second']
        return bps / 8 / 1024 / 1024
229723
def _frame_generator(self, frame_duration_ms, audio, sample_rate):
        
        n = int(sample_rate * (frame_duration_ms / 1000.0) * 2)
        offset = 0
        timestamp = 0.0
        duration = (float(n) / sample_rate) / 2.0
        while offset + n < len(audio):
            yield self.Frame(audio[offset:offset + n], timestamp, duration)
            timestamp += duration
            offset += n
627508
def extract_audio(filename, channels=1, rate=16000):
    
    temp = tempfile.NamedTemporaryFile(suffix='.wav', delete=False)
    if not os.path.isfile(filename):
        print("The given file does not exist: {}".format(filename))
        raise Exception("Invalid filepath: {}".format(filename))
    if not which("ffmpeg"):
        print("ffmpeg: Executable not found on machine.")
        raise Exception("Dependency not found: ffmpeg")
    command = ["ffmpeg", "-y", "-i", filename,
               "-ac", str(channels), "-ar", str(rate),
               "-loglevel", "error", temp.name]
    use_shell = True if os.name == "nt" else False
    subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell)
    return temp.name, rate
856373
def absSymPath(path):
    
    curr_path = os.getcwd()
    return os.path.normpath(os.path.join(curr_path, path))
691696
def md5_of_file(abspath):
    
    chunk_size = 1024 * 1024
    m = hashlib.md5()
    with open(abspath, "rb") as f:
        while True:
            data = f.read(chunk_size)
            if not data:
                break
            m.update(data)
    return m.hexdigest()
1041374
def audio_load_time(self):
        
        load_times = self.get_load_times('audio')
        return round(mean(load_times), self.decimal_precision)
982111
def max_bit_rate(self):
        
        status = self.fc.call_action('WANCommonInterfaceConfig',
                                     'GetCommonLinkProperties')
        downstream = status['NewLayer1DownstreamMaxBitRate']
        upstream = status['NewLayer1UpstreamMaxBitRate']
        return upstream, downstream
887916
def main(source_samplerate, target_samplerate, params, converter_type):
    """"""
    from time import sleep

    ratio = target_samplerate / source_samplerate

    with sr.CallbackResampler(get_input_callback(source_samplerate, params),
                              ratio, converter_type) as resampler, \
            sd.OutputStream(channels=1, samplerate=target_samplerate,
                            callback=get_playback_callback(
                                resampler, target_samplerate, params)):
        print("Playing back...  Ctrl+C to stop.")
        try:
            while True:
                sleep(1)
        except KeyboardInterrupt:
            print("Aborting.")
180226
def _abs(ctx, number):
    
    return conversions.to_decimal(abs(conversions.to_decimal(number, ctx)), ctx)
289648
def str_rate(self):
        """"""
        # Handle special cases.
        if not self._eta.started or self._eta.stalled or not self.rate:
            return '--.-KiB/s'

        unit_rate, unit = UnitByte(self._eta.rate_overall if self.done else self.rate).auto
        if unit_rate >= 100:
            formatter = '%d'
        elif unit_rate >= 10:
            formatter = '%.1f'
        else:
            formatter = '%.2f'
        return '{0}{1}/s'.format(locale.format(formatter, unit_rate, grouping=False), unit)
877838
def return_abs_path(directory, path):
    
    if directory is None or path is None:
        return
    directory = os.path.expanduser(directory)
    return os.path.abspath(os.path.join(directory, path))