Database Text to speech

Hey all! feel like im flooding the forums lately, i apologise just been so active on my app!
in my app users can store paragraphs of information. Its stored in the database for them to later revisit, is there any way i can install a audio plugin which allows me to have the text turned into speech? Thanks

Hi -
I’m working on a similar project and you may be further along than me. I’m hoping you can help…
My transcription will be the opposite - I’m trying to get my database to load questions, and the responses will be verbal (voice-to-text). You may want to review and compare Google Cloud, IBM Watson, Microsoft Azure, and Amazon Transcribe. Can you reach back and let me know how you make out? Thanks

here is code witch works, but i don’t know with adalo u can do this

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const fetch = require('node-fetch');
const { Storage } = require('@google-cloud/storage');
const { Readable } = require('stream');
exports.voiceAi = functions.region('us-central1').https.onCall(async (data, context) => {
  if (!context.auth || !context.auth.uid) {
    throw new functions.https.HttpsError(
      'unauthenticated',
      'The function must be called while authenticated.'
    );
  }

  const inputText = data.input;
  const apiKey = 'YOUR-API-KEY'; 

  try {
    const response = await fetch('https://api.openai.com/v1/audio/speech', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        model: "tts-1",
        input: inputText,
        voice: "onyx"
      }),
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    // Gauti failą kaip Base64 eilutę
    const base64Audio = await response.buffer().toString('base64');
    const storage = new Storage();
    const bucket = storage.bucket(process.env.BUCKET_NAME); 
    const fileName = `audio/${context.auth.uid}/voice.mp3`;
    const file = bucket.file(fileName);
    const base64Decoded = Buffer.from(base64Audio, 'base64');

    const writeStream = file.createWriteStream({
      metadata: {
        contentType: 'audio/mpeg',
      },
    });

    const readableStream = new Readable();
    readableStream.push(base64Decoded);
    readableStream.push(null);
    readableStream.pipe(writeStream);

    await new Promise((resolve, reject) => {
      writeStream.on('finish', resolve);
      writeStream.on('error', reject);
    });

    await file.makePublic();

    const directUrl = file.publicUrl();
    return { url: directUrl };
  } catch (error) {
    console.error('Error generating audio:', error);
    throw new functions.https.HttpsError('internal', `Failed to generate audio: ${error.message}`);
  }
});

this code works in firbaseStorage, but principle is the same

Hey all! Had a crazy few days and not been able to come on. Il take a look at all of your replies tomorrow :heart::heart:

I’ve been following the Text-to-Speech topic at Adalo for a long time. I’m not familiar with the plugins. I use the Google TTS API and the audio player from MarketPlace Adalo.

Hey! Thanks a lot dude, il
Check the out video out tonight :heart::heart:

1 Like

Not really came to a solution to my text to speech. Anyone else can talk to me through how to setup google text to speech?