refactored logging.

This commit is contained in:
Michael Mainguy 2024-04-03 10:09:38 -05:00
parent c4d201c5ba
commit 1d003c77e6
2 changed files with 8 additions and 10 deletions

View File

@ -56,7 +56,7 @@ function setPosition(node: TransformNode, scene: Scene, offset: Vector3 = Vector
switch (scene.activeCamera.getClassName()) { switch (scene.activeCamera.getClassName()) {
case "WebXRCamera": case "WebXRCamera":
//const oldParent = node.parent; //const oldParent = node.parent;
//console.log(oldParent.name);
node.setParent(null); node.setParent(null);
const front = getFrontPosition(1, scene).clone(); const front = getFrontPosition(1, scene).clone();
const camPos = scene.activeCamera.globalPosition.clone(); const camPos = scene.activeCamera.globalPosition.clone();

View File

@ -1,5 +1,5 @@
import {VuMeterEngine, WebVoiceProcessor} from "@picovoice/web-voice-processor"; import {VuMeterEngine, WebVoiceProcessor} from "@picovoice/web-voice-processor";
import {EagleProfilerEnrollFeedback, EagleProfilerWorker, EagleWorker} from "@picovoice/eagle-web"; import {EagleProfilerWorker, EagleWorker} from "@picovoice/eagle-web";
import {PvEngine} from "@picovoice/web-voice-processor/dist/types/types"; import {PvEngine} from "@picovoice/web-voice-processor/dist/types/types";
import {base64} from "rfc4648"; import {base64} from "rfc4648";
import {CobraWorker} from "@picovoice/cobra-web"; import {CobraWorker} from "@picovoice/cobra-web";
@ -49,15 +49,13 @@ export class VoiceRecognizer {
data.set(inputData, data.length - inputData.length); data.set(inputData, data.length - inputData.length);
} }
if (data.length > eagleProfiler.minEnrollSamples) { if (data.length > eagleProfiler.minEnrollSamples) {
console.log('enrolling');
console.log(data.length);
const result = await eagleProfiler.enroll(data); const result = await eagleProfiler.enroll(data);
if (result.percentage >= 100) { if (result.percentage >= 100) {
console.log(data);
console.log(EagleProfilerEnrollFeedback[result.feedback]);
const profile = await eagleProfiler.export(); const profile = await eagleProfiler.export();
//console.log(profile.bytes.buffer); //console.log(profile.bytes.buffer);
console.log(base64.stringify(profile.bytes));
//console.log(profile.bytes); //console.log(profile.bytes);
//console.log(profile.bytes.buffer.toString('base64')); //console.log(profile.bytes.buffer.toString('base64'));
//console.log(profile); //console.log(profile);
@ -69,7 +67,7 @@ export class VoiceRecognizer {
} }
} }
console.log(inputData.length);
break; break;
} }
} }
@ -77,11 +75,11 @@ export class VoiceRecognizer {
const devices = await navigator.mediaDevices.enumerateDevices(); const devices = await navigator.mediaDevices.enumerateDevices();
devices.forEach((device) => { devices.forEach((device) => {
if (device.kind === 'audioinput') { if (device.kind === 'audioinput') {
console.log(device.label + ' ' + device.kind + ' ' + device.deviceId);
} }
}); });
const vuCallback = (db) => { const vuCallback = (db) => {
console.log(db);
} }
WebVoiceProcessor.setOptions({deviceId: 'default'}); WebVoiceProcessor.setOptions({deviceId: 'default'});
const vuEngine = new VuMeterEngine(vuCallback); const vuEngine = new VuMeterEngine(vuCallback);