From f74bbd4f451490a3d2c728f1d72dae79aa826c2f Mon Sep 17 00:00:00 2001 From: surajshivakumar Date: Thu, 13 Jun 2024 03:06:46 -0400 Subject: [PATCH] example for local audio file updated --- example/example.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/example/example.js b/example/example.js index 3807f54..7819c12 100644 --- a/example/example.js +++ b/example/example.js @@ -1,20 +1,18 @@ -const { AudioProcessor } = require('../index'); // Assuming your index.js is in the parent directory +const { getTranscription, getRedactedAudio } = require('..'); // Assuming your index.js is in the parent directory async function runExample() { const audioFilePath = '../audio/a.mp3'; - const outputFilePath = './redacted_audio.wav'; + const outputFilePath = './outs/redacted_audio.wav'; try { // Create a transcriber and a redactor from the factory - const transcriber = AudioProcessor.getTranscriber('deepgram',process.env.DEEPGRAM_API_KEY, audioFilePath); - const redactor = AudioProcessor.getRedactor('deepgram', audioFilePath); - - // Perform transcription - const transcription = await transcriber.processAudio(audioFilePath); + const transcription = await getTranscription('deepgram', + process.env.DEEPGRAM_API_KEY, + audioFilePath); console.log('Transcription completed:', transcription); // Perform redaction - await redactor.redactAudio(transcription.redactionTimestamps, audioFilePath, outputFilePath); + await getRedactedAudio('deepgram', transcription.redactionTimestamps, audioFilePath, outputFilePath); } catch (error) { console.error('Error processing audio:', error); }