@remotion/media-utils
Advanced tools
Comparing version 2.3.0 to 2.3.2
@@ -20,5 +20,5 @@ "use strict"; | ||
// Recurse: all even samples | ||
const X_evens = exports.fft(vector.filter((_, ix) => ix % 2 === 0)); | ||
const X_evens = (0, exports.fft)(vector.filter((_, ix) => ix % 2 === 0)); | ||
// Recurse: all odd samples | ||
const X_odds = exports.fft(vector.filter((__, ix) => ix % 2 === 1)); | ||
const X_odds = (0, exports.fft)(vector.filter((__, ix) => ix % 2 === 1)); | ||
// Now, perform N/2 operations! | ||
@@ -28,5 +28,5 @@ for (let k = 0; k < N / 2; k++) { | ||
const t = X_evens[k]; | ||
const e = complex_1.complexMultiply(exponent_1.exponent(k, N), X_odds[k]); | ||
X[k] = complex_1.complexAdd(t, e); | ||
X[k + N / 2] = complex_1.complexSubtract(t, e); | ||
const e = (0, complex_1.complexMultiply)((0, exponent_1.exponent)(k, N), X_odds[k]); | ||
X[k] = (0, complex_1.complexAdd)(t, e); | ||
X[k + N / 2] = (0, complex_1.complexSubtract)(t, e); | ||
} | ||
@@ -33,0 +33,0 @@ return X; |
@@ -26,8 +26,8 @@ "use strict"; | ||
}); | ||
ints.set(data.subarray(actualStart, actualStart + sampleSize).map((x) => to_int_16_1.toInt16(x))); | ||
const phasors = fft_1.fft(ints); | ||
const magnitudes = mag_1.fftMag(phasors).map((p) => p); | ||
return smoothing_1.smoothen(magnitudes).map((m) => m / (sampleSize / 2) / maxInt); | ||
ints.set(data.subarray(actualStart, actualStart + sampleSize).map((x) => (0, to_int_16_1.toInt16)(x))); | ||
const phasors = (0, fft_1.fft)(ints); | ||
const magnitudes = (0, mag_1.fftMag)(phasors).map((p) => p); | ||
return (0, smoothing_1.smoothen)(magnitudes).map((m) => m / (sampleSize / 2) / maxInt); | ||
}; | ||
exports.getVisualization = getVisualization; | ||
//# sourceMappingURL=get-visualization.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
const fftMag = function (fftBins) { | ||
const ret = fftBins.map((f) => complex_1.complexMagnitude(f)); | ||
const ret = fftBins.map((f) => (0, complex_1.complexMagnitude)(f)); | ||
return ret.slice(0, ret.length / 2); | ||
@@ -11,0 +11,0 @@ }; |
@@ -22,3 +22,3 @@ "use strict"; | ||
} | ||
const result = to_int_16_1.toInt16(getMax(metadata.channelWaveforms[0])); | ||
const result = (0, to_int_16_1.toInt16)(getMax(metadata.channelWaveforms[0])); | ||
cache[metadata.resultId] = result; | ||
@@ -25,0 +25,0 @@ return result; |
@@ -25,3 +25,3 @@ "use strict"; | ||
resultId: String(Math.random()), | ||
isRemote: is_remote_asset_1.isRemoteAsset(src), | ||
isRemote: (0, is_remote_asset_1.isRemoteAsset)(src), | ||
}; | ||
@@ -28,0 +28,0 @@ metadataCache[src] = metadata; |
@@ -23,3 +23,3 @@ "use strict"; | ||
aspectRatio: video.videoWidth / video.videoHeight, | ||
isRemote: is_remote_asset_1.isRemoteAsset(src), | ||
isRemote: (0, is_remote_asset_1.isRemoteAsset)(src), | ||
}; | ||
@@ -26,0 +26,0 @@ resolve(metadata); |
@@ -10,3 +10,3 @@ "use strict"; | ||
audioData.channelWaveforms[0].length); | ||
return get_wave_form_samples_1.getWaveformSamples(audioData.channelWaveforms[0].slice(startSample, endSample), numberOfSamples).map((w, i) => { | ||
return (0, get_wave_form_samples_1.getWaveformSamples)(audioData.channelWaveforms[0].slice(startSample, endSample), numberOfSamples).map((w, i) => { | ||
return { | ||
@@ -13,0 +13,0 @@ index: i, |
@@ -11,4 +11,4 @@ "use strict"; | ||
} | ||
const mountState = react_1.useRef({ isMounted: true }); | ||
react_1.useEffect(() => { | ||
const mountState = (0, react_1.useRef)({ isMounted: true }); | ||
(0, react_1.useEffect)(() => { | ||
const { current } = mountState; | ||
@@ -20,12 +20,12 @@ current.isMounted = true; | ||
}, []); | ||
const [metadata, setMetadata] = react_1.useState(null); | ||
const fetchMetadata = react_1.useCallback(async () => { | ||
const handle = remotion_1.delayRender(); | ||
const data = await get_audio_data_1.getAudioData(src); | ||
const [metadata, setMetadata] = (0, react_1.useState)(null); | ||
const fetchMetadata = (0, react_1.useCallback)(async () => { | ||
const handle = (0, remotion_1.delayRender)(); | ||
const data = await (0, get_audio_data_1.getAudioData)(src); | ||
if (mountState.current.isMounted) { | ||
setMetadata(data); | ||
} | ||
remotion_1.continueRender(handle); | ||
(0, remotion_1.continueRender)(handle); | ||
}, [src]); | ||
react_1.useEffect(() => { | ||
(0, react_1.useEffect)(() => { | ||
fetchMetadata(); | ||
@@ -32,0 +32,0 @@ }, [fetchMetadata]); |
@@ -12,4 +12,4 @@ "use strict"; | ||
} | ||
const maxInt = max_value_cached_1.getMaxPossibleMagnitude(metadata); | ||
return get_visualization_1.getVisualization({ | ||
const maxInt = (0, max_value_cached_1.getMaxPossibleMagnitude)(metadata); | ||
return (0, get_visualization_1.getVisualization)({ | ||
sampleSize: numberOfSamples * 2, | ||
@@ -16,0 +16,0 @@ data: metadata.channelWaveforms[0], |
{ | ||
"name": "@remotion/media-utils", | ||
"version": "2.3.0", | ||
"version": "2.3.2", | ||
"description": "Utility functions for audio and video", | ||
@@ -18,3 +18,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"remotion": "^2.3.0" | ||
"remotion": "^2.3.2" | ||
}, | ||
@@ -27,7 +27,7 @@ "peerDependencies": { | ||
"@jonny/eslint-config": "^2.1.233", | ||
"@types/node": "^15.0.1", | ||
"@types/node": "^16.7.5", | ||
"eslint": "^7.25.0", | ||
"prettier": "^2.0.5", | ||
"prettier-plugin-organize-imports": "^1.1.1", | ||
"typescript": "^4.1.2" | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45105
Updatedremotion@^2.3.2