Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

Use reciprocal of tempo when syncing time signals to Transport

Open yifanmai opened this issue 3 years ago • 2 comments

Previously, signals with time units were synced to Transport by connecting it to the tempo signal, which has frequency units. This unit mismatch caused incorrect behavior, e.g. a time signal would double instead of halving as expected when bpm doubles. Now, signals with time units are connected to the reciprocal of the tempo signal instead, which also has time units.

fixes #879

yifanmai avatar Mar 07 '22 04:03 yifanmai

Codecov Report

Merging #1050 (a392067) into dev (aad2d8c) will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1050      +/-   ##
==========================================
+ Coverage   98.43%   98.45%   +0.02%     
==========================================
  Files         184      184              
  Lines        7691     7724      +33     
  Branches      665      679      +14     
==========================================
+ Hits         7570     7604      +34     
+ Misses         36       34       -2     
- Partials       85       86       +1     
Impacted Files Coverage Δ
Tone/core/clock/Transport.ts 98.47% <100.00%> (+0.10%) :arrow_up:
Tone/source/buffer/Player.ts 97.32% <0.00%> (-0.89%) :arrow_down:
Tone/core/context/ToneAudioBuffer.ts 99.26% <0.00%> (-0.01%) :arrow_down:
Tone/event/Pattern.ts 100.00% <0.00%> (ø)
Tone/core/clock/Ticker.ts 100.00% <0.00%> (ø)
Tone/event/PatternGenerator.ts 100.00% <0.00%> (ø)
Tone/component/analysis/Meter.ts 100.00% <0.00%> (ø)
Tone/instrument/MetalSynth.ts 97.18% <0.00%> (+0.04%) :arrow_up:
Tone/core/clock/TickSource.ts 97.33% <0.00%> (+0.56%) :arrow_up:
Tone/core/context/Context.ts 97.32% <0.00%> (+1.14%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update aad2d8c...a392067. Read the comment docs.

codecov[bot] avatar Mar 07 '22 04:03 codecov[bot]

On further thought, this PR has an issue whereby the new intermediate signal operators don't get garbage collected when the signal is unsynced. I'll fix this shortly.

yifanmai avatar Mar 07 '22 06:03 yifanmai

Great PR! thanks you!

tambien avatar Oct 02 '22 13:10 tambien