Skip to content

Commit 18da8fa

Browse files
Avoid divide by zero in the same way as CODAL.
1 parent 09d8c84 commit 18da8fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/board/audio/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ export class Audio {
118118
}
119119

120120
setPeriodUs(periodUs: number) {
121-
this.frequency = 1000000 / periodUs;
121+
// CODAL defaults in this way:
122+
this.frequency = periodUs === 0 ? 6068 : 1000000 / periodUs;
122123
if (this.oscillator) {
123124
this.oscillator.frequency.value = this.frequency;
124125
}

0 commit comments

Comments
 (0)