debug: add logging to AudioData playback
- Log frame count, channels, sample rate from AudioData - Log destination channel size before copyTo - Identify frame count mismatch issue
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
"react": "^19.2.6",
|
"react": "^19.2.6",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.6",
|
||||||
"sodium-native": "^4.3.2",
|
"sodium-native": "^4.3.2",
|
||||||
|
"tone": "^15.1.22",
|
||||||
"ws": "^8.20.1",
|
"ws": "^8.20.1",
|
||||||
"zod": "^4.4.3"
|
"zod": "^4.4.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ const state = {
|
|||||||
const sampleRate = audioData.sampleRate;
|
const sampleRate = audioData.sampleRate;
|
||||||
const frameCount = audioData.numberOfFrames;
|
const frameCount = audioData.numberOfFrames;
|
||||||
const numberOfChannels = audioData.numberOfChannels;
|
const numberOfChannels = audioData.numberOfChannels;
|
||||||
|
console.log(`AudioData: ${frameCount} frames, ${numberOfChannels} ch, ${sampleRate}Hz`);
|
||||||
const audioBuffer = state.audioContextListen.createBuffer(
|
const audioBuffer = state.audioContextListen.createBuffer(
|
||||||
numberOfChannels,
|
numberOfChannels,
|
||||||
frameCount,
|
frameCount,
|
||||||
@@ -500,9 +501,8 @@ const state = {
|
|||||||
);
|
);
|
||||||
for (let ch = 0; ch < numberOfChannels; ch++) {
|
for (let ch = 0; ch < numberOfChannels; ch++) {
|
||||||
const channelData = audioBuffer.getChannelData(ch);
|
const channelData = audioBuffer.getChannelData(ch);
|
||||||
const tempArray = new Float32Array(frameCount);
|
console.log(`Channel ${ch}: copyTo into ${channelData.length} samples`);
|
||||||
audioData.copyTo(tempArray, { planeIndex: ch });
|
audioData.copyTo(channelData, { planeIndex: ch });
|
||||||
channelData.set(tempArray);
|
|
||||||
}
|
}
|
||||||
const source = state.audioContextListen.createBufferSource();
|
const source = state.audioContextListen.createBufferSource();
|
||||||
source.buffer = audioBuffer;
|
source.buffer = audioBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user