Xsmael
Xsmael

Reputation: 3942

GSM SIM800C text to speech audio stream

I have this USB-to-GSM Serial-GPRS-SIM800C module and I have successfully been able to send AT commands to it and do stuffs, but what I really wanted was Text to speech capabilities, I was able to generate an AMR audio file, upload it unto the module's internal memory and play it whenever some one calls.

But the message heard by caller's is going to be dynamic and TTS will run realtime, so the uploading process of the audio file into the module will cause undesirable delay, is there any way I could stream some audio through the module?

Thanks.

Upvotes: 3

Views: 2944

Answers (2)

Xsmael
Xsmael

Reputation: 3942

To answer @anothersanj

I'm using serialport-gsm to make things easier. This is how I go about it:

modem.executeCommand('AT+FSMKDIR=C:\\status\\',(result) => { log.debug(result); });
        //reading the audio file from your computer with nodejs fs module
        fs.readFile('tts2.amr', function(err, amr_data) {
            if(!err) {
                let fsize= fs.statSync('tts2.amr').size;
                log.debug(fsize);
                //creating the file on the GSM module's memory
                modem.executeCommand('AT+FSCREATE=C:\\stats\\tts2.amr',(result) => { log.debug(result); });
                //writing the file on the GSM module's memory
                modem.executeCommand('AT+FSWRITE=C:\\stats\\tts2.amr,0,'+fsize+',100',(result) => { 
                    modem.port.write(amr_data);
                });
                //Display file list on specified path (like ls command)
                modem.executeCommand('AT+FSLS=C:\\stats',(result) => { log.debug(result); });
                
            }
        }); 

And for playing the file whenever someone calls you do:

//playing the file on incoming call
        modem.on('onNewIncomingCall', (result) => { 
            log.debug(result); 
            modem.executeCommand('ATA',(result) => { log.debug(result); });
            modem.executeCommand('AT+CMEDPLAY=1,\"C:\\stats\\tts2.amr\",0,100',(result) => { log.debug(result); });
            modem.executeCommand('AT+DDET=1',(result) => { log.debug(result); });

        });

Upvotes: 1

anothersanj
anothersanj

Reputation: 103

Here's what I have had to do.

  1. Start call (ATDxxxxxxxxxxx;)
  2. Set mode (AT+DTAM=2)
  3. Start recording (AT+CREC=1,1,0)
  4. Speak what I want to playback into microphone 5.Stop recording (AT+CREC=2)
  5. Hang up (ATH)

Now I can playback what I recorded using the following

  1. Start call (ATDxxxxxxxxxxx;)
  2. Set mode (AT+DTAM=2)
  3. Start playback (AT+CREC=4,1,0,80)
  4. Hang up (ATH)

No idea how to do this dynamically or even upload an *.amr file.

Would be grateful if you could share what commands you used to see if there's any way to improve.

Upvotes: 6

Related Questions