@remotion/media-utils
Advanced tools
Comparing version 1.6.0-alpha.656a496e to 1.6.0-alpha.6bed117c
@@ -6,7 +6,6 @@ import { AudioData } from './types'; | ||
}; | ||
export declare const getWaveformPortion: ({ metadata, startFrom, fps, durationInFrames, numberOfSamples, }: { | ||
metadata: AudioData; | ||
startFrom: number; | ||
fps: number; | ||
durationInFrames: number; | ||
export declare const getWaveformPortion: ({ audioData, startTimeInSeconds, durationInSeconds, numberOfSamples, }: { | ||
audioData: AudioData; | ||
startTimeInSeconds: number; | ||
durationInSeconds: number; | ||
numberOfSamples: number; | ||
@@ -13,0 +12,0 @@ }) => Bar[]; |
@@ -5,8 +5,8 @@ "use strict"; | ||
const get_wave_form_samples_1 = require("./get-wave-form-samples"); | ||
const getWaveformPortion = ({ metadata, startFrom, fps, durationInFrames, numberOfSamples, }) => { | ||
const startSample = Math.floor((startFrom / (metadata.duration / fps)) * | ||
metadata.channelWaveforms[0].length); | ||
const endSample = Math.floor(((startFrom + durationInFrames) / (metadata.duration * fps)) * | ||
metadata.channelWaveforms[0].length); | ||
return get_wave_form_samples_1.getWaveformSamples(metadata.channelWaveforms[0].slice(startSample, endSample), numberOfSamples).map((w, i) => { | ||
const getWaveformPortion = ({ audioData, startTimeInSeconds, durationInSeconds, numberOfSamples, }) => { | ||
const startSample = Math.floor((startTimeInSeconds / audioData.durationInSeconds) * | ||
audioData.channelWaveforms[0].length); | ||
const endSample = Math.floor(((startTimeInSeconds + durationInSeconds) / audioData.durationInSeconds) * | ||
audioData.channelWaveforms[0].length); | ||
return get_wave_form_samples_1.getWaveformSamples(audioData.channelWaveforms[0].slice(startSample, endSample), numberOfSamples).map((w, i) => { | ||
return { | ||
@@ -13,0 +13,0 @@ index: i, |
@@ -0,8 +1,8 @@ | ||
export { getAudioData } from './get-audio-data'; | ||
export { getAudioDuration } from './get-audio-duration'; | ||
export { getAudioData } from './get-audio-metadata'; | ||
export { getWaveformSamples } from './get-wave-form-samples'; | ||
export { getVideoMetadata } from './get-video-metadata'; | ||
export { getWaveformPortion } from './get-waveform-portion'; | ||
export type { AudioData } from './types'; | ||
export type { AudioData, VideoMetadata as VideoData } from './types'; | ||
export { useAudioData } from './use-audio-metadata'; | ||
export { visualizeAudio } from './visualize-audio'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.visualizeAudio = exports.useAudioData = exports.getWaveformPortion = exports.getWaveformSamples = exports.getAudioData = exports.getAudioDuration = void 0; | ||
exports.visualizeAudio = exports.useAudioData = exports.getWaveformPortion = exports.getVideoMetadata = exports.getAudioDuration = exports.getAudioData = void 0; | ||
var get_audio_data_1 = require("./get-audio-data"); | ||
Object.defineProperty(exports, "getAudioData", { enumerable: true, get: function () { return get_audio_data_1.getAudioData; } }); | ||
var get_audio_duration_1 = require("./get-audio-duration"); | ||
Object.defineProperty(exports, "getAudioDuration", { enumerable: true, get: function () { return get_audio_duration_1.getAudioDuration; } }); | ||
var get_audio_metadata_1 = require("./get-audio-metadata"); | ||
Object.defineProperty(exports, "getAudioData", { enumerable: true, get: function () { return get_audio_metadata_1.getAudioData; } }); | ||
var get_wave_form_samples_1 = require("./get-wave-form-samples"); | ||
Object.defineProperty(exports, "getWaveformSamples", { enumerable: true, get: function () { return get_wave_form_samples_1.getWaveformSamples; } }); | ||
var get_video_metadata_1 = require("./get-video-metadata"); | ||
Object.defineProperty(exports, "getVideoMetadata", { enumerable: true, get: function () { return get_video_metadata_1.getVideoMetadata; } }); | ||
var get_waveform_portion_1 = require("./get-waveform-portion"); | ||
@@ -11,0 +11,0 @@ Object.defineProperty(exports, "getWaveformPortion", { enumerable: true, get: function () { return get_waveform_portion_1.getWaveformPortion; } }); |
export declare type AudioData = { | ||
channelWaveforms: Float32Array[]; | ||
sampleRate: number; | ||
duration: number; | ||
durationInSeconds: number; | ||
numberOfChannels: number; | ||
resultId: string; | ||
isRemote: boolean; | ||
}; | ||
export declare type VideoMetadata = { | ||
durationInSeconds: number; | ||
width: number; | ||
height: number; | ||
aspectRatio: number; | ||
isRemote: boolean; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
import { AudioData } from './types'; | ||
declare type FnParameters = { | ||
metadata: AudioData; | ||
audioData: AudioData; | ||
frame: number; | ||
@@ -8,3 +8,2 @@ fps: number; | ||
}; | ||
export declare const visualizeAudioFrame: ({ metadata, frame, fps, numberOfSamples, }: FnParameters) => number[]; | ||
export declare const visualizeAudio: ({ smoothing, ...parameters }: FnParameters & { | ||
@@ -11,0 +10,0 @@ smoothing?: boolean | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.visualizeAudio = exports.visualizeAudioFrame = void 0; | ||
exports.visualizeAudio = void 0; | ||
const get_visualization_1 = require("./fft/get-visualization"); | ||
const max_value_cached_1 = require("./fft/max-value-cached"); | ||
const cache = {}; | ||
const visualizeAudioFrame = ({ metadata, frame, fps, numberOfSamples, }) => { | ||
const visualizeAudioFrame = ({ audioData: metadata, frame, fps, numberOfSamples, }) => { | ||
const cacheKey = metadata.resultId + frame + fps + numberOfSamples; | ||
@@ -22,6 +22,5 @@ if (cache[cacheKey]) { | ||
}; | ||
exports.visualizeAudioFrame = visualizeAudioFrame; | ||
const visualizeAudio = ({ smoothing = true, ...parameters }) => { | ||
if (!smoothing) { | ||
return exports.visualizeAudioFrame(parameters); | ||
return visualizeAudioFrame(parameters); | ||
} | ||
@@ -34,3 +33,3 @@ const toSmooth = [ | ||
const all = toSmooth.map((s) => { | ||
return exports.visualizeAudioFrame({ ...parameters, frame: s }); | ||
return visualizeAudioFrame({ ...parameters, frame: s }); | ||
}); | ||
@@ -37,0 +36,0 @@ return new Array(parameters.numberOfSamples).fill(true).map((x, i) => { |
{ | ||
"name": "@remotion/media-utils", | ||
"version": "1.6.0-alpha.656a496e", | ||
"version": "1.6.0-alpha.6bed117c", | ||
"description": "Utility functions for audio and video", | ||
@@ -20,3 +20,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"remotion": "1.6.0-alpha.656a496e" | ||
"remotion": "1.6.0-alpha.6bed117c" | ||
}, | ||
@@ -23,0 +23,0 @@ "peerDependencies": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54269
98
612
2
+ Addedremotion@1.6.0-alpha.6bed117c(transitive)
- Removedremotion@1.6.0-alpha.656a496e(transitive)