
338 N.W.2d 658 (1983)
STATE of North Dakota, Plaintiff and Appellant,
v.
Randall M. WUNDERLICH, Defendant and Appellee.
Cr. No. 923.
Supreme Court of North Dakota.
October 4, 1983.
*659 Tom P. Slorby, State's Atty., Minot, for plaintiff and appellant.
Randall M. Wunderlich, pro se; no appearance except memorandum.
SAND, Justice.
The Ward County district court rejected Randall M. Wunderlich's plea of guilty and sua sponte, without having given prior notice to the State, dismissed theft by check felony charges[1] against him on the basis that the State had denied him a speedy trial. The State appealed.
The police arrested Wunderlich on 20 June 1981, and he made his initial appearance pro se in Ward County Court on 23 June 1981. The court later appointed Steven C. Farhart, a Minot attorney, to represent the defendant.
When the defendant made his initial appearance in Ward County Court, similar charges were pending against him in Burleigh and Stark Counties. Pursuant to Rule 20, NDRCrimP, the defendant on 28 September 1981 in writing requested to plead guilty to the Stark County charges, and to have them consolidated with the Burleigh County charges for disposition in Burleigh County. The Burleigh County State's Attorney's office consented to the defendant's request for consolidation on 9 February 1982. Although the record contains no written agreement of a consolidation and transfer of the Ward County charges to *660 Burleigh County, the transcript indicates that an agreement apparently existed.[2]
Ward County subsequently transferred the defendant to the Burleigh County jail where he was incarcerated for about three weeks. The Burleigh County court appointed a new counsel, Bismarck attorney Fintan L. Dooley, to represent him. On 14 January 1982 the defendant and the Burleigh County state's attorney's office, together with the consent of the Ward County state's attorney's office, agreed to defer prosecution provided that the defendant made restitution in the amount of $650 by 14 January 1983.
The record is unclear, but apparently a breakdown in communications between the parties resulted in the Ward County charges not being presented when the defendant appeared in Burleigh County.[3] Upon discovery of this fact, the Ward County state's attorney's office had the defendant reappear in Ward County Court on 12 January 1983. Wunderlich appeared pro se and was bound over to Ward County District Court for arraignment, where he pleaded guilty to both counts of theft on 8 February 1983. When the court asked why the prosecution was delayed, the State explained the apparent breakdown in communications. After an off-the-record, ex parte conference with the state's attorney, the court went back on the record to note that the state's attorney "had nothing to say [about the delay] other than what he had said for the record."[4]
The State contends that pursuant to NDRCrimP 48(b) the trial court erred in dismissing the complaint at the arraignment because the State did not have sufficient time to respond.
Rule 48(b), NDRCrimP, in pertinent part, provides:
"If there is unnecessary delay in ... filing an information or complaint against a defendant who has been arrested or for whose arrest a warrant has been issued, or if there is unnecessary delay in bringing a defendant to trial, the court may dismiss the indictment, information, or complaint."
Furthermore, the court may dismiss a complaint for unnecessary delay without a showing that the delay deprived the defendant of a constitutional right. Mann v. United States, 304 F.2d 394, 398 (D.C.Cir.1961), cert. denied, 371 U.S. 896, 83 S.Ct. 194, 9 L.Ed.2d 127 (1962); State v. Erickson, 241 N.W.2d 854, 859 (N.D.1976).
Generally, certain basic factors are considered relevant in determining whether or not the right to a speedy trial has been denied. These factors are: length of the delay, reason for the delay, assertion of the right by the defendant, and prejudice to the defendant. Barker v. Wingo, 407 U.S. 514, 92 S.Ct. 2182, 33 L.Ed.2d 101 (1972); State v. Erickson, supra. Further, these factors are related and must be considered together with other relevant circumstances. The trial court must then engage in a difficult and sensitive balancing process. Barker v. Wingo, 407 U.S. at 533, *661 92 S.Ct. at 2193, 33 L.Ed.2d at 118; State v. Erickson, 241 N.W.2d at 859.
In State v. Teigen, 289 N.W.2d 242 (N.D. 1980), we addressed a similar claim that the defendant had been denied a speedy trial. In Teigen the police arrested the defendant in August of 1978 but the trial was not until August of 1979. On the morning of the trial, the defendant's attorney notified the prosecutor that she would move for an order dismissing the complaint on the grounds that the defendant had been denied a speedy trial. The court heard the motion that afternoon and thereafter dismissed the case. In Teigen we held that the trial court abused its discretion in dismissing the complaint because it did not provide the State a reasonable opportunity to prepare to meet the questions raised by the defendant's motion. Specifically, we said that the State must be afforded time to (1) investigate the circumstances surrounding the delay, (2) prepare a response if that were found to be appropriate, and (3) support the response with a brief and oral argument. State v. Teigen, 289 N.W.2d at 244.
With respect to the factors relevant to a speedy trial issue, we said that although the record indicated that the trial court was cognizant of them, the State should have at least been afforded the opportunity to submit a brief addressing each of the factors, as well as other relevant circumstances. In summary, we held that there is no justification for allowing a party less than one day to prepare to meet questions raised by an adversary on a motion to dismiss for lack of a speedy trial. State v. Teigen, 289 N.W.2d at 244.
We believe that the rationale of Teigen applies to the instant case. Although distinctions may be drawn between the cases, they are not controlling. Teigen concerned a motion to dismiss by the defendant, whereas this case concerns a dismissal by the court sua sponte. Such a distinction is insignificant because the prejudice caused by a lack of notice to the party opposing the dismissal is the same regardless of who initiates it. The trial court provided the State an opportunity to explain the delay in an off-the-record, ex parte conference. However, that opportunity was insufficient in view of our decision in Teigen that there is no reason for allowing the party less than one day to prepare to meet a motion to dismiss for lack of a speedy trial. State v. Teigen, 289 N.W.2d at 244. Due process is essential at all times and circumstances unless waived.
Although the delay was longer in this case than in Teigen, the length of the delay is not controlling by itself. State v. Erickson, 241 N.W.2d at 860. The record does not indicate that the trial court gave any consideration to balancing the factors mentioned in Teigen, particularly the defendant's assertion (in this instance, non-assertion) of his right to a speedy trial and the resulting prejudice to him. The defendant apparently never asserted his right to a speedy trial. Although the defendant moved to consolidate his charges pursuant to NDRCrimP 20, a motion to consolidate is not the equivalent of an assertion of a demand for a speedy trial. State v. Means, 276 N.W.2d 699, 703 (S.D.1979). Furthermore, the defendant did not show that he was unduly prejudiced by the delay. A delay of approximately 19 months occurred but this was not the result of any attempt by the State to delay trial for the purpose of hindering defendant's defense. The Ward County state's attorney's office reasonably believed that a guilty plea had been entered based upon representations by the Burleigh County state's attorney's office. Further, Ward County received some restitution from the defendant which supported their belief.
Finally, we note that a defendant can waive his right to a speedy trial in several ways: (1) by failing to present the claim prior to or at trial; (2) by entering a voluntary plea of guilty; (3) by failing to demand a prompt trial; or (4) by expressly consenting to the delay. 20 Stan.L.Rev. 476, 478-480.
In this case, the defendant not only failed to demand a speedy trial as previously *662 noted, but he also entered a voluntary plea of guilty in Burleigh County court and in Ward County district court.[5] In State v. Barlow, 193 N.W.2d 455, 457 (N.D.1971), we held that, as a general rule, a voluntary plea of guilty waives all nonjurisdictional defects in the proceedings up to that point. Although we have not previously considered whether or not a plea of guilty constitutes a waiver of the right to a speedy trial, we hold that it does. See United States v. Doyle, 348 F.2d 715 (2d Cir.1965), cert. denied, 382 U.S. 843, 86 S.Ct. 89, 15 L.Ed.2d 84 (1965); State v. McGee, 211 N.W.2d 267 (Iowa 1973). Legal logic compels the conclusion that a defendant has the right to waive his right to a speedy trial and plead guilty.
Accordingly, the judgment of dismissal is reversed and the case is remanded for appropriate proceedings in conformity with this opinion.
ERICKSTAD, C.J., PEDERSON and VANDE WALLE, JJ., and WM. L. PAULSON, Surrogate Justice,[*] concur.
NOTES
[1]  The defendant deposited checks totaling $1,043.22 in an account with Midwest Federal Savings & Loan Association of Minot on 2 February 1981. He withdrew $800.00 in cash from that account the same day. Count one of a two-count complaint charged that Wunderlich made the withdrawal knowing that the checks composing the deposit were drawn on an account with the Bismarck State Bank that had been closed. The second count charged that Wunderlich issued a series of NSF or no-account checks exceeding $100.00 to several Minot merchants.
[2]  In response to questions from the court, the defendant explained the consolidation of charges as follows:

"Q. [A]n agreement was made whereby these charges would be transferred to Bismarck for a guilty plea down there?
"A. That is right ....
"Q. [D]o you recall signing a Rule 20 transfer to transfer everything down to Bismarck?
"A. That is right."
The record does not indicate that the plea was involuntary.
[3]  The Assistant Ward County State's Attorney explained the reason for the delay as follows: "Steve Farhart was first appointed back in June of `81. At that time they had the charges pending in Burleigh County. Steve Farhart got together with the attorney down there. They wanted to move everything down there. Our file was forwarded from County Court down there and nothing happened to it down there. We were receiving some restitution which added to our belief that a guilty plea had been entered. And we would check with them down there and they would say it went through court, so finally we checked with the county court and found out it didn't. Then, basically, it was started back here again and Mr. Wunderlich came in and was bound over in January of this year."
[4]  See supra note 3.
[5]  In a memorandum to this Court the defendant said:

"I will not be filing any papers in this matter. I have been going around over this matter for too long already. I only wanted to plead guilty to this matter since the onset, and when I did this is what happened. I did not ask for any dismissal. I only hope that whoever needs to do something to straighten this out will do just that.
[*]  WM. L. PAULSON, J., served as a Surrogate Justice for this case pursuant to Section 27-17-03, N.D.C.C.
