Create the ``self.audio_file`` object by reading
        the audio file at ``self.audio_file_path_absolute``.
552709
def _populate_audio_file(self):
        
        self.log(u"Populate audio file...")
        if self.audio_file_path_absolute is not None:
            self.log([u"audio_file_path_absolute is '%s'", self.audio_file_path_absolute])
            self.audio_file = AudioFile(
                file_path=self.audio_file_path_absolute,
                logger=self.logger
            )
            self.audio_file.read_properties()
        else:
            self.log(u"audio_file_path_absolute is None")
        self.log(u"Populate audio file... done")
530939
def init_from_wave_file(wavpath):
        

        try:
            samplerate, data =  SW.read(wavpath)
            nframes = data.shape[0]
        except:
            # scipy cannot handle 24 bit wav files
            # and wave cannot handle 32 bit wav files
            try:
                w = wave.open(wavpath)
                samplerate = w.getframerate()
                nframes = w.getnframes()
            except:
                raise Exception('Cannot decode wavefile ' + wavpath)

        return SVEnv(samplerate, nframes, wavpath)
229104
def open_instance_resource(self, path: FilePath, mode: str='rb') -> IO[AnyStr]:
        
        return open(self.instance_path / file_path_to_path(path), mode)
162287
def add(self, src):
        
        if not audio.get_type(src):
            raise TypeError('The type of this file is not supported.')

        return super().add(src)
781996
def _get_audio_sample_bit(self, audio_abs_path):
        
        sample_bit = int(
           subprocess.check_output(
               ("""sox --i {} | grep "{}" | awk -F " : " '{{print $2}}' | grep -oh "^[^-]*" """).format(audio_abs_path, "Precision"),
               shell=True, universal_newlines=True).rstrip())
        return sample_bit
1097120
def _read_audio_data(self, file_path):
        
        try:
            self.log(u"Reading audio data...")
            # if we know the TTS outputs to PCM16 mono WAVE
            # with the correct sample rate,
            # we can read samples directly from it,
            # without an intermediate conversion through ffmpeg
            audio_file = AudioFile(
                file_path=file_path,
                file_format=self.OUTPUT_AUDIO_FORMAT,
                rconf=self.rconf,
                logger=self.logger
            )
            audio_file.read_samples_from_file()
            self.log([u"Duration of '%s': %f", file_path, audio_file.audio_length])
            self.log(u"Reading audio data... done")
            return (True, (
                audio_file.audio_length,
                audio_file.audio_sample_rate,
                audio_file.audio_format,
                audio_file.audio_samples
            ))
        except (AudioFileUnsupportedFormatError, OSError) as exc:
            self.log_exc(u"An unexpected error occurred while reading audio data", exc, True, None)
            return (False, None)
480674
def file_abspath(self, resource):
        """"""
        warnings.warn(
            "file_abspath is deprecated; use resource_path instead",
            DeprecationWarning, stacklevel=2)
        return self.resource_path(resource)
615246
async def create_ffmpeg_player(self, filepath):
        """"""
        self.current_download_elapsed = 0

        self.streamer = self.vclient.create_ffmpeg_player(filepath, after=self.vafter_ts)
        self.state = "ready"
        await self.setup_streamer()

        try:
            # Read from the info json
            info_filename = "{}.info.json".format(filepath)
            with open(info_filename, 'r') as file:
                info = json.load(file)

                self.nowplayinglog.debug(info["title"])
                self.is_live = False

                if "duration" in info and info["duration"] is not None:
                    self.current_duration = info["duration"]
                else:
                    self.current_duration = 0

                if "uploader" in info:
                    self.nowplayingauthorlog.info(info["uploader"])
                else:
                    self.nowplayingauthorlog.info("Unknown")

                self.nowplayingsourcelog.info(api_music.parse_source(info))

                play_state = "Streaming" if self.is_live else "Playing"
                await self.set_topic("{} {}".format(play_state, info["title"]))
                self.statuslog.debug(play_state)
        except Exception as e:
            logger.exception(e)
1064628
def _reader_factory(name, filetype, descr):
    """"""
    def basic_reader(filename, last = None, first = 0):
        """Common "template" to all read functions."""
        hdl = Sndfile(filename, 'r')
        try:
            if not hdl.format.file_format == filetype:
                raise ValueError, "%s is not a %s file (is %s)" \
                      % (filename, filetype, hdl.format.file_format)

            fs = hdl.samplerate
            enc = hdl.encoding
            # Set the pointer to start position
            nf  = hdl.seek(first, 1)
            if not nf == first:
                raise IOError("Error while seeking at starting position")

            if last is None:
                nframes = hdl.nframes - first
                data    = hdl.read_frames(nframes)
            else:
                data    = hdl.read_frames(last)
        finally:
            hdl.close()

        return data, fs, enc
    doc = \
    """Simple reader for %(format)s audio files.

    Parameters
    ----------
    filename : str
        Name of the file to read
    last : int
        Last frame to read. If None, this is equal to the number of frames in
        the file.
    first : int
        First frame to read. If 0, means starting from the beginning of the
        file.

    Returns
    -------
    data : array
        the read data (one column per channel)
    fs : int
        the sampling rate
    enc : str
        the encoding of the file, such as 'pcm16', 'float32', etc...

    Notes
    -----
    For total control over options, such as output's dtype, etc...,
    you should use Sndfile class instances instead""" % {'format': str(descr)}
    basic_reader.__doc__    = doc
    basic_reader.__name__   = name
    return basic_reader
872834
def _open(self, mode=None):
        
        if mode is None:
            mode = self.mode
        if self.encoding is None:
            stream = open(self.baseFilename, mode)
        else:
            stream = codecs.open(self.baseFilename, mode, self.encoding)
        return stream
420950
def to_existing_absolute_path(string):
    """"""
    value = os.path.abspath(string)
    if not os.path.exists( value ) or not os.path.isdir( value ):
        msg = '"%r" is not a valid path to a directory.' % string
        raise argparse.ArgumentTypeError(msg)
    return value
1137737
def absolute_path(self, path, start):
        
        if posixpath.isabs(path):
            path = posixpath.join(staticfiles_storage.location, path)
        else:
            path = posixpath.join(start, path)
        return posixpath.normpath(path)
383229
def _get_abs_filepath(self, ifile):
        
        assert ifile is not None
        ifile = ifile[7:] if ifile.startswith('file://') else ifile
        if ifile[0] != '/':
            basedir = os.path.abspath(os.path.dirname(self.config_file))
            ifile = os.path.join(basedir, ifile)
        return 'file://' + ifile
1299526
def match_file(apikey, path, metadata=None):
    
    import audioread
    with audioread.audio_open(path) as f:
        return match(apikey, iter(f), f.samplerate, int(f.duration),
                     f.channels, metadata)
572761
def play(self, stream_url, offset=0, opaque_token=None):
        """"""

        self._response['shouldEndSession'] = True
        directive = self._play_directive('REPLACE_ALL')
        directive['audioItem'] = self._audio_item(stream_url=stream_url, offset=offset, opaque_token=opaque_token)
        self._response['directives'].append(directive)
        return self
999538
def make_file(abspath, text):
    
    try:
        with open(abspath, "wb") as f:
            f.write(text.encode("utf-8"))
        print("Made: %s" % abspath)
    except:  # pragma: no cover
        pass
608934
function(input_filename, cb_read_file_done) {

    // ------------ read wav file -------------------- //

    // console.log("read_wav_file with input_filename ", input_filename);

    // bbb

    var wav_file_input_obj = {};  // create stub object to which we attach .buffer

    var property_buffer_raw_input_file = "buffer_raw_input_file";

    wav_file_input_obj.filename = input_filename;

    wav_file_input_obj[property_buffer_raw_input_file] = new Buffer(0);

    // console.log("abouttttt to read wav_file_input_obj.filename ", wav_file_input_obj.filename);

    var spec = {};

    read_16_bit_wav_file_into_32_bit_float_buffer(
                                    wav_file_input_obj,
                                    wav_file_input_obj.filename, 
                                    spec,
                                    cb_read_file_done);
}