Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing singer module imports. #379

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions modules/singer/src/singer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const _defaultSynthStateValues = {
beatsPerMinute: 90,
};

/** Default state parameter values of a poly synth. */
const _polySynthStateValues = {
notesPlayed: 0,
beat: 1 / 4,
beatsPerMinute: 90,
voices: [],
};

import KeySignature from './core/keySignature';
import CurrentPitch from './core/currentPitch';
import Temperament from './core/temperament';
Expand All @@ -20,10 +28,10 @@ const testKeySignature = new KeySignature('major', 'd');
const currentpitch = new CurrentPitch(testKeySignature, new Temperament(), 1, 4);

/** Synth state parameters. */
const _stateObj = { ..._defaultSynthStateValues };
const _stateObj = { ..._defaultSynthStateValues, ..._polySynthStateValues };

/** Proxy to the synth state parameters. */
const _state = new Proxy(_stateObj, {
export const _state = new Proxy(_stateObj, {
set: (_, key, value) => {
if (key === 'beatsPerMinute') {
_stateObj.beatsPerMinute = value;
Expand All @@ -37,7 +45,10 @@ const _state = new Proxy(_stateObj, {
});

/** Default synth **/
const _defaultSynth = new Tone.Synth().toDestination();
export const _defaultSynth = new Tone.Synth().toDestination();

/** Poly synth */
export const _polySynth = new Tone.PolySynth().toDestination();

// -- private functions ----------------------------------------------------------------------------

Expand Down