All witnesses required to recognize with or without sureties shall, if they refuse, be committed to the county jail by the magistrate, there to remain until they comply with such orders or be otherwise discharged according to law: PROVIDED, That when the magistrate is satisfied that any witness required to recognize with sureties is unable to comply with such order, the magistrate shall immediately take the deposition of such witness and discharge the witness from custody upon the witness' own recognizance. The testimony of the witness shall be reduced to writing by a district judge or some competent person under the judge's direction, and only the exact words of the witness shall be taken; the deposition, except the cross-examination, shall be in the narrative form, and upon the cross-examination the questions and answers shall be taken in full. The defendant must be present in person when the deposition is taken, and shall have an opportunity to cross-examine the witnesses; the defendant may make any objections to the admission of any part of the testimony, and all objections shall be noted by the district judge; but the district judge shall not decide as to the admissibility of the evidence, but shall take all the testimony offered by the witness. The deposition must be carefully read to the witness, and any corrections the witness may desire to make thereto shall be made in presence of the defendant by adding the same to the deposition as first taken; it must be signed by the witness, certified by the district judge, and transmitted to the clerk of the superior court, in the same manner as depositions in civil actions. And if the witness is not present when required to testify in the case, either before the grand jury or upon the trial in the superior court, the deposition shall be submitted to the judge of such superior court, upon the objections noted by the district judge, and such judge shall suppress so much of said deposition as such judge shall find to be inadmissible, and the remainder of the deposition may be read as evidence in the case, either before the grand jury or upon the trial in the court.