Skip to content

Commit 95e445b

Browse files
committed
linting feedback
1 parent b0d4c5f commit 95e445b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

apps/fretonator-web/src/app/common/playback/note-playback.service.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ export class NotePlaybackService {
2121

2222
playNote(stringName, fret) {
2323
if (this.context) {
24-
let noteFrequency = this.getFrequency(stringName, fret);
24+
const noteFrequency = this.getFrequency(stringName, fret);
2525
this.pluckString(noteFrequency);
2626
}
2727
}
2828

2929
private getFrequency(stringName, fret) {
3030
// We're using stringName here, the case sensitive alt to string, to differentiate E/e strings.
31-
let stringFrequency = StringFrequencies[stringName];
32-
let fretCents = fret * 100;
31+
const stringFrequency = StringFrequencies[stringName];
32+
const fretCents = fret * 100;
3333
return stringFrequency * Math.pow(2, (fretCents / 1200));
3434
}
3535

3636
private pluckString(frequency: number) {
3737
// Use Karplus-Strong algo to simply synth guitar-like sounds.
3838
// https://ccrma.stanford.edu/~jos/pasp/Karplus_Strong_Algorithm.html
39-
let processor = this.context.createScriptProcessor(SYNTH_BUFFER_SIZE, 0, 1);
40-
let signalPeriod = Math.round(this.context.sampleRate / frequency);
41-
let currentSample = new Float32Array(signalPeriod);
39+
const processor = this.context.createScriptProcessor(SYNTH_BUFFER_SIZE, 0, 1);
40+
const signalPeriod = Math.round(this.context.sampleRate / frequency);
41+
const currentSample = new Float32Array(signalPeriod);
4242
// Fill sample with random noise -1 through +1
4343
this.fillWithNoise(currentSample, signalPeriod);
4444
let n = 0;
4545
processor.addEventListener('audioprocess', (e) => {
4646
// Populate output buffer with signal
47-
let outputBuffer = e.outputBuffer.getChannelData(0);
47+
const outputBuffer = e.outputBuffer.getChannelData(0);
4848
for (let i = 0; i < outputBuffer.length; i++) {
4949
// Lowpass the signal by averaging it with the next point
5050
currentSample[n] = (currentSample[n] + currentSample[(n + 1) % signalPeriod]) / 2;
@@ -54,7 +54,7 @@ export class NotePlaybackService {
5454
}
5555
});
5656
// Filter the output
57-
let bandpass = this.createBandpassFilter(frequency);
57+
const bandpass = this.createBandpassFilter(frequency);
5858
processor.connect(bandpass);
5959
// Kill the processor after 2 seconds
6060
setTimeout(() => {
@@ -70,7 +70,7 @@ export class NotePlaybackService {
7070
}
7171

7272
private createBandpassFilter(frequency){
73-
let bandpass = this.context.createBiquadFilter();
73+
const bandpass = this.context.createBiquadFilter();
7474
bandpass.type = "bandpass";
7575
bandpass.frequency.value = Math.round(frequency);
7676
bandpass.Q.value = 1 / 6;

0 commit comments

Comments
 (0)