mulmocast 1.2.55 → 1.2.56

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.
@@ -2,6 +2,7 @@ import type { GraphData } from "graphai";
2
2
  import { MulmoStudioContext, MulmoBeat, PublicAPIArgs } from "../types/index.js";
3
3
  export declare const getBeatAudioPath: (text: string, context: MulmoStudioContext, beat: MulmoBeat, lang?: string) => string | undefined;
4
4
  export declare const getBeatAudioPathOrUrl: (text: string, context: MulmoStudioContext, beat: MulmoBeat, lang?: string) => string | undefined;
5
+ export declare const localizedPath: (context: MulmoStudioContext, beat: MulmoBeat, index: number, lang: string) => string | undefined;
5
6
  export declare const listLocalizedAudioPaths: (context: MulmoStudioContext) => (string | undefined)[];
6
7
  export declare const audio_graph_data: GraphData;
7
8
  export declare const generateBeatAudio: (index: number, context: MulmoStudioContext, args?: PublicAPIArgs & {
@@ -40,12 +40,17 @@ export const getBeatAudioPathOrUrl = (text, context, beat, lang) => {
40
40
  const maybeAudioFile = getAudioFilePath(audioDirPath, context.studio.filename, audioFileName, lang);
41
41
  return getAudioPathOrUrl(context, beat, maybeAudioFile);
42
42
  };
43
+ // for lipSync
44
+ export const localizedPath = (context, beat, index, lang) => {
45
+ const multiLingual = context?.multiLingual?.[index] ?? {};
46
+ const text = localizedText(beat, multiLingual, lang);
47
+ return getBeatAudioPathOrUrl(text, context, beat, lang);
48
+ };
49
+ // for Electron
43
50
  export const listLocalizedAudioPaths = (context) => {
44
51
  const lang = context.lang ?? context.studio.script.lang;
45
52
  return context.studio.script.beats.map((beat, index) => {
46
- const multiLingual = context.multiLingual[index];
47
- const text = localizedText(beat, multiLingual, lang);
48
- return getBeatAudioPathOrUrl(text, context, beat, lang);
53
+ return localizedPath(context, beat, index, lang);
49
54
  });
50
55
  };
51
56
  const preprocessorAgent = (namedInputs) => {
@@ -3,6 +3,7 @@ import { getBeatPngImagePath, getBeatMoviePaths, getAudioFilePath } from "../uti
3
3
  import { imagePrompt, htmlImageSystemPrompt } from "../utils/prompt.js";
4
4
  import { renderHTMLToImage } from "../utils/markdown.js";
5
5
  import { beatId } from "../utils/utils.js";
6
+ import { localizedPath } from "./audio.js";
6
7
  const htmlStyle = (context, beat) => {
7
8
  return {
8
9
  canvasSize: MulmoPresentationStyleMethods.getCanvasSize(context.presentationStyle),
@@ -53,7 +54,8 @@ export const imagePreprocessAgent = async (namedInputs) => {
53
54
  }
54
55
  else {
55
56
  // Audio file will be set from the beat's audio file when available
56
- returnValue.audioFile = studioBeat?.audioFile;
57
+ const lang = context.lang ?? context.studio.script.lang;
58
+ returnValue.audioFile = studioBeat?.audioFile ?? localizedPath(context, beat, index, lang);
57
59
  }
58
60
  }
59
61
  returnValue.movieAgentInfo = MulmoPresentationStyleMethods.getMovieAgentInfo(context.presentationStyle, beat);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.55",
3
+ "version": "1.2.56",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",