Tonejs/Midi

No sound when convert from json to midi

motniemtin opened this issue · 2 comments

I discovered a problem in your source, When the midi file switched to json everything was fine. But when switching from Json to Midi, the controlChange value when parse is equal to 0. The problem is that when parse json, the value does not convert to 0 ~ 127 but it is still 0 ~ 1.
Change Track.ts 252->270 to

fromJSON(json: TrackJSON): void {
		this.name = json.name;
		this.channel = json.channel;
		this.instrument = new Instrument(undefined, this);
		this.instrument.fromJSON(json.instrument);
		if (json.endOfTrackTicks !== undefined) {
			this.endOfTrackTicks = json.endOfTrackTicks;
		}
		for (const number in json.controlChanges) {
			if (json.controlChanges[number]) {
				json.controlChanges[number].forEach((cc) => {
					this.addCC({
						number: cc.number,
						ticks: cc.ticks,
						value: cc.value*127,
					});
				});
			}
		}
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This should be resolved in #134