-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspareCodeDump
More file actions
39 lines (34 loc) · 1.29 KB
/
spareCodeDump
File metadata and controls
39 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// async function transcribeWithDiarization(filePath) {
// const audioBytes = await FileSystem.readAsStringAsync(filePath, { encoding: FileSystem.EncodingType.Base64 });
// const config = {
// model: "latest_long",
// encoding: "MP3",
// sampleRateHertz: 16000,
// enableWordTimeOffsets: true,
// enableWordConfidence: true,
// languageCode: "en-IN",
// };
// const request = {
// audio: audioBytes,
// config: config,
// };
// try {
// const response = await axios.post(
// `https://speech.googleapis.com/v1/speech:recognize?key=${Google_API_KEY}`,
// request
// );
// console.log('Transcription response:', response.data);
// const transcription = response.data.results.map(result => result.alternatives[0].transcript).join('\n');
// const speakerSegments = response.data.results.flatMap(result =>
// result.alternatives[0].words.map(wordInfo => ({
// word: wordInfo.word,
// speakerTag: wordInfo.speakerTag,
// }))
// );
// speakerSegments.forEach(segment => {
// console.log(`Speaker ${segment.speakerTag}: ${segment.word}`);
// });
// } catch (error) {
// console.error('Error transcribing audio:', error);
// }
// }