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

Working on getting github actions to run #1231

Merged
merged 17 commits into from
Apr 25, 2024
117 changes: 117 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Run tests

on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- dev
push:
branches:
- dev
jobs:
run-tests:
name: All tests
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
BROWSER: chrome
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: All tests
run: npm run test
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
test-code-examples:
name: Check typedocs
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build Docs
run: npm run build && npm run docs:json
- name: tsdoc @example checks
run: npm run test:examples
test-html-examples:
name: Run HTML Examples
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Code example tests
run: npm run test:html
test-lint:
name: Linting and environment checks
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Linting
run: npm run lint
test-readme:
name: Ensure that examples in the README compile
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Test
run: npm run test:readme
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Tone.js
=========

[![Build Status](https://travis-ci.com/Tonejs/Tone.js.svg?branch=dev)](https://app.travis-ci.com/github/Tonejs/Tone.js) [![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)
[![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)


Tone.js is a Web Audio framework for creating interactive music in the browser. The architecture of Tone.js aims to be familiar to both musicians and audio programmers creating web-based audio applications. On the high-level, Tone offers common DAW (digital audio workstation) features like a global transport for synchronizing and scheduling events as well as prebuilt synths and effects. Additionally, Tone provides high-performance building blocks to create your own synthesizers, effects, and complex control signals.
Expand Down
2 changes: 1 addition & 1 deletion Tone/component/channel/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Channel extends ToneAudioNode<ChannelOptions> {
}

/**
* Solo/unsolo the channel. Soloing is only relative to other [[Channels]] and [[Solo]] instances
* Solo/unsolo the channel. Soloing is only relative to other [[Channel]]s and [[Solo]] instances
*/
get solo(): boolean {
return this._solo.solo;
Expand Down
2 changes: 1 addition & 1 deletion Tone/core/context/Context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export class Context extends BaseContext {

/**
* Starts the audio context from a suspended state. This is required
* to initially start the AudioContext. See [[Tone.start]]
* to initially start the AudioContext. See [[start]]
*/
resume(): Promise<void> {
if (isAudioContext(this._context)) {
Expand Down
2 changes: 1 addition & 1 deletion Tone/core/context/ToneAudioNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export function disconnect(
* const player1 = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
* const filter = new Tone.Filter("G5").toDestination();
* // connect nodes to a common destination
* fanIn(player, player1, filter);
* Tone.fanIn(player, player1, filter);
*/
export function fanIn(...nodes: OutputNode[]): void {
const dstNode = nodes.pop();
Expand Down
2 changes: 1 addition & 1 deletion Tone/core/context/ToneWithContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export abstract class ToneWithContext<Options extends ToneWithContextOptions> ex

/**
* Convert the incoming time to seconds.
* This is calculated against the current [[Tone.Transport]] bpm
* This is calculated against the current [[Transport]] bpm
* @example
* const gain = new Tone.Gain();
* setInterval(() => console.log(gain.toSeconds("4n")), 100);
Expand Down
2 changes: 1 addition & 1 deletion Tone/instrument/DuoSynth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface DuoSynthOptions extends MonophonicOptions {
}

/**
* DuoSynth is a monophonic synth composed of two [[MonoSynths]] run in parallel with control over the
* DuoSynth is a monophonic synth composed of two [[MonoSynth]]s run in parallel with control over the
* frequency ratio between the two voices and vibrato effect.
* @example
* const duoSynth = new Tone.DuoSynth().toDestination();
Expand Down
1 change: 0 additions & 1 deletion Tone/instrument/PolySynth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ export class PolySynth<Voice extends Monophonic<any> = Synth> extends Instrument
* @param notes The notes to play. Accepts a single Frequency or an array of frequencies.
* @param time When the release will be triggered.
* @example
* @example
* const poly = new Tone.PolySynth(Tone.AMSynth).toDestination();
* poly.triggerAttack(["Ab3", "C4", "F5"]);
* // trigger the release of the given notes.
Expand Down
3 changes: 3 additions & 0 deletions Tone/source/buffer/Player.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,14 @@ describe("Player", () => {
setTimeout(() => {
player.restart(undefined, undefined, 1);
const checkStopTimes = new Set();
// @ts-ignore
player._activeSources.forEach(source => {
// @ts-ignore
checkStopTimes.add(source._stopTime);
});
getContext().lookAhead = originalLookAhead;
// ensure each source has a different stopTime
// @ts-ignore
expect(checkStopTimes.size).to.equal(player._activeSources.size);
done();
}, 250);
Expand Down
2 changes: 1 addition & 1 deletion Tone/source/buffer/Players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class Players extends ToneAudioNode<PlayersOptions> {
* const players = new Tone.Players();
* players.add("gong", "https://tonejs.github.io/audio/berklee/gong_1.mp3", () => {
* console.log("gong loaded");
* players.get("gong").start();
* players.player("gong").start();
* });
*/
add(name: string, url: string | ToneAudioBuffer | AudioBuffer, callback?: () => void): this {
Expand Down
2 changes: 1 addition & 1 deletion Tone/source/oscillator/OmniOscillator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class OmniOscillator<OscType extends AnyOscillator>

/**
* The width of the oscillator when sourceType === "pulse".
* See [[PWMOscillator.width]]
* See [[PWMOscillator]]
*/
get width(): IsPulseOscillator<OscType, Signal<"audioRange">> {
if (this._getOscType(this._oscillator, "pulse")) {
Expand Down
2 changes: 1 addition & 1 deletion examples/meter.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}).toDestination();

const toneMeter = new Tone.Meter({
channels: 2,
channelCount: 2,
});
player.connect(toneMeter);

Expand Down
2 changes: 1 addition & 1 deletion examples/mixer.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

// create a meter on the destination node
const toneMeter = new Tone.Meter({ channels: 2 });
const toneMeter = new Tone.Meter({ channelCount: 2 });
Tone.Destination.chain(toneMeter);
meter({
tone: toneMeter,
Expand Down
2 changes: 1 addition & 1 deletion examples/pingPongDelay.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
// play a snare sound through it
const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/CR78/snare.mp3").connect(feedbackDelay);

const toneMeter = new Tone.Meter({ channels: 2 });
const toneMeter = new Tone.Meter({ channelCount: 2 });
feedbackDelay.connect(toneMeter);

meter({
Expand Down
Loading
Loading