Skip to content

Commit 1807397

Browse files
coding style
1 parent 3eba799 commit 1807397

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4125
-3705
lines changed

.eslintrc.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
env: { browser: true, es2020: true },
3-
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
4-
parser: "@typescript-eslint/parser",
5-
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
3+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
4+
parser: '@typescript-eslint/parser',
5+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
66
};

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# JSS-01 |JavaScript Software Synthesizer
2-
# Copyright (c) 2023 Michael Kolesidis <michael.kolesidis@gmail.com>
2+
# Copyright (c) Michael Kolesidis <michael.kolesidis@gmail.com>
33
# GNU Affero General Public License v3.0
44

55
# Logs

CITATION.cff

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
cff-version: 1.2.0
55
title: JSS-01 | JavaScript Software Synthesizer
6-
message: "If you use this software, please cite it as below."
6+
message: 'If you use this software, please cite it as below.'
77
type: software
88
authors:
99
- given-names: Michael
1010
family-names: Kolesidis
1111
email: michael.kolesidis@gmail.com
12-
orcid: "https://orcid.org/0000-0002-2662-4677"
12+
orcid: 'https://orcid.org/0000-0002-2662-4677'
1313
repository: >-
1414
https://github.com/michaelkolesidis/javascript-software-synthesizer
1515
abstract: >-
@@ -31,4 +31,4 @@ keywords:
3131

3232
license: GNU Affero General Public License v3.0
3333
version: 2.0.3
34-
date-released: "2022-07-08"
34+
date-released: '2022-07-08'

CODE_OF_CONDUCT.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
michae.kolesidis@gmail.com.
63+
<michae.kolesidis@gmail.com>.
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the
@@ -116,13 +116,13 @@ the community.
116116

117117
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118118
version 2.0, available at
119-
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
120120

121121
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122122
enforcement ladder](https://github.com/mozilla/diversity).
123123

124124
[homepage]: https://www.contributor-covenant.org
125125

126126
For answers to common questions about this code of conduct, see the FAQ at
127-
https://www.contributor-covenant.org/faq. Translations are available at
128-
https://www.contributor-covenant.org/translations.
127+
<https://www.contributor-covenant.org/faq>. Translations are available at
128+
<https://www.contributor-covenant.org/translations>.

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ All of these are very worthwhile contributions and are more than welcome!
88

99
All contributors will be added in the designated section in the project's readme file.
1010

11-
### Semantic Commit Messages
11+
## Semantic Commit Messages
1212

1313
Starting from version 1.0.6, the project is using semantic commit messages. Please refer to the following links:
1414

1515
[Semantic Commit Messages](https://sparkbox.com/foundry/semantic_commit_messages)
1616
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
1717
[Git Commit Msg](http://karma-runner.github.io/1.0/dev/git-commit-msg.html)
1818

19-
### The JSS-01 is in active development, so if you have any ideas or want to help, feel free to:
19+
## The JSS-01 is in active development, so if you have any ideas or want to help, feel free to
2020

2121
0. Start by creating an issue, so proposed changes can be discussed
2222
1. Fork the Project

FUNDING.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
github: michaelkolesidis
2-

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Thank you so much for your interest in my project! If you want to go a step furt
261261

262262
<a href="https://www.gnu.org/licenses/agpl-3.0.html"><img src="https://upload.wikimedia.org/wikipedia/commons/0/06/AGPLv3_Logo.svg" height="100px" /></a>
263263

264-
Copyright (c) 2023 Michael Kolesidis<br>
264+
Copyright (c) 2023 Michael Kolesidis
265265
Licensed under the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.html).
266266

267267
<br>

SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
In case of finding a vulnerabiity, please open an issue. If the vulnerability is related to Tone.js or any other library used, please contact the respective authors as well.
5+
If you discover a vulnerability, please report it by opening an issue. For vulnerabilities related to Tone.js or any other third-party library used in this project, please reach out to the respective maintainers.

src/audio/audio.ts

+57-54
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* JSS-01 |JavaScript Software Synthesizer
3-
* Copyright (c) 2023 Michael Kolesidis <michael.kolesidis@gmail.com>
3+
* Copyright (c) Michael Kolesidis <michael.kolesidis@gmail.com>
44
* GNU Affero General Public License v3.0
55
*
66
*/
@@ -14,7 +14,10 @@ import { assertNotNull } from '../utils/utils.js';
1414
import displaysUI from '../elements/displays/displays.ui.js';
1515

1616
// @todo
17-
import { getInterface as getKeyboardUI, handlers as keyboardHandlers } from '../elements/keyboard/keyboard.js';
17+
import {
18+
getInterface as getKeyboardUI,
19+
handlers as keyboardHandlers,
20+
} from '../elements/keyboard/keyboard.js';
1821

1922
import createSynth from './synth.js';
2023
import createSynthHandlers from './synth.handlers.js';
@@ -26,72 +29,72 @@ let synth: PolySynth<FMSynth>;
2629
let destination: Destination;
2730

2831
async function createContext() {
29-
const { start, getDestination, Midi } = await import('./tone.js');
32+
const { start, getDestination, Midi } = await import('./tone.js');
3033

31-
await start();
32-
// console.log('started tone context');
34+
await start();
35+
// console.log('started tone context');
3336

34-
destination = getDestination();
37+
destination = getDestination();
3538

36-
assertNotNull(displaysUI.oscilloscope);
37-
assertNotNull(displaysUI.spectrogram);
38-
assertNotNull(displaysUI.meter);
39+
assertNotNull(displaysUI.oscilloscope);
40+
assertNotNull(displaysUI.spectrogram);
41+
assertNotNull(displaysUI.meter);
3942

40-
displaysUI.oscilloscope.connect(destination as unknown as AudioNode);
41-
displaysUI.spectrogram.connect(destination as unknown as AudioNode);
42-
displaysUI.meter.connect(destination as unknown as AudioNode, 1);
43+
displaysUI.oscilloscope.connect(destination as unknown as AudioNode);
44+
displaysUI.spectrogram.connect(destination as unknown as AudioNode);
45+
displaysUI.meter.connect(destination as unknown as AudioNode, 1);
4346

44-
// apply ui settings to audio node
45-
synth = await createSynth();
46-
synth.toDestination();
47+
// apply ui settings to audio node
48+
synth = await createSynth();
49+
synth.toDestination();
4750

48-
// add ui handlers
49-
createSynthHandlers();
50-
createSequencerHandlers();
51+
// add ui handlers
52+
createSynthHandlers();
53+
createSequencerHandlers();
5154

52-
createEffects();
55+
createEffects();
5356

54-
// ---------------------------------------------------------------------
55-
// Synthesizer On-Screen Keyboard Playbility Implementation
56-
// ---------------------------------------------------------------------
57-
// Polyphonic synths need a note or an array of notes
57+
// ---------------------------------------------------------------------
58+
// Synthesizer On-Screen Keyboard Playbility Implementation
59+
// ---------------------------------------------------------------------
60+
// Polyphonic synths need a note or an array of notes
5861

59-
const keyboard = getKeyboardUI();
62+
const keyboard = getKeyboardUI();
6063

61-
let notes: string[] = [];
64+
let notes: string[] = [];
6265

63-
keyboard.on('change', async (note) => {
64-
const noteString = Midi(note.note).toNote();
65-
// console.log(noteString);
66+
keyboard.on('change', async (note) => {
67+
const noteString = Midi(note.note).toNote();
68+
// console.log(noteString);
6669

67-
if (note.state) {
68-
synth.triggerAttack(noteString);
69-
notes.push(noteString);
70-
} else {
71-
synth.triggerRelease(note.note);
72-
notes = notes.filter((e) => e !== noteString);
73-
}
74-
});
70+
if (note.state) {
71+
synth.triggerAttack(noteString);
72+
notes.push(noteString);
73+
} else {
74+
synth.triggerRelease(note.note);
75+
notes = notes.filter((e) => e !== noteString);
76+
}
77+
});
7578

76-
// keydown and keyup event
77-
// => alternate octave / change keyboard interface state
78-
for (const [event, handler] of Object.entries(keyboardHandlers)) {
79-
document.addEventListener(event, handler);
80-
}
79+
// keydown and keyup event
80+
// => alternate octave / change keyboard interface state
81+
for (const [event, handler] of Object.entries(keyboardHandlers)) {
82+
document.addEventListener(event, handler);
83+
}
8184
}
8285

8386
export default {
84-
create: createContext,
85-
get() {
86-
return {
87-
synth,
88-
destination,
89-
};
90-
},
91-
getSynth() {
92-
return synth;
93-
},
94-
getDestination() {
95-
return destination;
96-
},
87+
create: createContext,
88+
get() {
89+
return {
90+
synth,
91+
destination,
92+
};
93+
},
94+
getSynth() {
95+
return synth;
96+
},
97+
getDestination() {
98+
return destination;
99+
},
97100
};

0 commit comments

Comments
 (0)