Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Add Conductor and MultiSoundPlayer classes to Sound plugin #73

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
88ac28a
create MultiSoundPlayer constructor, Conductor boilerplate
usdivad Feb 7, 2016
7ef5169
add (commented out) getAudioContext() method to Audio class
usdivad Feb 7, 2016
f142ecd
define basic Conductor methods and structure (metro still not working…
usdivad Feb 7, 2016
4aa5660
implement working internal metronome for Conductor; add some document…
usdivad Feb 7, 2016
53f0bef
successfully implement init-tail-loop playing; restructure MultiSound…
usdivad Feb 9, 2016
e1db0b7
add 'active' property for MultiSoundPlayers, allow Conductor to reini…
usdivad Feb 10, 2016
4dd98f4
get toNext transition working fully
usdivad Feb 10, 2016
e5278bd
allow msp to take a string in for single tail
usdivad Feb 10, 2016
75c5899
trying to implement smarter tail behavior
usdivad Feb 10, 2016
2e71cdb
add calculation for s/ms until next downbeat; fix up some conductor m…
usdivad Feb 11, 2016
0f9437b
set playTail() to stop init+loop as well as check for tails[beatNum]
usdivad Feb 11, 2016
b2bc8d9
implement fade() and setVolume(), set intervalMs to 1 for better perf…
usdivad Feb 11, 2016
5e11cff
allow next downbeat calculation to take a custom (usually next) bpm
usdivad Feb 11, 2016
a7e5d3d
implement getMillisecondsLeftUntilNextTransitionBeat()
usdivad Feb 11, 2016
eedd28e
add api documentation
usdivad Feb 13, 2016
f210ab8
add getBeatNum(); further doc
usdivad Feb 13, 2016
5629ef1
add Conductor.scheduleEvent(); fix up some loop setting during de/act…
usdivad Feb 13, 2016
148101e
fix transitionBeat sorting; add getBpm()
usdivad Feb 15, 2016
1e40bea
add isTransitioning() and comment out event schedule timing
usdivad Feb 15, 2016
8a20e51
explain init-loop-tail more
usdivad Feb 16, 2016
8a85104
and to the .d.ts file
usdivad Feb 16, 2016
89fe73e
add methods for conductor to activate multiple players from an array …
usdivad Nov 10, 2016
221af8e
add conductor methods to safely fade one, some, or all players
usdivad Nov 10, 2016
a8e2730
add conductor methods to activate/deactivate all players
usdivad Nov 10, 2016
66fb075
Merge branch 'master' into soundAdditions
usdivad Feb 12, 2017
963027f
Merge branch 'master' into soundAdditions
usdivad Feb 12, 2017
30ac5d9
update plugins/common subproject commit
usdivad Feb 12, 2017
015b39b
revert Sup.Audio.ts.txt to original; (get rid of trailing whitespace)
usdivad Feb 12, 2017
be59161
Revert "update plugins/common subproject commit"
usdivad Feb 12, 2017
db50ec4
fix plugins/common commit hash number to match master branch
usdivad Feb 12, 2017
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
97 changes: 97 additions & 0 deletions plugins/default/sound/typescriptAPI/Sup.Audio.Conductor.d.ts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* A music conductor that schedules audio events, in the form of MultiSoundPlayers,
* based on beats per phrase according to an internal metronome/interval that
* uses the Web Audio API's clock for timing.
*
*/

declare namespace Sup {
namespace Audio {
class Conductor {

// Construct a Conductor.
//
// - bpm -> beats per minute
// - timesig -> time signature (how many beats in a cycle,
// i.e. num of beats * num of measures)
// - players -> an object with player names as keys and MultiSoundPlayers as values,
// e.g. {"violin": MultiSoundPlayer, "piano": MultiSoundPlayer}
constructor(bpm: number, timesig: number, players: any);

// Initialize Conductor's members via a params object
initializeParams(params: {bpm: number, timesig: number, players: any});

// Start the Conductor's interval and player scheduling
start();
// Stop the Conductor and reset params for next start()
stop();

// Have all players play init sample if !initPlayed, otherwise loop sample
playAllInitOrLoop();
// Have all players play tail samples for Conductor's current beatNum
playAllTails();

// Return a player
getPlayer(playerName: string): MultiSoundPlayer;
// Call reset() on all players
resetAllPlayers();

// Set the params that Conductor will be reinitialized with for next section
setNextParams(params: {bpm: number, timesig: number, players: any});
// Set whether Conductor should transition upon next available beat
setTransition(transition: boolean);
// Set whether Conductor should go to next section at the next available transition
// (if false, Conductor will call stop() upon transitioning)
setToNext(toNext: boolean);
// Get whether Conductor is transitioning
isTransitioning(): boolean;

// Activate or deactivate a player
activatePlayer(playerName: string);
deactivatePlayer(playerName: string);

// Activate or deactivate multiple players
activatePlayers(playerNames: Array<string>);
deactivatePlayers(playerNames: Array<string>);

// Activate or deactivate all players
activateAllPlayers();
deactivateAllPlayers();

// Fade a single player, multiple players, or all players
fadePlayer(playerName: string, targetVolume: number, fadeLength: number /* in ms */);
fadePlayers(playerNames: Array<string>, targetVolume: number, fadeLength: number);
fadeAllPlayers(targetVolume: number, fadeLength: number);

// Get the current beat number
getBeatNum(): number;
// Update the next beat's time based on the latest beat time and BPM
updateNextBeatTime();
// Return time, in seconds, until the next downbeat
// ("downbeat" refers to when beatNum==0)
getSecondsLeftUntilNextDownbeat(bpmIn?: number): number;
// Return time, in milliseconds, until the next downbeat
getMillisecondsLeftUntilNextDownbeat(bpm?: number): number;
// Return time, in milliseconds, until the next available transition beat
getMillisecondsLeftUntilNextTransitionBeat(): number;

// Return the Conductor's BPM
getBpm(): number;
// Return the Conductor's AudioContext
getContext(): any;

// Schedule an event to occur a certain number of milliseconds in the future
scheduleEvent(msFromNow: number, event: any);

// Set console logging on/off
setLogOutput(logOutput: boolean);
// Log to console if logOutput is true
log(message?: any);
}

namespace Conductor {
// Return the next beat time (in seconds)
function calculateNextBeatTime(currentBeatTime: number, bpm: number): number;
}
}
}
Loading