<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def kaldi_pitch(wav_dir: str, feat_dir: str) -> None: """ Extract Kaldi pitch features. Assumes 16k mono wav files."""


    logger.debug("Make wav.scp and pitch.scp files")
    # Make wav.scp and pitch.scp files
    prefixes = []
    for fn in os.listdir(wav_dir):
        prefix, ext = os.path.splitext(fn)
        if ext == ".wav":
            prefixes.append(prefix)

    wav_scp_path = os.path.join(feat_dir, "wavs.scp")
    with open(wav_scp_path, "w") as wav_scp:
        for prefix in prefixes:
            logger.info("Writing wav file: %s", os.path.join(wav_dir, prefix + ".wav"))
            print(prefix, os.path.join(wav_dir, prefix + ".wav"), file=wav_scp)

    pitch_scp_path = os.path.join(feat_dir, "pitch_feats.scp")
    with open(pitch_scp_path, "w") as pitch_scp:
        for prefix in prefixes:
            logger.info("Writing scp file: %s", os.path.join(feat_dir, prefix + ".pitch.txt"))
            print(prefix, os.path.join(feat_dir, prefix + ".pitch.txt"), file=pitch_scp)

    # Call Kaldi pitch feat extraction
    args = [os.path.join(config.KALDI_ROOT, "src/featbin/compute-kaldi-pitch-feats"),
            "scp:%s" % (wav_scp_path), "scp,t:%s" % pitch_scp_path]
    logger.info("Extracting pitch features from wavs listed in {}".format(
        wav_scp_path))
    subprocess.run(args)

    # Convert the Kaldi pitch *.txt files to numpy arrays.
    for fn in os.listdir(feat_dir):
        if fn.endswith(".pitch.txt"):
            pitch_feats = []
            with open(os.path.join(feat_dir, fn)) as f:
                for line in f:
                    sp = line.split()
                    if len(sp) > 1:
                        pitch_feats.append([float(sp[0]), float(sp[1])])
            prefix, _ = os.path.splitext(fn)
            out_fn = prefix + ".npy"
            a = np.array(pitch_feats)
            np.save(os.path.join(feat_dir, out_fn), a)