Overview
Complete API reference for the documentation extension
Table of Contents
- Audio Methods - Audio API for manipulating audio
- Link Methods - Link API for managing extension links
- Analyzer Methods - Analyzer API for managing audio analyzers
- UI Methods - Controlling common UI elements
- Session Methods - Session API for managing audio sessions, tracks, and playback controls
- Track Methods - Track API for managing audio tracks
- Group Methods - Group API for managing audio groups
- Storage Methods - Storage API for managing audio files
- Storage Methods - if showed alert before, shows new alert only last day
- UploadToSignedUrl Methods - Uploads an array buffer to a pre-signed URL
- Compute Methods - Compute API for managing audio computations
- Now Methods - in some cases, date 'now' is in the future. prevent to show countdown in this case
- SetShowed Methods - show alert
- Today Methods - if expired, dismiss alert
- GA4 Methods -
- GA4 Methods -
- GA4 Methods -
Audio Methods
Audio API for manipulating audio
audio.crop
Crops an audio
Parameters:
Parameter | Type | Description |
---|---|---|
input | ArrayBuffer | The audio buffer to crop |
startTime | number | The start time of the crop in seconds |
endTime | number | The end time of the crop in seconds |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the cropped audio buffer
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
audio.remove
Removes an audio segment
Parameters:
Parameter | Type | Description |
---|---|---|
input | ArrayBuffer | The audio buffer to remove |
startTime | number | The start time of the remove in seconds |
endTime | number | The end time of the remove in seconds |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the removed audio buffer
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
audio.silence
Replaces an audio segment with silence
Parameters:
Parameter | Type | Description |
---|---|---|
input | ArrayBuffer | The audio buffer to replace with silence |
startTime | number | The start time of the silence in seconds |
endTime | number | The end time of the silence in seconds |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the audio buffer with silence
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
audio.hash
Computes the hash of an audio
Parameters:
Parameter | Type | Description |
---|---|---|
input | ArrayBuffer | The audio buffer to hash |
Returns:
Promise<string>
- Promise that resolves with the hash of the audio buffer
Example resolved value:
// When the promise resolves, you get:
"example"
Link Methods
Link API for managing extension links
link.trackContextMenu
Creates a context menu item for tracks
Parameters:
Parameter | Type | Description |
---|---|---|
label | string | Display label for the menu item |
params | Object | Parameters passed to the onClick handler |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
moises.link.trackContextMenu(
{ label: "Process Track" },
({ trackId }) => {
console.log("Selected track:", trackId)
}
)
link.singleTrackSelectionContextMenu
Creates a context menu item for single track selections
Parameters:
Parameter | Type | Description |
---|---|---|
label | string | Display label for the menu item |
params | Object | Parameters passed to the onClick handler |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
moises.link.singleTrackSelectionContextMenu(
{ label: "Process Selection" },
({ trackId, from, to }) => {
console.log("Selected track:", trackId)
console.log("Selection from:", from, "to:", to)
}
)
link.toolbarButton
Creates a button in the toolbar
Parameters:
Parameter | Type | Description |
---|---|---|
label | string | Display label for the button |
icon | string | Icon identifier for the button |
onClick | Function | Callback function triggered when button is clicked |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
moises.link.toolbarButton(
{ label: "My Tool", icon: "tool-icon" },
() => {
console.log("Toolbar button clicked")
}
)
link.footerButton
Creates a button in the footer
Parameters:
Parameter | Type | Description |
---|---|---|
label | string | Display label for the button |
icon | string | Icon identifier for the button |
onClick | Function | Callback function triggered when button is clicked |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
moises.link.footerButton(
{ label: "Footer Action", icon: "action-icon" },
() => {
console.log("Footer button clicked")
}
)
Analyzer Methods
Analyzer API for managing audio analyzers
analyzer.create
Creates and attaches a new audio analyzer
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
fftSize | number | Yes | FFT size for frequency analysis (must be power of 2) |
smoothingTimeConstant | number | Yes | Smoothing time constant for frequency data |
minDecibels | number | Yes | Minimum decibel value for frequency data |
maxDecibels | number | Yes | Maximum decibel value for frequency data |
type | string | Yes | Type of analyzer |
purpose | string | No | Purpose description for the analyzer |
Returns:
Promise<Object>
- Promise that resolves with analyzer info
Return Object Structure:
// When the promise resolves, you get:
{
id: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
const analyzer = await moises.analyzer.create({
fftSize: 2048,
smoothingTimeConstant: 0.8,
minDecibels: -90,
maxDecibels: -10
})
console.log('Analyzer created:', analyzer.id)
analyzer.detach
Detaches and removes an analyzer
Parameters:
Parameter | Type | Description |
---|---|---|
analyzerId | string | The ID of the analyzer to detach |
Returns:
Promise<boolean>
- Promise that resolves with success status
Example resolved value:
// When the promise resolves, you get:
false
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
const success = await moises.analyzer.detach('analyzer-id')
console.log('Analyzer detached:', success)
analyzer.get
Gets information about a specific analyzer
Parameters:
Parameter | Type | Description |
---|---|---|
analyzerId | string | The ID of the analyzer to get |
Returns:
Object | unknown
- Analyzer information or null if not found
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
const analyzerInfo = moises.analyzer.get('analyzer-id')
console.log('Analyzer info:', analyzerInfo)
analyzer.list
Lists all attached analyzers
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Array
- Array of attached analyzer information
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'my-extension',
name: 'My Extension',
description: 'Extension description',
icon: 'icon',
version: '1.0.0',
author: 'author'
})
const { moises } = useMoisesExtension()
const analyzers = moises.analyzer.list()
console.log('Attached analyzers:', analyzers)
analyzer.getData
Gets serialized analyzer data that can be safely passed through postMessage
Parameters:
Parameter | Type | Description |
---|---|---|
analyzerId | string | The ID of the analyzer to get data from |
Returns:
Object
- Serialized analyzer data including frequency and waveform data
Usage Example:
const analyzerData = moises.analyzer.getData('analyzer-id')
console.log(analyzerData.frequencyData) // Array of frequency values
console.log(analyzerData.waveformData) // Array of waveform values
UI Methods
Controlling common UI elements
ui.setPluginSize
Sets the size of the extension plugin
Parameters:
Parameter | Type | Description |
---|---|---|
width | number | The width of the plugin in pixels |
height | number | The height of the plugin in pixels |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
moises.ui.setPluginSize({ width: 800, height: 600 })
ui.filePicker
Displays a file picker dialog
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | No | File picker title |
description | string | No | File picker description |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the selected file data
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
ui.progress
Displays a progress bar or loading indicator
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | No | Progress title |
value | number | No | Progress value (0-100) |
Returns:
Promise<void>
- Promise that resolves when the operation is complete
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.ui.progress({ title: "Loading...", value: 50 })
ui.cancel
Cancels the current UI operation
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<void>
- Promise that resolves when the operation is cancelled
ui.alert
Displays an alert to the user
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | No | Alert title |
description | string | No | Alert description |
ctaLabel | string | No | Alert CTA label |
ctaColor | string | No | Alert CTA color |
Returns:
Promise<void>
- Promise that resolves when the alert is closed
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.ui.alert({ title: "Notice", description: "Operation completed!", ctaLabel: "OK", ctaColor: "primary" })
ui.confirm
Displays a confirmation dialog
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Confirmation title |
description | string | Yes | Confirmation description |
ctaLabel | string | No | Confirmation CTA label |
ctaColor | string | No | Confirmation CTA color |
Returns:
Promise<boolean>
- Promise that resolves with true if confirmed, false if cancelled
Example resolved value:
// When the promise resolves, you get:
false
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const confirmed = await moises.ui.confirm({
title: "Confirm",
description: "Do you want to continue?",
})
ui.prompt
Displays a text input dialog
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
title | string | Yes | Prompt title |
description | string | Yes | Prompt description |
label | string | No | Prompt label |
defaultValue | string | No | Prompt default value |
ctaLabel | string | No | Prompt CTA label |
ctaColor | string | No | Prompt CTA color |
Returns:
Promise<string>
- Promise that resolves with the entered text
Example resolved value:
// When the promise resolves, you get:
"example"
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const userInput = await moises.ui.prompt({
title: "Name",
description: "Enter your name:",
label: "Name",
defaultValue: "John Doe",
ctaLabel: "OK",
ctaColor: "primary"
})
ui.close
Closes the extension
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<void>
- Promise that resolves when the extension is closed
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.ui.close()
ui.open
Opens the extension
Parameters:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
mountPoint | string | Yes | "sidePanel | bottomPanel" |
Returns:
Promise<void>
- Promise that resolves when the extension is opened
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.ui.open()
Session Methods
Session API for managing audio sessions, tracks, and playback controls
session.export
Exports the audio from the current session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the exported audio data
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const audioData = await moises.session.export()
session.tracks
Gets the list of tracks from the session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<Array<Object>>
- Promise that resolves with an array of tracks
Example resolved value:
// When the promise resolves, you get:
Object[]
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const tracks = await moises.session.tracks()
console.log(tracks.length) // number of tracks
session.play
Starts session playback
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.session.play()
session.pause
Pauses session playback
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.session.pause()
session.togglePlayback
Toggles between play and pause
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.session.togglePlayback()
session.clearSelection
Clears the current selection in the session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.session.clearSelection()
session.setSelection
Sets a selection in the session
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
trackId | string | No | ID of the track to be selected |
start | number | Yes | Start position of the selection |
end | number | Yes | End position of the selection |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.session.setSelection({
trackId: "track-123",
start: 0,
end: 30
})
// Selects an interval without specifying a track
await moises.session.setSelection({ start: 10, end: 20 })
session.reset
This method performs a complete reset of the DAW session by:Use this method when you need to start with a clean slate or prepare the session for loading new content.
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
// Reset the entire DAW session
moises.session.reset()
console.log('Session has been reset')
// Reset before loading a new project
moises.session.reset()
session.getState
Gets the current state of the session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Object
- Current session state
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const sessionState = moises.session.getState()
console.log(`Current time: ${sessionState.currentTime}s`)
console.log(`Duration: ${sessionState.duration}s`)
console.log(`Master volume: ${sessionState.masterVolume}`)
Track Methods
Track API for managing audio tracks
track.getArrayBuffer
Gets the array buffer for a track by its ID
Parameters:
Parameter | Type | Description |
---|---|---|
trackId | string | The ID of the track to get the array buffer for |
Returns:
ArrayBuffer
- The array buffer containing the track's audio data
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const arrayBuffer = await moises.track.getArrayBuffer({ trackId: 'track-123' })
console.log(arrayBuffer) // ArrayBuffer
track.get
Gets a track by its ID
Parameters:
Parameter | Type | Description |
---|---|---|
trackId | string | The ID of the track to get |
Returns:
Promise<Object>
- Promise that resolves with the track object
Return Object Structure:
// When the promise resolves, you get:
{
id: "example", // string
groupId: "example", // string
name: "example", // string
position: 0, // number
pan: 0, // number
volume: 0, // number
isSolo: false, // boolean
isMuted: false, // boolean
duration: 0, // number
loading: false, // boolean
isStitched: false // boolean
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const track = await moises.track.get({ trackId: 'track-123' })
console.log(track.name) // "My Track"
track.list
Gets a list of all tracks in the session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<Array<Object>>
- Promise that resolves with an array of track objects
Example resolved value:
// When the promise resolves, you get:
Object[]
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const tracks = await moises.track.list()
console.log(tracks.length) // number of tracks
track.create
Creates a new track
Parameters:
Parameter | Type | Description |
---|---|---|
groupId | string | The ID of the group to add the track to |
arrayBuffer | ArrayBuffer | The audio data for the track |
name | string | The name of the track |
order | number | The order of the track in the group |
startPositionMs | number | The start position of the track in milliseconds |
Returns:
Promise<trackId>
- Promise that resolves with the created track id
Example resolved value:
// When the promise resolves, you get:
trackid
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const trackId = await moises.track.create({
groupId: "group-123",
arrayBuffer: new ArrayBuffer(1024),
name: "My Track"
})
console.log(trackId) // "track-123"
track.update
Updates a track
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
trackId | string | Yes | The ID of the track to update |
arrayBuffer | ArrayBuffer | No | The audio data for the track |
groupId | string | No | The ID of the group to move the track to |
name | string | No | The name of the track |
muted | boolean | No | Whether the track is muted |
loading | boolean | No | Whether the track is loading |
volume | number | No | The volume of the track (0-1) |
pan | number | No | The pan of the track (-1 to 1) |
startPositionMs | number | No | The start position of the track in milliseconds |
Returns:
Promise<void>
- Promise that resolves when the track is updated
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.track.update({
trackId: "track-123",
arrayBuffer: new ArrayBuffer(1024),
groupId: "group-456",
name: "Updated Track Name",
muted: true
})
track.delete
Deletes a track
Parameters:
Parameter | Type | Description |
---|---|---|
trackId | string | The ID of the track to delete |
Returns:
Promise<void>
- Promise that resolves with the deleted track object
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.track.delete({ trackId: "track-123" })
Group Methods
Group API for managing audio groups
group.get
Gets a group by its ID
Parameters:
Parameter | Type | Description |
---|---|---|
groupId | string | The ID of the group to get |
Returns:
Promise<Object>
- Promise that resolves with the group object
Return Object Structure:
// When the promise resolves, you get:
{
id: "example", // string
type: "example", // string
name: "example", // string
volume: 0, // number
isSolo: false, // boolean
isMuted: false, // boolean
tracks: string[] // Array<string>
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const group = await moises.group.get({ groupId: 'group-123' })
console.log(group.name) // "My Group"
group.list
Gets a list of all groups in the session
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
Promise<Array<Object>>
- Promise that resolves with an array of group objects
Example resolved value:
// When the promise resolves, you get:
Object[]
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const groups = await moises.group.list()
console.log(groups.length) // number of groups
group.create
Creates a new group
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the group |
id | string | The ID of the group |
type | string | The type of the group |
order | number | The order of the group |
solo | boolean | Whether the group is solo |
muted | boolean | Whether the group is muted |
pan | number | The pan of the group |
volume | number | The volume of the group |
options | Object | Additional options for the group |
Returns:
Promise<Object>
- Promise that resolves with the created group object
Return Object Structure:
// When the promise resolves, you get:
{
groupId: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const groupId = await moises.group.create({ name: "My Group" })
console.log(groupId) // "group-123"
group.update
Updates a group
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
groupId | string | Yes | The ID of the group to update |
name | string | No | The name of the group |
type | string | No | The type of the group |
order | number | No | The order of the group |
solo | boolean | No | Whether the group is solo |
muted | boolean | No | Whether the group is muted |
volume | number | No | The volume of the group (0-1) |
takeLaneSetup | Array | No | The take lane setup configuration for the group |
Returns:
Promise<void>
- Promise that resolves when the group is updated
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.group.update({
groupId: "group-123",
name: "Updated Group Name",
muted: true,
volume: 0.8
})
Storage Methods
Storage API for managing audio files
storage.upload
Uploads a buffer to the storage
Parameters:
Parameter | Type | Description |
---|---|---|
buffer | ArrayBuffer | The audio data to upload |
Returns:
Promise<Object>
- Promise that resolves with the uploaded audio data
Return Object Structure:
// When the promise resolves, you get:
{
url: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const url = await moises.storage.upload({ buffer: new ArrayBuffer(1024) })
console.log(url) // "https://storage.com/audio.mp3"
storage.download
Downloads an audio file from the storage
Parameters:
Parameter | Type | Description |
---|---|---|
url | string | The URL of the audio file to download |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the downloaded audio data
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const buffer = await moises.storage.download({ url: "https://storage.com/audio.mp3" })
console.log(buffer) // ArrayBuffer
Storage Methods
if showed alert before, shows new alert only last day
storage.upload
Uploads a buffer to the storage
Parameters:
Parameter | Type | Description |
---|---|---|
buffer | ArrayBuffer | The audio data to upload |
Returns:
Promise<Object>
- Promise that resolves with the uploaded audio data
Return Object Structure:
// When the promise resolves, you get:
{
url: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const url = await moises.storage.upload({ buffer: new ArrayBuffer(1024) })
console.log(url) // "https://storage.com/audio.mp3"
storage.download
Downloads an audio file from the storage
Parameters:
Parameter | Type | Description |
---|---|---|
url | string | The URL of the audio file to download |
Returns:
Promise<ArrayBuffer>
- Promise that resolves with the downloaded audio data
Example resolved value:
// When the promise resolves, you get:
ArrayBuffer
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const buffer = await moises.storage.download({ url: "https://storage.com/audio.mp3" })
console.log(buffer) // ArrayBuffer
UploadToSignedUrl Methods
Uploads an array buffer to a pre-signed URL
Compute Methods
Compute API for managing audio computations
compute.sessionPlayerGenerate
Generates a session player
Parameters:
Parameter | Type | Description |
---|---|---|
contextAudio | ArrayBuffer | The context audio for the session player |
conditioningAudio | ArrayBuffer | The conditioning audio for the session player |
conditioningText | string | The conditioning text for the session player |
steps | number | The number of steps for the session player |
guidanceScale | number | The guidance scale for the session player |
weightSchedule | number | The weight schedule for the session player |
instrument | string | The instrument for the session player |
presetId | string | The preset ID for the session player |
chroma | boolean | Whether to use chroma for the session player |
inpaintingTimestamps | Array | The timestamps for the session player |
inpaintingTarget | Array | The target for the session player |
Returns:
Promise<Object>
- Promise that resolves with the generated session player
Return Object Structure:
// When the promise resolves, you get:
{
conditioningAudio: ArrayBuffer, // ArrayBuffer
conditioningText: "example", // string
contextAudio: ArrayBuffer, // ArrayBuffer
generatedAudio: ArrayBuffer, // ArrayBuffer
generatedAudio2: ArrayBuffer, // ArrayBuffer
guidanceScale: 0, // number
seed: 0, // number
steps: 0, // number
weightSchedule: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
await moises.compute.sessionPlayerGenerate({})
compute.sessionPlayerPresets
Gets the list of session player presets
Parameters:
Parameter | Type | Description |
---|---|---|
None | - | - |
Returns:
void
- Does not return a value
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const presets = await moises.compute.sessionPlayerPresets()
console.log(presets) // [{ id: 'preset-123', name: 'Preset 1', description: 'Description 1', image: 'https://storage.com/image.png', instrument: 'Instrument 1' }]
compute.sessionPlayerInpaint
Inpaints an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
input | ArrayBuffer | The input audio data |
mask | ArrayBuffer | The mask for the inpainting |
Returns:
Promise<Object>
- Promise that resolves with the inpainted audio data TODO: add return type
Return Object Structure:
// When the promise resolves, you get:
{}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const inpainted = await moises.compute.sessionPlayerInpaint({ input, mask })
console.log(inpainted) // ArrayBuffer
compute.workflow
Runs a workflow
Parameters:
Parameter | Type | Description |
---|---|---|
workflowId | string | The ID of the workflow to run |
params | Object | The parameters for the workflow |
Returns:
Promise<Object>
- Promise that resolves with the workflow result
Return Object Structure:
// When the promise resolves, you get:
{
detection: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const params = {
inputUrl: 'https://storage.com/audio.mp3',
}
const workflowId = 'workflow'
const result = await moises.compute.workflow({ workflowId, params })
console.log(result) // { detection: 'detection' }
compute.automix
Runs an automix job
Parameters:
Parameter | Type | Description |
---|---|---|
workflowId | string | The ID of the workflow to run |
params | Object | The parameters for the workflow |
Returns:
Promise<Object>
- Promise that resolves with the automix result
Return Object Structure:
// When the promise resolves, you get:
{
mix: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const params = {
inputUrl: 'https://storage.com/audio.mp3',
}
const workflowId = 'automix'
const result = await moises.compute.automix({ workflowId, params })
console.log(result) // { mix: 'mix' }
compute.stems
Extracts stems from an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
input | string | The input audio data |
stemsToExtract | Array | The stems to extract |
Returns:
Promise<Object>
- Promise that resolves with the stems
Return Object Structure:
// When the promise resolves, you get:
{
stem.id: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const params = {
inputUrl: 'https://storage.com/audio.mp3',
vocals: true,
drums: true,
bass: false,
guitars: false,
strings: false,
piano: false,
keys: false
}
const result = await moises.compute.stems(params)
console.log(result) // { stems.vocals: string, stems.drums: string }
compute.instruments
Detects instruments in an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
inputUrl | string | The input audio data |
Returns:
Promise<Object>
- Promise that resolves with the instruments result
Return Object Structure:
// When the promise resolves, you get:
{
instruments: "example" // string
}
Usage Example:
import { initMoisesExtension } from '@moises.ai/extension'
const useMoisesExtension = initMoisesExtension({
id: 'id',
name: 'name',
description: 'description',
icon: 'icon',
version: 'version',
author: 'author'
})
const { moises } = useMoisesExtension()
const result = await moises.compute.instruments({ input })
console.log(result) // { instruments: 'instrument' }
compute.beatsAndChords
Detects beats and chords in an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
input | string | The input audio data |
Returns:
Promise<Object>
- Promise that resolves with the beats and chords result
Return Object Structure:
// When the promise resolves, you get:
{
beatMap: object, // object
chordMap: object, // object
bpm: 0, // number
rootKey: "example", // string
detuningCents: 0, // number
estimatedTuning: "example" // string
}
compute.beats
Detects beats in an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
input | string | The input audio data |
Returns:
Promise<void>
- Promise that resolves with the beats result
Usage Example:
const result = await compute.beats({ input })
compute.lyrics
Detects lyrics in an audio file
Parameters:
Parameter | Type | Description |
---|---|---|
input | string | The input audio data |
Returns:
Promise<void>
- Promise that resolves with the lyrics result
Usage Example:
const result = await compute.lyrics({ input })
Now Methods
in some cases, date 'now' is in the future. prevent to show countdown in this case
SetShowed Methods
show alert
Today Methods
if expired, dismiss alert
GA4 Methods
GA4 Methods
GA4 Methods
This file is automatically generated. Do not edit manually.
Request Access
To start developing extensions for the Moises AI Music Studio, you need to request access to our extension development platform. This process helps us understand your goals and ensure you have the right resources to build amazing extensions.
create
Creates and attaches a new audio analyzer