Skip to content

Commit

Permalink
Update: 音声合成後のテレメトリ収集を実装
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Dec 31, 2024
1 parent 863f7d6 commit fabfaf9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Talk/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ registerHotkeyWithCleanup({
const trackToolbarAction = (actionName: string) => {
void useAnalytics().trackEvent("aisp_toolbar_button_click", {
action_name: actionName,
action: actionName,
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/composables/useDialogAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export function useDialogAnalytics(
() => isOpen.value,
(newValue) => {
void analytics.trackEvent("aisp_dialog_state_change", {
dialog_name: dialogName,
dialog_state: newValue ? "opened" : "closed",
dialog: dialogName,
state: newValue ? "opened" : "closed",
});
},
);
Expand Down
17 changes: 17 additions & 0 deletions src/store/audioGenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "./type";
import { convertAudioQueryFromEditorToEngine } from "./proxy";
import { generateTempUniqueId } from "./utility";
import { useAnalytics } from "@/composables/useAnalytics";

const audioBlobCache: Record<string, Blob> = {};

Expand Down Expand Up @@ -56,12 +57,28 @@ export async function fetchAudioFromAudioItem(
morphRate: audioItem.morphingInfo.rate,
});
} else {
const startTime = performance.now() / 1000; // ミリ秒から秒に変換
blob = await instance.invoke("synthesisSynthesisPost")({
audioQuery: engineAudioQuery,
speaker,
enableInterrogativeUpspeak:
state.experimentalSetting.enableInterrogativeUpspeak,
});
const synthesisTime = (performance.now() / 1000) - startTime;
void useAnalytics().trackEvent("aisp_synthesis", {
// プライバシーの観点から、テキスト内容は送信しない
engineId: audioItem.voice.engineId,
speakerId: audioItem.voice.speakerId,
styleId: audioItem.voice.styleId,
speedScale: audioQuery.speedScale,
intonationScale: audioQuery.intonationScale,
tempoDynamicsScale: audioQuery.tempoDynamicsScale,
pitchScale: audioQuery.pitchScale,
volumeScale: audioQuery.volumeScale,
prePhonemeLength: audioQuery.prePhonemeLength,
postPhonemeLength: audioQuery.postPhonemeLength,
synthesisTime: synthesisTime,
});
}
audioBlobCache[id] = blob;
return { audioQuery, blob };
Expand Down

0 comments on commit fabfaf9

Please sign in to comment.