Skip to content

Commit

Permalink
audio working
Browse files Browse the repository at this point in the history
  • Loading branch information
prtkjakhar committed Sep 1, 2023
1 parent 6d4c006 commit a9a5dc5
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const RenderVoiceRecorder = ({ setInputMsg }) => {
const context = useContext(AppContext);
const t = useLocalization();
const [recordAudio, setRecordAudio] = useState('');
const [base, setBase] = useState('');

const handleStopRecording = () => {
setRecordAudio(RecordState.STOP);
Expand Down Expand Up @@ -46,16 +45,15 @@ const RenderVoiceRecorder = ({ setInputMsg }) => {
}
try {
const base64Data = await blobToBase64(data.blob);
setBase(base64Data);
makeComputeAPICall();
makeComputeAPICall(base64Data);
} catch (error) {
console.error('Error converting Blob to Base64:', error);
}
};

const makeComputeAPICall = async () => {
const makeComputeAPICall = async (base) => {
try {
// console.log("base", base)
console.log("base", base);
const prefix = "data:audio/wav;base64,";
const actualBase64 = base.substring(prefix.length);
const audioData = Uint8Array.from(atob(actualBase64), c => c.charCodeAt(0));
Expand Down

0 comments on commit a9a5dc5

Please sign in to comment.