<commit_before>import { AutomationEvent, Param, ParamOptions } from "../context/Param";
import { getContext } from "../Global";
import { optionsFromArguments } from "../util/Defaults";
import { Timeline } from "../util/Timeline";
import { isUndef } from "../util/TypeCheck";

interface TickAutomationEvent extends AutomationEvent {
	ticks: number;
}

interface TickSignalOptions extends ParamOptions {
	value: Hertz | BPM;
	multiplier: number;
}

/**
 * TickSignal extends Tone.Signal, but adds the capability
 * to calculate the number of elapsed ticks. exponential and target curves
 * are approximated with multiple linear ramps.
 *
 * Thank you <NAME>, <NAME>, and <NAME>,
 * for your [WAC paper](https://smartech.gatech.edu/bitstream/handle/1853/54588/WAC2016-49.pdf)
 * describing integrating timing functions for tempo calculations.
 *
 * @param value The initial value of the signal
 */
export class TickSignal<Type extends "hertz" | "bpm"> extends Param<Type> {

	name = "TickSignal";

	protected _events: Timeline<TickAutomationEvent> = new Timeline(Infinity);

	private _sig: ConstantSourceNode = this.context.createConstantSource();

	protected _param = this._sig.offset;

	private _multiplier: number = 1;

	constructor(options: Partial<TickSignalOptions>);
	constructor(value?: number);
	constructor() {

		super(optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"]));
		const options = optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"]);

		this._sig = this.context.createConstantSource();

		// clear the ticks from the beginning
		this.cancelScheduledValues(0);
		this.multiplier = options.multiplier;
		// set an initial event
		this._events.add({
			ticks: 0,
			time : 0,
			type : "setValue",
			value: this._fromType(options.value),
		});
	}

	static getDefaults(): TickSignalOptions {
		return Object.assign(Param.getDefaults(), {
			multiplier: 1,
			param: getContext().createConstantSource().offset,
			units: "hertz",
			value: 1,
		});<commit_msg>order matters in this case<commit_after>import { AutomationEvent, Param, ParamOptions } from "../context/Param";
import { getContext } from "../Global";
import { optionsFromArguments } from "../util/Defaults";
import { Timeline } from "../util/Timeline";
import { isUndef } from "../util/TypeCheck";

interface TickAutomationEvent extends AutomationEvent {
	ticks: number;
}

interface TickSignalOptions extends ParamOptions {
	value: Hertz | BPM;
	multiplier: number;
}

/**
 * TickSignal extends Tone.Signal, but adds the capability
 * to calculate the number of elapsed ticks. exponential and target curves
 * are approximated with multiple linear ramps.
 *
 * Thank you <NAME>, <NAME>, and <NAME>,
 * for your [WAC paper](https://smartech.gatech.edu/bitstream/handle/1853/54588/WAC2016-49.pdf)
 * describing integrating timing functions for tempo calculations.
 *
 * @param value The initial value of the signal
 */
export class TickSignal<Type extends "hertz" | "bpm"> extends Param<Type> {

	name = "TickSignal";

	protected _events: Timeline<TickAutomationEvent> = new Timeline(Infinity);

	private _sig: ConstantSourceNode = this.context.createConstantSource();

	protected _param = this._sig.offset;

	private _multiplier: number = 1;

	constructor(options: Partial<TickSignalOptions>);
	constructor(value?: number);
	constructor() {

		super(optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"]));
		const options = optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"]);

		this._sig = this.context.createConstantSource();

		// set the multiplier
		this.multiplier = options.multiplier;

		// clear the ticks from the beginning
		this.cancelScheduledValues(0);
		// set an initial event
		this._events.add({
			ticks: 0,
			time : 0,
			type : "setValue",
			value: this._fromType(options.value),
		});
	}

	static getDefaults(): TickSignalOptions {
		return Object.assign(Param.getDefaults(), {
			multiplier: 1,
			param: getContext().createConstantSource().offset,
			units: "hertz",
			value: 1,
		});
{'fraction_non_alphanumeric': 0.12481499753330044, 'fraction_numerical': 0.010360138135175136, 'mean_word_length': 4.695224719101123, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4012980', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1172, 'n_words': 331}