@drop-ai/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +655 -237
- package/dist/actions/ActionRegistry.d.ts.map +1 -1
- package/dist/actions/ActionRegistry.js +7 -2
- package/dist/actions/ActionRegistry.js.map +1 -1
- package/dist/actions/types.d.ts +7 -1
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/analysis/AudioAnalyzer.d.ts +71 -0
- package/dist/analysis/AudioAnalyzer.d.ts.map +1 -0
- package/dist/analysis/AudioAnalyzer.js +569 -0
- package/dist/analysis/AudioAnalyzer.js.map +1 -0
- package/dist/audio/AudioEngine.d.ts +14 -1
- package/dist/audio/AudioEngine.d.ts.map +1 -1
- package/dist/audio/AudioEngine.js +115 -35
- package/dist/audio/AudioEngine.js.map +1 -1
- package/dist/audio/Auditioner.d.ts +104 -0
- package/dist/audio/Auditioner.d.ts.map +1 -0
- package/dist/audio/Auditioner.js +239 -0
- package/dist/audio/Auditioner.js.map +1 -0
- package/dist/audio/BWFMetadata.d.ts +116 -0
- package/dist/audio/BWFMetadata.d.ts.map +1 -0
- package/dist/audio/BWFMetadata.js +394 -0
- package/dist/audio/BWFMetadata.js.map +1 -0
- package/dist/audio/ChannelSplitter.d.ts +37 -0
- package/dist/audio/ChannelSplitter.d.ts.map +1 -0
- package/dist/audio/ChannelSplitter.js +82 -0
- package/dist/audio/ChannelSplitter.js.map +1 -0
- package/dist/audio/ExportAnalyzer.d.ts +39 -0
- package/dist/audio/ExportAnalyzer.d.ts.map +1 -0
- package/dist/audio/ExportAnalyzer.js +76 -0
- package/dist/audio/ExportAnalyzer.js.map +1 -0
- package/dist/audio/LufsNormalizer.d.ts +37 -0
- package/dist/audio/LufsNormalizer.d.ts.map +1 -0
- package/dist/audio/LufsNormalizer.js +217 -0
- package/dist/audio/LufsNormalizer.js.map +1 -0
- package/dist/audio/OfflineExporter.d.ts +1 -6
- package/dist/audio/OfflineExporter.d.ts.map +1 -1
- package/dist/audio/OfflineExporter.js +31 -10
- package/dist/audio/OfflineExporter.js.map +1 -1
- package/dist/audio/RoutingGraph.d.ts +134 -0
- package/dist/audio/RoutingGraph.d.ts.map +1 -0
- package/dist/audio/RoutingGraph.js +547 -0
- package/dist/audio/RoutingGraph.js.map +1 -0
- package/dist/audio/SampleRateConverter.d.ts +21 -0
- package/dist/audio/SampleRateConverter.d.ts.map +1 -0
- package/dist/audio/SampleRateConverter.js +84 -0
- package/dist/audio/SampleRateConverter.js.map +1 -0
- package/dist/audio/SilencePadding.d.ts +29 -0
- package/dist/audio/SilencePadding.d.ts.map +1 -0
- package/dist/audio/SilencePadding.js +86 -0
- package/dist/audio/SilencePadding.js.map +1 -0
- package/dist/audio/SourceCache.d.ts +13 -16
- package/dist/audio/SourceCache.d.ts.map +1 -1
- package/dist/audio/SourceCache.js +21 -33
- package/dist/audio/SourceCache.js.map +1 -1
- package/dist/audio/engine/Declick.d.ts +98 -0
- package/dist/audio/engine/Declick.d.ts.map +1 -0
- package/dist/audio/engine/Declick.js +204 -0
- package/dist/audio/engine/Declick.js.map +1 -0
- package/dist/audio/engine/DiskIO.d.ts +172 -0
- package/dist/audio/engine/DiskIO.d.ts.map +1 -0
- package/dist/audio/engine/DiskIO.js +384 -0
- package/dist/audio/engine/DiskIO.js.map +1 -0
- package/dist/audio/engine/LatencyCompensator.d.ts +46 -0
- package/dist/audio/engine/LatencyCompensator.d.ts.map +1 -0
- package/dist/audio/engine/LatencyCompensator.js +84 -0
- package/dist/audio/engine/LatencyCompensator.js.map +1 -0
- package/dist/audio/engine/MultiTrackRecorder.d.ts +146 -0
- package/dist/audio/engine/MultiTrackRecorder.d.ts.map +1 -0
- package/dist/audio/engine/MultiTrackRecorder.js +359 -0
- package/dist/audio/engine/MultiTrackRecorder.js.map +1 -0
- package/dist/audio/engine/PlaylistEngine.d.ts.map +1 -1
- package/dist/audio/engine/PlaylistEngine.js +9 -2
- package/dist/audio/engine/PlaylistEngine.js.map +1 -1
- package/dist/audio/engine/PunchRecordManager.d.ts +113 -0
- package/dist/audio/engine/PunchRecordManager.d.ts.map +1 -0
- package/dist/audio/engine/PunchRecordManager.js +191 -0
- package/dist/audio/engine/PunchRecordManager.js.map +1 -0
- package/dist/audio/engine/RoutingGraph.d.ts +135 -0
- package/dist/audio/engine/RoutingGraph.d.ts.map +1 -0
- package/dist/audio/engine/RoutingGraph.js +436 -0
- package/dist/audio/engine/RoutingGraph.js.map +1 -0
- package/dist/audio/engine/SidechainRouter.d.ts +139 -0
- package/dist/audio/engine/SidechainRouter.d.ts.map +1 -0
- package/dist/audio/engine/SidechainRouter.js +292 -0
- package/dist/audio/engine/SidechainRouter.js.map +1 -0
- package/dist/audio/engine/XrunTracker.d.ts +71 -0
- package/dist/audio/engine/XrunTracker.d.ts.map +1 -0
- package/dist/audio/engine/XrunTracker.js +118 -0
- package/dist/audio/engine/XrunTracker.js.map +1 -0
- package/dist/audio/export/CDMarkerExporter.d.ts +62 -0
- package/dist/audio/export/CDMarkerExporter.d.ts.map +1 -0
- package/dist/audio/export/CDMarkerExporter.js +164 -0
- package/dist/audio/export/CDMarkerExporter.js.map +1 -0
- package/dist/audio/export/ExportGraphBuilder.d.ts +121 -0
- package/dist/audio/export/ExportGraphBuilder.d.ts.map +1 -0
- package/dist/audio/export/ExportGraphBuilder.js +522 -0
- package/dist/audio/export/ExportGraphBuilder.js.map +1 -0
- package/dist/audio/export/ExportPresetManager.d.ts +87 -0
- package/dist/audio/export/ExportPresetManager.d.ts.map +1 -0
- package/dist/audio/export/ExportPresetManager.js +306 -0
- package/dist/audio/export/ExportPresetManager.js.map +1 -0
- package/dist/commands/handlers/RegionHandler.d.ts.map +1 -1
- package/dist/commands/handlers/RegionHandler.js +25 -1
- package/dist/commands/handlers/RegionHandler.js.map +1 -1
- package/dist/commands/handlers/TrackHandler.js +1 -1
- package/dist/commands/handlers/TrackHandler.js.map +1 -1
- package/dist/commands/impl/FreezeTrackCommand.d.ts.map +1 -1
- package/dist/commands/impl/FreezeTrackCommand.js +37 -36
- package/dist/commands/impl/FreezeTrackCommand.js.map +1 -1
- package/dist/commands/impl/SetRegionTimeDomainCommand.d.ts.map +1 -1
- package/dist/commands/impl/SetRegionTimeDomainCommand.js +3 -3
- package/dist/commands/impl/SetRegionTimeDomainCommand.js.map +1 -1
- package/dist/commands/impl/ToggleLoopCommand.d.ts +1 -0
- package/dist/commands/impl/ToggleLoopCommand.d.ts.map +1 -1
- package/dist/commands/impl/ToggleLoopCommand.js +10 -0
- package/dist/commands/impl/ToggleLoopCommand.js.map +1 -1
- package/dist/commands/impl/TrimRegionCommand.d.ts +14 -1
- package/dist/commands/impl/TrimRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/TrimRegionCommand.js +138 -33
- package/dist/commands/impl/TrimRegionCommand.js.map +1 -1
- package/dist/commands/impl/TrimRegionToPlayheadCommand.d.ts +27 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.js +69 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.js.map +1 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.d.ts +28 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.js +69 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.js.map +1 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.d.ts +27 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.js +77 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.js.map +1 -0
- package/dist/commands/types.d.ts +19 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +21 -0
- package/dist/commands/types.js.map +1 -1
- package/dist/domain/Crossfade.d.ts +78 -0
- package/dist/domain/Crossfade.d.ts.map +1 -0
- package/dist/domain/Crossfade.js +216 -0
- package/dist/domain/Crossfade.js.map +1 -0
- package/dist/domain/ExportConfig.d.ts +98 -1
- package/dist/domain/ExportConfig.d.ts.map +1 -1
- package/dist/domain/ExportConfig.js +154 -1
- package/dist/domain/ExportConfig.js.map +1 -1
- package/dist/domain/ExportPreset.d.ts +62 -0
- package/dist/domain/ExportPreset.d.ts.map +1 -0
- package/dist/domain/ExportPreset.js +79 -0
- package/dist/domain/ExportPreset.js.map +1 -0
- package/dist/domain/ImportStatus.d.ts +40 -0
- package/dist/domain/ImportStatus.d.ts.map +1 -0
- package/dist/domain/ImportStatus.js +86 -0
- package/dist/domain/ImportStatus.js.map +1 -0
- package/dist/domain/Playlist.d.ts +72 -0
- package/dist/domain/Playlist.d.ts.map +1 -1
- package/dist/domain/Playlist.js +231 -6
- package/dist/domain/Playlist.js.map +1 -1
- package/dist/domain/Region.d.ts +76 -0
- package/dist/domain/Region.d.ts.map +1 -1
- package/dist/domain/Region.js +234 -1
- package/dist/domain/Region.js.map +1 -1
- package/dist/domain/Route.d.ts +43 -3
- package/dist/domain/Route.d.ts.map +1 -1
- package/dist/domain/Route.js +92 -6
- package/dist/domain/Route.js.map +1 -1
- package/dist/domain/Session.d.ts +31 -0
- package/dist/domain/Session.d.ts.map +1 -1
- package/dist/domain/Session.js +70 -0
- package/dist/domain/Session.js.map +1 -1
- package/dist/domain/Source.d.ts +145 -1
- package/dist/domain/Source.d.ts.map +1 -1
- package/dist/domain/Source.js +144 -1
- package/dist/domain/Source.js.map +1 -1
- package/dist/domain/ThawList.d.ts +37 -0
- package/dist/domain/ThawList.d.ts.map +1 -0
- package/dist/domain/ThawList.js +73 -0
- package/dist/domain/ThawList.js.map +1 -0
- package/dist/domain/Track.d.ts +93 -1
- package/dist/domain/Track.d.ts.map +1 -1
- package/dist/domain/Track.js +136 -0
- package/dist/domain/Track.js.map +1 -1
- package/dist/domain/TriggerBox.d.ts +123 -0
- package/dist/domain/TriggerBox.d.ts.map +1 -0
- package/dist/domain/TriggerBox.js +430 -0
- package/dist/domain/TriggerBox.js.map +1 -0
- package/dist/domain/VCATrack.d.ts +64 -1
- package/dist/domain/VCATrack.d.ts.map +1 -1
- package/dist/domain/VCATrack.js +128 -1
- package/dist/domain/VCATrack.js.map +1 -1
- package/dist/domain/VideoExportConfig.d.ts +117 -0
- package/dist/domain/VideoExportConfig.d.ts.map +1 -0
- package/dist/domain/VideoExportConfig.js +244 -0
- package/dist/domain/VideoExportConfig.js.map +1 -0
- package/dist/domain/VideoExportStatus.d.ts +89 -0
- package/dist/domain/VideoExportStatus.d.ts.map +1 -0
- package/dist/domain/VideoExportStatus.js +192 -0
- package/dist/domain/VideoExportStatus.js.map +1 -0
- package/dist/domain/VideoMetadata.d.ts +46 -0
- package/dist/domain/VideoMetadata.d.ts.map +1 -0
- package/dist/domain/VideoMetadata.js +2 -0
- package/dist/domain/VideoMetadata.js.map +1 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +5 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/temporal/TempoMap.d.ts +199 -2
- package/dist/domain/temporal/TempoMap.d.ts.map +1 -1
- package/dist/domain/temporal/TempoMap.js +464 -30
- package/dist/domain/temporal/TempoMap.js.map +1 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/ThawList.d.ts +100 -0
- package/dist/lib/ThawList.d.ts.map +1 -0
- package/dist/lib/ThawList.js +153 -0
- package/dist/lib/ThawList.js.map +1 -0
- package/dist/midi/MidiFileParser.d.ts +33 -0
- package/dist/midi/MidiFileParser.d.ts.map +1 -0
- package/dist/midi/MidiFileParser.js +246 -0
- package/dist/midi/MidiFileParser.js.map +1 -0
- package/dist/midi/MidiFileWriter.d.ts +31 -0
- package/dist/midi/MidiFileWriter.d.ts.map +1 -0
- package/dist/midi/MidiFileWriter.js +160 -0
- package/dist/midi/MidiFileWriter.js.map +1 -0
- package/dist/midi/MidiImporter.d.ts +37 -0
- package/dist/midi/MidiImporter.d.ts.map +1 -0
- package/dist/midi/MidiImporter.js +62 -0
- package/dist/midi/MidiImporter.js.map +1 -0
- package/dist/plugins/PluginPresetManager.d.ts +86 -0
- package/dist/plugins/PluginPresetManager.d.ts.map +1 -0
- package/dist/plugins/PluginPresetManager.js +140 -0
- package/dist/plugins/PluginPresetManager.js.map +1 -0
- package/dist/processing/IO.d.ts +15 -1
- package/dist/processing/IO.d.ts.map +1 -1
- package/dist/processing/IO.js +29 -1
- package/dist/processing/IO.js.map +1 -1
- package/dist/processing/InternalSend.d.ts +104 -0
- package/dist/processing/InternalSend.d.ts.map +1 -0
- package/dist/processing/InternalSend.js +175 -0
- package/dist/processing/InternalSend.js.map +1 -0
- package/dist/processing/MeterDSP.d.ts +166 -0
- package/dist/processing/MeterDSP.d.ts.map +1 -0
- package/dist/processing/MeterDSP.js +754 -0
- package/dist/processing/MeterDSP.js.map +1 -0
- package/dist/processing/Panner.d.ts +145 -0
- package/dist/processing/Panner.d.ts.map +1 -0
- package/dist/processing/Panner.js +281 -0
- package/dist/processing/Panner.js.map +1 -0
- package/dist/processing/PluginInsert.d.ts +56 -1
- package/dist/processing/PluginInsert.d.ts.map +1 -1
- package/dist/processing/PluginInsert.js +180 -2
- package/dist/processing/PluginInsert.js.map +1 -1
- package/dist/processing/Processor.d.ts +38 -0
- package/dist/processing/Processor.d.ts.map +1 -1
- package/dist/processing/Processor.js +60 -1
- package/dist/processing/Processor.js.map +1 -1
- package/dist/processing/SurroundPanner.d.ts +122 -0
- package/dist/processing/SurroundPanner.d.ts.map +1 -0
- package/dist/processing/SurroundPanner.js +376 -0
- package/dist/processing/SurroundPanner.js.map +1 -0
- package/dist/processing/TruePeakLimiter.d.ts +34 -0
- package/dist/processing/TruePeakLimiter.d.ts.map +1 -0
- package/dist/processing/TruePeakLimiter.js +144 -0
- package/dist/processing/TruePeakLimiter.js.map +1 -0
- package/dist/storage/ExportPresetStorage.d.ts +33 -0
- package/dist/storage/ExportPresetStorage.d.ts.map +1 -0
- package/dist/storage/ExportPresetStorage.js +121 -0
- package/dist/storage/ExportPresetStorage.js.map +1 -0
- package/dist/storage/SessionArchive.d.ts +73 -0
- package/dist/storage/SessionArchive.d.ts.map +1 -0
- package/dist/storage/SessionArchive.js +211 -0
- package/dist/storage/SessionArchive.js.map +1 -0
- package/dist/storage/SessionTemplate.d.ts +74 -5
- package/dist/storage/SessionTemplate.d.ts.map +1 -1
- package/dist/storage/SessionTemplate.js +247 -53
- package/dist/storage/SessionTemplate.js.map +1 -1
- package/dist/utils/BwfMetadataWriter.d.ts +42 -0
- package/dist/utils/BwfMetadataWriter.d.ts.map +1 -0
- package/dist/utils/BwfMetadataWriter.js +131 -0
- package/dist/utils/BwfMetadataWriter.js.map +1 -0
- package/dist/utils/FilenameTemplate.d.ts +40 -0
- package/dist/utils/FilenameTemplate.d.ts.map +1 -0
- package/dist/utils/FilenameTemplate.js +78 -0
- package/dist/utils/FilenameTemplate.js.map +1 -0
- package/dist/utils/Logger.d.ts +28 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +46 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/Mp4ChapterGenerator.d.ts +17 -0
- package/dist/utils/Mp4ChapterGenerator.d.ts.map +1 -0
- package/dist/utils/Mp4ChapterGenerator.js +33 -0
- package/dist/utils/Mp4ChapterGenerator.js.map +1 -0
- package/dist/utils/OggEncoder.d.ts +20 -20
- package/dist/utils/OggEncoder.d.ts.map +1 -1
- package/dist/utils/OggEncoder.js +114 -50
- package/dist/utils/OggEncoder.js.map +1 -1
- package/dist/utils/TocGenerator.d.ts +17 -0
- package/dist/utils/TocGenerator.d.ts.map +1 -0
- package/dist/utils/TocGenerator.js +47 -0
- package/dist/utils/TocGenerator.js.map +1 -0
- package/package.json +7 -8
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declick (DeclickAmp) - Provides smooth amplitude transitions
|
|
3
|
+
* to avoid clicks/pops at record start/stop and region boundaries.
|
|
4
|
+
* Inspired by Ardour's DeclickAmp.
|
|
5
|
+
*/
|
|
6
|
+
export class DeclickAmp {
|
|
7
|
+
/**
|
|
8
|
+
* @param sampleRate - The audio sample rate (e.g. 44100, 48000)
|
|
9
|
+
* @param rampLengthMs - Duration of a full 0->1 or 1->0 ramp in ms. Defaults to ~1.5ms (~64 samples at 44100).
|
|
10
|
+
*/
|
|
11
|
+
constructor(sampleRate, rampLengthMs) {
|
|
12
|
+
this._targetGain = 1.0;
|
|
13
|
+
this._currentGain = 0.0;
|
|
14
|
+
this._sampleRate = sampleRate;
|
|
15
|
+
const ms = rampLengthMs !== null && rampLengthMs !== void 0 ? rampLengthMs : 1.5;
|
|
16
|
+
this._rampLength = Math.max(1, Math.round((ms / 1000) * sampleRate));
|
|
17
|
+
this._rampIncrement = 1.0 / this._rampLength;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Set target gain (0 for fade out, 1 for fade in).
|
|
21
|
+
*/
|
|
22
|
+
setTarget(gain) {
|
|
23
|
+
this._targetGain = Math.max(0, Math.min(1, gain));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Apply declick ramp to a buffer in-place.
|
|
27
|
+
* Uses linear ramping from _currentGain toward _targetGain.
|
|
28
|
+
* @returns true if ramp is still in progress after processing
|
|
29
|
+
*/
|
|
30
|
+
applyToBuffer(buffer, offset, count) {
|
|
31
|
+
const end = offset + count;
|
|
32
|
+
const target = this._targetGain;
|
|
33
|
+
let current = this._currentGain;
|
|
34
|
+
const inc = this._rampIncrement;
|
|
35
|
+
if (current === target) {
|
|
36
|
+
// Already at target — apply constant gain
|
|
37
|
+
if (target !== 1.0) {
|
|
38
|
+
for (let i = offset; i < end; i++) {
|
|
39
|
+
buffer[i] *= target;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const goingUp = target > current;
|
|
45
|
+
for (let i = offset; i < end; i++) {
|
|
46
|
+
buffer[i] *= current;
|
|
47
|
+
if (goingUp) {
|
|
48
|
+
current = Math.min(current + inc, target);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
current = Math.max(current - inc, target);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
this._currentGain = current;
|
|
55
|
+
return current !== target;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Apply declick ramp to multi-channel buffers in-place.
|
|
59
|
+
* All channels share the same gain trajectory.
|
|
60
|
+
* @returns true if ramp is still in progress after processing
|
|
61
|
+
*/
|
|
62
|
+
applyToBuffers(buffers, offset, count) {
|
|
63
|
+
const end = offset + count;
|
|
64
|
+
const target = this._targetGain;
|
|
65
|
+
let current = this._currentGain;
|
|
66
|
+
const inc = this._rampIncrement;
|
|
67
|
+
const numChannels = buffers.length;
|
|
68
|
+
if (current === target) {
|
|
69
|
+
// Already at target — apply constant gain
|
|
70
|
+
if (target !== 1.0) {
|
|
71
|
+
for (let ch = 0; ch < numChannels; ch++) {
|
|
72
|
+
const buf = buffers[ch];
|
|
73
|
+
for (let i = offset; i < end; i++) {
|
|
74
|
+
buf[i] *= target;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const goingUp = target > current;
|
|
81
|
+
for (let i = offset; i < end; i++) {
|
|
82
|
+
for (let ch = 0; ch < numChannels; ch++) {
|
|
83
|
+
buffers[ch][i] *= current;
|
|
84
|
+
}
|
|
85
|
+
if (goingUp) {
|
|
86
|
+
current = Math.min(current + inc, target);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
current = Math.max(current - inc, target);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this._currentGain = current;
|
|
93
|
+
return current !== target;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if currently ramping (current gain has not yet reached target).
|
|
97
|
+
*/
|
|
98
|
+
isRamping() {
|
|
99
|
+
return this._currentGain !== this._targetGain;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Reset to initial state.
|
|
103
|
+
* @param initialGain - Starting gain value (default 0.0)
|
|
104
|
+
*/
|
|
105
|
+
reset(initialGain) {
|
|
106
|
+
this._currentGain = initialGain !== null && initialGain !== void 0 ? initialGain : 0.0;
|
|
107
|
+
this._targetGain = 1.0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get current gain value.
|
|
111
|
+
*/
|
|
112
|
+
getCurrentGain() {
|
|
113
|
+
return this._currentGain;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Declicker - Provides crossfade curves for loop boundaries.
|
|
118
|
+
* Used to create smooth transitions at loop points.
|
|
119
|
+
* Uses raised cosine (Hann) curves for perceptually smooth fades.
|
|
120
|
+
*/
|
|
121
|
+
export class Declicker {
|
|
122
|
+
/**
|
|
123
|
+
* @param lengthSamples - Number of samples for the fade region
|
|
124
|
+
*/
|
|
125
|
+
constructor(lengthSamples) {
|
|
126
|
+
this._length = Math.max(1, lengthSamples);
|
|
127
|
+
this._fadeIn = new Float32Array(this._length);
|
|
128
|
+
this._fadeOut = new Float32Array(this._length);
|
|
129
|
+
this.computeCurves();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Pre-compute fade curves using a raised cosine (Hann window).
|
|
133
|
+
* fade_in[i] = 0.5 * (1 - cos(pi * i / (N-1)))
|
|
134
|
+
* fade_out[i] = 0.5 * (1 + cos(pi * i / (N-1)))
|
|
135
|
+
* This ensures fade_in + fade_out = 1.0 at every sample (constant power crossfade).
|
|
136
|
+
*/
|
|
137
|
+
computeCurves() {
|
|
138
|
+
const N = this._length;
|
|
139
|
+
if (N === 1) {
|
|
140
|
+
this._fadeIn[0] = 1.0;
|
|
141
|
+
this._fadeOut[0] = 1.0;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const divisor = N - 1;
|
|
145
|
+
for (let i = 0; i < N; i++) {
|
|
146
|
+
const cosVal = Math.cos(Math.PI * i / divisor);
|
|
147
|
+
this._fadeIn[i] = 0.5 * (1 - cosVal);
|
|
148
|
+
this._fadeOut[i] = 0.5 * (1 + cosVal);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Apply fade-in curve to the start of a buffer.
|
|
153
|
+
* @param buffer - The audio buffer to modify in-place
|
|
154
|
+
* @param offset - Optional offset into the buffer (default 0)
|
|
155
|
+
*/
|
|
156
|
+
applyFadeIn(buffer, offset = 0) {
|
|
157
|
+
const len = Math.min(this._length, buffer.length - offset);
|
|
158
|
+
for (let i = 0; i < len; i++) {
|
|
159
|
+
buffer[offset + i] *= this._fadeIn[i];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Apply fade-out curve to the end of a buffer.
|
|
164
|
+
* @param offset - Optional: the sample index where the fade-out begins.
|
|
165
|
+
* Defaults to buffer.length - fadeLength.
|
|
166
|
+
*/
|
|
167
|
+
applyFadeOut(buffer, offset) {
|
|
168
|
+
const start = offset !== null && offset !== void 0 ? offset : (buffer.length - this._length);
|
|
169
|
+
const len = Math.min(this._length, buffer.length - Math.max(0, start));
|
|
170
|
+
for (let i = 0; i < len; i++) {
|
|
171
|
+
buffer[Math.max(0, start) + i] *= this._fadeOut[i];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Apply crossfade between two buffers, writing result into output.
|
|
176
|
+
* output[i] = outgoing[i] * fadeOut[i] + incoming[i] * fadeIn[i]
|
|
177
|
+
* All three buffers must be at least _length samples long.
|
|
178
|
+
*/
|
|
179
|
+
applyCrossfade(outgoing, incoming, output) {
|
|
180
|
+
const len = Math.min(this._length, outgoing.length, incoming.length, output.length);
|
|
181
|
+
for (let i = 0; i < len; i++) {
|
|
182
|
+
output[i] = outgoing[i] * this._fadeOut[i] + incoming[i] * this._fadeIn[i];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get the pre-computed fade-in curve.
|
|
187
|
+
*/
|
|
188
|
+
getFadeIn() {
|
|
189
|
+
return this._fadeIn;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get the pre-computed fade-out curve.
|
|
193
|
+
*/
|
|
194
|
+
getFadeOut() {
|
|
195
|
+
return this._fadeOut;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get the length of the fade region in samples.
|
|
199
|
+
*/
|
|
200
|
+
getLength() {
|
|
201
|
+
return this._length;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=Declick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declick.js","sourceRoot":"","sources":["../../../src/audio/engine/Declick.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAOnB;;;OAGG;IACH,YAAY,UAAkB,EAAE,YAAqB;QAV7C,gBAAW,GAAW,GAAG,CAAC;QAC1B,iBAAY,GAAW,GAAG,CAAC;QAU/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,MAAM,EAAE,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,GAAG,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,IAAY;QAClB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,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cAAc,CAAC,QAAsB,EAAE,QAAsB,EAAE,MAAoB;QAC/E,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACpF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/E,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS;QACL,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,SAAS;QACL,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { XrunTracker } from './XrunTracker';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal interface for audio buffer sources used by DiskReader.
|
|
4
|
+
* Compatible with Web Audio API's AudioBuffer.
|
|
5
|
+
*/
|
|
6
|
+
export interface AudioBufferLike {
|
|
7
|
+
numberOfChannels: number;
|
|
8
|
+
length: number;
|
|
9
|
+
sampleRate: number;
|
|
10
|
+
getChannelData(channel: number): Float32Array;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* DiskReader - Manages buffered playback I/O.
|
|
14
|
+
* Provides chunk-based reading with loop handling.
|
|
15
|
+
* Inspired by Ardour's DiskReader.
|
|
16
|
+
*/
|
|
17
|
+
export declare class DiskReader {
|
|
18
|
+
private _chunkSize;
|
|
19
|
+
private _buffer;
|
|
20
|
+
private _readPosition;
|
|
21
|
+
private _writeOffset;
|
|
22
|
+
private _channelCount;
|
|
23
|
+
private _loopStart;
|
|
24
|
+
private _loopEnd;
|
|
25
|
+
private _declicker;
|
|
26
|
+
/**
|
|
27
|
+
* @param channelCount - Number of audio channels (e.g. 2 for stereo)
|
|
28
|
+
* @param chunkSize - Size of the internal playback buffer per channel (default 64k)
|
|
29
|
+
*/
|
|
30
|
+
constructor(channelCount: number, chunkSize?: number);
|
|
31
|
+
/**
|
|
32
|
+
* Set loop boundaries for loop playback.
|
|
33
|
+
* When reading reaches loopEnd, it wraps back to loopStart.
|
|
34
|
+
* Optionally enables a declicker for smooth loop transitions.
|
|
35
|
+
* @param start - Loop start frame (in source coordinates)
|
|
36
|
+
* @param end - Loop end frame (in source coordinates)
|
|
37
|
+
*/
|
|
38
|
+
setLoop(start: number, end: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Remove loop boundaries.
|
|
41
|
+
*/
|
|
42
|
+
clearLoop(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Fill the internal buffer from a source starting at the given frame.
|
|
45
|
+
* Handles loop wrapping if a loop is set.
|
|
46
|
+
* @param source - The audio buffer source to read from
|
|
47
|
+
* @param startFrame - The frame position in the source to start reading from
|
|
48
|
+
* @returns The number of frames actually read
|
|
49
|
+
*/
|
|
50
|
+
refill(source: AudioBufferLike, startFrame: number): Promise<number>;
|
|
51
|
+
/**
|
|
52
|
+
* Read samples from the internal buffer into output arrays.
|
|
53
|
+
* @param output - Per-channel output arrays to write into
|
|
54
|
+
* @param offset - Offset into the output arrays
|
|
55
|
+
* @param count - Number of frames to read
|
|
56
|
+
* @returns Number of frames actually read
|
|
57
|
+
*/
|
|
58
|
+
read(output: Float32Array[], offset: number, count: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Seek to a specific frame position within the buffer.
|
|
61
|
+
* Note: This only adjusts the internal read pointer; you may need to refill().
|
|
62
|
+
*/
|
|
63
|
+
seek(frame: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get current read position within the internal buffer.
|
|
66
|
+
*/
|
|
67
|
+
getPosition(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Check if the internal buffer needs a refill (more than half consumed).
|
|
70
|
+
*/
|
|
71
|
+
needsRefill(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Get the percentage of the buffer that still contains unread data.
|
|
74
|
+
* Useful for monitoring playback buffer health.
|
|
75
|
+
*/
|
|
76
|
+
getBufferLoadPercent(): number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* DiskWriter - Manages buffered recording I/O.
|
|
80
|
+
* Captures audio with alignment and xrun tracking.
|
|
81
|
+
* Inspired by Ardour's DiskWriter.
|
|
82
|
+
*/
|
|
83
|
+
export declare class DiskWriter {
|
|
84
|
+
private _buffer;
|
|
85
|
+
private _bufferSize;
|
|
86
|
+
private _writePosition;
|
|
87
|
+
private _captureStart;
|
|
88
|
+
private _captureEnd;
|
|
89
|
+
private _channelCount;
|
|
90
|
+
private _isRecording;
|
|
91
|
+
private _xrunTracker;
|
|
92
|
+
private _declickAmp;
|
|
93
|
+
private _peakBuffer;
|
|
94
|
+
private _peakWritePos;
|
|
95
|
+
private _alignmentStyle;
|
|
96
|
+
/** Initial capture buffer size: 10 minutes at 48kHz stereo */
|
|
97
|
+
private static readonly INITIAL_BUFFER_FRAMES;
|
|
98
|
+
/**
|
|
99
|
+
* @param channelCount - Number of audio channels
|
|
100
|
+
* @param sampleRate - Audio sample rate (for DeclickAmp ramp calculation)
|
|
101
|
+
* @param xrunTracker - Shared xrun tracker instance
|
|
102
|
+
*/
|
|
103
|
+
constructor(channelCount: number, sampleRate: number, xrunTracker: XrunTracker);
|
|
104
|
+
/**
|
|
105
|
+
* Prepare for recording. Resets buffers and sets the capture start frame.
|
|
106
|
+
* @param startFrame - The session frame at which recording will begin
|
|
107
|
+
*/
|
|
108
|
+
prepareRecord(startFrame: number): void;
|
|
109
|
+
/**
|
|
110
|
+
* Start recording. Activates capture and begins the fade-in ramp.
|
|
111
|
+
*/
|
|
112
|
+
startRecord(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Stop recording. Begins fade-out ramp and marks the capture end.
|
|
115
|
+
* @returns The capture end frame in session coordinates
|
|
116
|
+
*/
|
|
117
|
+
stopRecord(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Write incoming audio samples to the capture buffer.
|
|
120
|
+
* Applies declick ramp and tracks peak data for GUI.
|
|
121
|
+
* Reports an xrun if the buffer overflows.
|
|
122
|
+
* @param input - Per-channel input arrays
|
|
123
|
+
* @param offset - Offset into the input arrays
|
|
124
|
+
* @param count - Number of frames to write
|
|
125
|
+
*/
|
|
126
|
+
write(input: Float32Array[], offset: number, count: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* Get the captured audio as trimmed Float32Arrays (one per channel).
|
|
129
|
+
*/
|
|
130
|
+
getCapturedAudio(): Float32Array[];
|
|
131
|
+
/**
|
|
132
|
+
* Get the capture range in session frame coordinates.
|
|
133
|
+
*/
|
|
134
|
+
getCaptureRange(): {
|
|
135
|
+
start: number;
|
|
136
|
+
end: number;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Get peak data for GUI real-time visualization during recording.
|
|
140
|
+
* Returns per-channel arrays of peak values.
|
|
141
|
+
*/
|
|
142
|
+
getPeakData(): Float32Array[];
|
|
143
|
+
/**
|
|
144
|
+
* Reset peak data (e.g. when the GUI display scrolls).
|
|
145
|
+
*/
|
|
146
|
+
resetPeakData(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Set the alignment style for the captured recording.
|
|
149
|
+
* - 'existing_material': Align to existing material on the track (snap to beat/region boundaries)
|
|
150
|
+
* - 'capture_time': Align to the exact time the audio was captured (default)
|
|
151
|
+
*/
|
|
152
|
+
setAlignment(style: 'existing_material' | 'capture_time'): void;
|
|
153
|
+
/**
|
|
154
|
+
* Check if currently recording.
|
|
155
|
+
*/
|
|
156
|
+
isRecording(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Get the number of frames captured so far.
|
|
159
|
+
*/
|
|
160
|
+
getCapturedFrames(): number;
|
|
161
|
+
/**
|
|
162
|
+
* Grow the capture buffer by doubling its size.
|
|
163
|
+
*/
|
|
164
|
+
private _growBuffer;
|
|
165
|
+
/**
|
|
166
|
+
* Update the peak buffer with the maximum absolute sample values
|
|
167
|
+
* from the most recently written segment. Each peak entry represents
|
|
168
|
+
* a chunk of recorded samples, downsampled for efficient GUI rendering.
|
|
169
|
+
*/
|
|
170
|
+
private _updatePeaks;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=DiskIO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiskIO.d.ts","sourceRoot":"","sources":["../../../src/audio/engine/DiskIO.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;CACjD;AAQD;;;;GAIG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,UAAU,CAA0B;IAE5C;;;OAGG;gBACS,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IASpD;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAOzC;;OAEG;IACH,SAAS,IAAI,IAAI;IAM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