Skip to content

🎥 Make videos programmatically with React

Add @remotion/sfx package

Jonny Burgera3b65cf12a4b
diff --git a/bun.lock b/bun.lock
index 9db7ccc52a..89ecf4cf0d 100644
--- a/bun.lock
+++ b/bun.lock
@@ -414,6 +414,7 @@
"@remotion/renderer": "workspace:*",
"@remotion/rive": "workspace:*",
"@remotion/rounded-text-box": "workspace:*",
+ "@remotion/sfx": "workspace:*",
"@remotion/shapes": "workspace:*",
"@remotion/skia": "workspace:*",
"@remotion/studio": "workspace:*",
@@ -622,6 +623,7 @@
"@remotion/renderer": "workspace:*",
"@remotion/rive": "workspace:*",
"@remotion/rounded-text-box": "workspace:*",
+ "@remotion/sfx": "workspace:*",
"@remotion/shapes": "workspace:*",
"@remotion/skia": "workspace:*",
"@remotion/studio": "workspace:*",
@@ -1296,6 +1298,15 @@
"remotion": "workspace:*",
},
},
+ "packages/sfx": {
+ "name": "@remotion/sfx",
+ "version": "4.0.428",
+ "devDependencies": {
+ "@remotion/eslint-config-internal": "workspace:*",
+ "@typescript/native-preview": "catalog:",
+ "eslint": "catalog:",
+ },
+ },
"packages/shapes": {
"name": "@remotion/shapes",
"version": "4.0.428",
@@ -3761,6 +3772,8 @@
"@remotion/serverless-client": ["@remotion/serverless-client@workspace:packages/serverless-client"],
+ "@remotion/sfx": ["@remotion/sfx@workspace:packages/sfx"],
+
"@remotion/shapes": ["@remotion/shapes@workspace:packages/shapes"],
"@remotion/skia": ["@remotion/skia@workspace:packages/skia"],
diff --git a/packages/cli/src/list-of-remotion-packages.ts b/packages/cli/src/list-of-remotion-packages.ts
index 4de5aa48cb..1f100c0607 100644
--- a/packages/cli/src/list-of-remotion-packages.ts
+++ b/packages/cli/src/list-of-remotion-packages.ts
@@ -85,4 +85,5 @@ export const listOfRemotionPackages = [
'@remotion/design',
'@remotion/light-leaks',
'@remotion/vercel',
+ '@remotion/sfx',
];
diff --git a/packages/create-video/src/list-of-remotion-packages.ts b/packages/create-video/src/list-of-remotion-packages.ts
index 4de5aa48cb..1f100c0607 100644
--- a/packages/create-video/src/list-of-remotion-packages.ts
+++ b/packages/create-video/src/list-of-remotion-packages.ts
@@ -85,4 +85,5 @@ export const listOfRemotionPackages = [
'@remotion/design',
'@remotion/light-leaks',
'@remotion/vercel',
+ '@remotion/sfx',
];
diff --git a/packages/docs/components/TableOfContents/api.tsx b/packages/docs/components/TableOfContents/api.tsx
index 6590ebc466..6ea3cd8687 100644
--- a/packages/docs/components/TableOfContents/api.tsx
+++ b/packages/docs/components/TableOfContents/api.tsx
@@ -13,6 +13,7 @@ import {TableOfContents as LambdaTableOfContents} from '../../docs/lambda/table-
import {TableOfContents as LayoutUtilsTableOfContents} from '../../docs/layout-utils/table-of-contents';
import {TableOfContents as LicensingTableOfContents} from '../../docs/licensing/TableOfContents';
import {TableOfContents as LightLeaksTableOfContents} from '../../docs/light-leaks/table-of-contents';
+import {TableOfContents as SfxTableOfContents} from '../../docs/sfx/table-of-contents';
import {TableOfContents as LottieTableOfContents} from '../../docs/lottie/table-of-contents';
import {TableOfContents as MediaParserTableOfContents} from '../../docs/media-parser/TableOfContents';
import {TableOfContents as MediaUtilsTableOfContents} from '../../docs/media-utils/table-of-contents';
@@ -152,6 +153,9 @@ export const TableOfContents: React.FC = () => {
<h2>@remotion/zod-types</h2>
<p>Zod types enabling Remotion Studio UI</p>
<ZodTypesTableOfContents />
+ <h2>@remotion/sfx</h2>
+ <p>Sound effects for Remotion</p>
+ <SfxTableOfContents />
<h2>@remotion/light-leaks</h2>
<p>Light leak effects</p>
<LightLeaksTableOfContents />
diff --git a/packages/docs/docs/sfx/index.mdx b/packages/docs/docs/sfx/index.mdx
new file mode 100644
index 0000000000..2b1caaff7c
--- /dev/null
+++ b/packages/docs/docs/sfx/index.mdx
@@ -0,0 +1,22 @@
+---
+image: /generated/articles-docs-sfx-index.png
+id: sfx-api
+slug: /sfx
+title: '@remotion/sfx'
+---
+
+# @remotion/sfx<AvailableFrom v="4.0.429" />
+
+Sound effect URLs for use in Remotion videos.
+
+import {TableOfContents} from './table-of-contents';
+
+<Installation pkg="@remotion/sfx" />
+
+## Exports
+
+<TableOfContents />
+
+## License
+
+[Remotion License](/docs/license)
diff --git a/packages/docs/docs/sfx/table-of-contents.tsx b/packages/docs/docs/sfx/table-of-contents.tsx
new file mode 100644
index 0000000000..ed76b50e68
--- /dev/null
+++ b/packages/docs/docs/sfx/table-of-contents.tsx
@@ -0,0 +1,20 @@
+import React from "react";
+import { Grid } from "../../components/TableOfContents/Grid";
+import { TOCItem } from "../../components/TableOfContents/TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/sfx/whip">
+ <strong>whip</strong>
+ <div>URL for a whip sound effect</div>
+ </TOCItem>
+ <TOCItem link="/docs/sfx/whoosh">
+ <strong>whoosh</strong>
+ <div>URL for a whoosh sound effect</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/docs/sfx/whip.mdx b/packages/docs/docs/sfx/whip.mdx
new file mode 100644
index 0000000000..98aa035f4d
--- /dev/null
+++ b/packages/docs/docs/sfx/whip.mdx
@@ -0,0 +1,28 @@
+---
+image: /generated/articles-docs-sfx-whip.png
+title: 'whip'
+crumb: '@remotion/sfx'
+---
+
+# whip<AvailableFrom v="4.0.429" />
+
+A URL pointing to a whip sound effect WAV file.
+
+## Example
+
+```tsx twoslash title="MyComp.tsx"
+import {whip} from '@remotion/sfx';
+import {Audio} from 'remotion';
+
+const MyVideo = () => {
+ return <Audio src={whip} />;
+};
+```
+
+## Value
+
+`"https://remotion.media/whip.wav"`
+
+## See also
+
+- [`whoosh`](/docs/sfx/whoosh)
diff --git a/packages/docs/docs/sfx/whoosh.mdx b/packages/docs/docs/sfx/whoosh.mdx
new file mode 100644
index 0000000000..abae9ee4ce
--- /dev/null
+++ b/packages/docs/docs/sfx/whoosh.mdx
@@ -0,0 +1,28 @@
+---
+image: /generated/articles-docs-sfx-whoosh.png
+title: 'whoosh'
+crumb: '@remotion/sfx'
+---
+
+# whoosh<AvailableFrom v="4.0.429" />
+
+A URL pointing to a whoosh sound effect WAV file.
+
+## Example
+
+```tsx twoslash title="MyComp.tsx"
+import {whoosh} from '@remotion/sfx';
+import {Audio} from 'remotion';
+
+const MyVideo = () => {
+ return <Audio src={whoosh} />;
+};
+```
+
+## Value
+
+`"https://remotion.media/whoosh.wav"`
+
+## See also
+
+- [`whip`](/docs/sfx/whip)
diff --git a/packages/docs/package.json b/packages/docs/package.json
index d4ca1e691d..cd5270c19d 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -57,6 +57,7 @@
"@remotion/layout-utils": "workspace:*",
"@remotion/licensing": "workspace:*",
"@remotion/light-leaks": "workspace:*",
+ "@remotion/sfx": "workspace:*",
"@remotion/lottie": "workspace:*",
"@remotion/media": "workspace:*",
"@remotion/media-parser": "workspace:*",
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index f38504c1b5..793d53b1f5 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -460,6 +460,15 @@ const sidebars: SidebarsConfig = {
},
items: ['light-leaks/light-leak'],
},
+ {
+ type: 'category',
+ label: '@remotion/sfx',
+ link: {
+ type: 'doc',
+ id: 'sfx-api',
+ },
+ items: ['sfx/whip', 'sfx/whoosh'],
+ },
{
type: 'category',
label: '@remotion/openai-whisper',
diff --git a/packages/example/package.json b/packages/example/package.json
index 6e7bacb63b..50a56a7e86 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -53,6 +53,7 @@
"@remotion/media-utils": "workspace:*",
"@remotion/motion-blur": "workspace:*",
"@remotion/light-leaks": "workspace:*",
+ "@remotion/sfx": "workspace:*",
"@remotion/noise": "workspace:*",
"@remotion/paths": "workspace:*",
"@remotion/player": "workspace:*",
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index e7aed679c3..3c68352d13 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -130,6 +130,7 @@ import {EdgeBlur} from './EdgeBlur/EdgeBlur';
import {Empty} from './Empty';
import {JumpCuts, SAMPLE_SECTIONS, calculateMetadataJumpCuts} from './JumpCuts';
import {LightLeakExample} from './LightLeak';
+import {SfxExample} from './Sfx';
import {LightLeakAnimatedSize} from './LightLeak/AnimatedSize';
import {LoopDisplayTestComp} from './LoopDisplayTest';
import {NewAudioExample} from './NewAudio/NewAudio';
@@ -1843,6 +1844,14 @@ export const Index: React.FC = () => {
durationInFrames={120}
/>
</Folder>
+ <Composition
+ id="sfx"
+ component={SfxExample}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={60}
+ />
<Folder name="transition-series-overlay">
<Composition
id="overlay-basic"
diff --git a/packages/example/src/Sfx/index.tsx b/packages/example/src/Sfx/index.tsx
new file mode 100644
index 0000000000..67ee3d2905
--- /dev/null
+++ b/packages/example/src/Sfx/index.tsx
@@ -0,0 +1,16 @@
+import {whip, whoosh} from '@remotion/sfx';
+import React from 'react';
+import {Audio, Sequence} from 'remotion';
+
+export const SfxExample: React.FC = () => {
+ return (
+ <>
+ <Sequence from={0} durationInFrames={30}>
+ <Audio src={whip} />
+ </Sequence>
+ <Sequence from={30} durationInFrames={30}>
+ <Audio src={whoosh} />
+ </Sequence>
+ </>
+ );
+};
diff --git a/packages/example/tsconfig.json b/packages/example/tsconfig.json
index 7be2fca483..3077506bb3 100644
--- a/packages/example/tsconfig.json
+++ b/packages/example/tsconfig.json
@@ -41,6 +41,7 @@
{"path": "../webcodecs"},
{"path": "../whisper-web"},
{"path": "../light-leaks"},
+ {"path": "../sfx"},
{"path": "../layout-utils"},
{"path": "../media"},
{"path": "../rounded-text-box"}
diff --git a/packages/sfx/.npmignore b/packages/sfx/.npmignore
new file mode 100644
index 0000000000..71352c3fd9
--- /dev/null
+++ b/packages/sfx/.npmignore
@@ -0,0 +1,10 @@
+dist/test/**
+src
+eslint.config.mjs
+tsconfig.tsbuildinfo
+*.tgz
+.turbo
+tsconfig.json
+.prettierrc.js
+bundle.ts
+dist/cjs/test
\ No newline at end of file
diff --git a/packages/sfx/README.md b/packages/sfx/README.md
new file mode 100644
index 0000000000..b46d9e78da
--- /dev/null
+++ b/packages/sfx/README.md
@@ -0,0 +1,18 @@
+# @remotion/sfx
+
+Sound effects for Remotion
+
+[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/sfx.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/@remotion/sfx?minimal=true)
+
+## Installation
+
+```bash
+npm install @remotion/sfx --save-exact
+```
+
+When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
+Remove the `^` character from the version number to use the exact version.
+
+## Usage
+
+See the [documentation](https://www.remotion.dev/docs/sfx) for more information.
diff --git a/packages/sfx/bundle.ts b/packages/sfx/bundle.ts
new file mode 100644
index 0000000000..846bbbc8a0
--- /dev/null
+++ b/packages/sfx/bundle.ts
@@ -0,0 +1,34 @@
+import {build} from 'bun';
+import path from 'path';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+console.time('Generated.');
+const output = await build({
+ entrypoints: ['src/index.ts'],
+ naming: '[name].mjs',
+ external: [
+ 'remotion',
+ 'remotion/no-react',
+ 'react',
+ 'react/jsx-runtime',
+ 'react/jsx-dev-runtime',
+ 'react-dom',
+ ],
+});
+
+if (!output.success) {
+ console.log(output.logs.join('\n'));
+ process.exit(1);
+}
+
+for (const file of output.outputs) {
+ const str = await file.text();
+ const out = path.join('dist', 'esm', file.path);
+
+ await Bun.write(out, str);
+}
+
+console.timeEnd('Generated.');
diff --git a/packages/sfx/eslint.config.mjs b/packages/sfx/eslint.config.mjs
new file mode 100644
index 0000000000..04fd4fac11
--- /dev/null
+++ b/packages/sfx/eslint.config.mjs
@@ -0,0 +1,7 @@
+import {remotionFlatConfig} from '@remotion/eslint-config-internal';
+
+const config = remotionFlatConfig({react: false});
+
+export default {
+ ...config,
+};
diff --git a/packages/sfx/package.json b/packages/sfx/package.json
new file mode 100644
index 0000000000..e240bb06fd
--- /dev/null
+++ b/packages/sfx/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "@remotion/sfx",
+ "version": "4.0.428",
+ "description": "Sound effects for Remotion",
+ "main": "dist/index.js",
+ "types": "dist/index.d.ts",
+ "module": "dist/esm/index.mjs",
+ "repository": {
+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/sfx"
+ },
+ "sideEffects": false,
+ "type": "module",
+ "scripts": {
+ "formatting": "prettier src --check",
+ "lint": "eslint src",
+ "watch": "tsgo -w",
+ "make": "tsgo && bun --env-file=../.env.bundle bundle.ts"
+ },
+ "author": "Jonny Burger <[email protected]>",
+ "contributors": [],
+ "license": "Remotion License",
+ "bugs": {
+ "url": "https://github.com/remotion-dev/remotion/issues"
+ },
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "module": "./dist/esm/index.mjs",
+ "import": "./dist/esm/index.mjs"
+ },
+ "./package.json": "./package.json"
+ },
+ "devDependencies": {
+ "@remotion/eslint-config-internal": "workspace:*",
+ "eslint": "catalog:",
+ "@typescript/native-preview": "catalog:"
+ },
+ "keywords": [
+ "remotion",
+ "sfx",
+ "sound-effects"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "homepage": "https://www.remotion.dev/docs/sfx"
+}
diff --git a/packages/sfx/src/index.ts b/packages/sfx/src/index.ts
new file mode 100644
index 0000000000..ae1bb4845b
--- /dev/null
+++ b/packages/sfx/src/index.ts
@@ -0,0 +1,2 @@
+export const whip = 'https://remotion.media/whip.wav';
+export const whoosh = 'https://remotion.media/whoosh.wav';
diff --git a/packages/sfx/tsconfig.json b/packages/sfx/tsconfig.json
new file mode 100644
index 0000000000..e5c5f5163c
--- /dev/null
+++ b/packages/sfx/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "../tsconfig.settings.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "dist",
+ "skipLibCheck": true,
+ "target": "ES2022",
+ "module": "es2020",
+ "moduleResolution": "bundler",
+ "declaration": true,
+ "emitDeclarationOnly": true
+ },
+ "include": ["src"]
+}
diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.ts
index c8e8b94ea6..0e658480d8 100644
--- a/packages/studio-shared/src/package-info.ts
+++ b/packages/studio-shared/src/package-info.ts
@@ -84,6 +84,7 @@ export const packages = [
'design',
'light-leaks',
'vercel',
+ 'sfx',
] as const;
export type Pkgs = (typeof packages)[number];
@@ -207,6 +208,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {
design: 'Design system',
'light-leaks': 'Light leak effects for Remotion',
vercel: 'Render Remotion videos on Vercel Sandbox',
+ sfx: 'Sound effects for Remotion',
};
export const installableMap: {[key in Pkgs]: boolean} = {
'svg-3d-engine': false,
@@ -294,6 +296,7 @@ export const installableMap: {[key in Pkgs]: boolean} = {
design: false,
'light-leaks': true,
vercel: true,
+ sfx: true,
};
export const apiDocs: {[key in Pkgs]: string | null} = {
@@ -385,4 +388,5 @@ export const apiDocs: {[key in Pkgs]: string | null} = {
design: 'https://www.remotion.dev/design',
'light-leaks': 'https://www.remotion.dev/docs/light-leaks',
vercel: 'https://www.remotion.dev/docs/vercel/api',
+ sfx: 'https://www.remotion.dev/docs/sfx',
};
diff --git a/tsconfig.json b/tsconfig.json
index 8777a46358..813ed177f2 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -260,6 +260,9 @@
},
{
"path": "./packages/vercel"
+ },
+ {
+ "path": "./packages/sfx"
}
]
}