Say it!

Version 1.0.0.0 (1.16 KB) by Nikita
Send voice message on facebook.com, or by e-mail, or in any messenger
114 Downloads
Updated 15 Jan 2015

View License

MatLab script: how to send a voice messages on "Facebook" (twitter, e-mail, vkontakte) uploading them to the ftp-server.
This script helps to record the voice message from microphone, convert it to mp3-file and upload this file on ftp-server by one command from MatLab command prompt. The link to mp3-file could be automatically copied to clipboard (see
*.m file and description below)
You need to have:
1) MatLab installed on your computer,
2) an account on any server, which supports FTP (where you have upload permission, for example in this example http://ucoz.ru),
3) the script "Passive Mode FTP in MATLAB",
4) the script "Mp3write".
The scripts "Passive Mode FTP in MatLab" and "Mp3write" should be downloaded (http://www.mathworks.com/matlabcentral/fileexchange) and integrated to your MatLab.
Then you should create a new script in MatLab (File-->New-->Script) with the text below, see also attached *.m-file:

sec = 15; %the duration of voice msg, in second, may change to any
FS = 8000; nbit=8; %for higher quality you may set for example FS=16000; nbit=16;
recObj = audiorecorder(FS, nbit, 1);
recordblocking(recObj, sec);
Y = getaudiodata(recObj);
s = 'qwertyuiopasdfghjklzxcvbnm1234567890';
i = randi(36,1,30);
q = s(i);
mp3write(Y,FS,horzcat(q,'.mp3'));
mput(f,horzcat('C:\Program Files\MATLAB\R2010b\bin\ ',q,'.mp3') );

and save it as "say_it.m" to the folder in "MatLab search path" list (any folder from here "File --> Set Path...").
The address 'C:\Program Files\MATLAB\R2010b\bin\' should be the same to the "mp3write" output folder.
That's almost it!
Let's suppose you have an account on http://ucoz.ru with the name "username" and FTP-password "password". You can connect to the ftp-server by running
f = ftp('username.ucoz.ru','0username','password'); pasv(f);
in Matlab's command prompt, and next you should run the command
say_it();
after you have just pressed the "Enter" key your msg will start to be recorded from microphone (make sure your microphone is switched on), and after it's recorded it will be uploaded to ftp-server.

If you need to copy a link to your voice message (immediately after it's recorded) to clipboard, you should add the line
clipboard('copy', horzcat('http://username.ucoz.ru/',q,'.mp3'));
to the script "say_it.m" at the end of it (in case you have account on http://ucoz.ru).

Now the only thing to do – is to send the link to your friend on "Facebook", or by e-mail, or by any messenger.
Every 1 second of message takes about 1kB disk space.
With the best wishes
I hope this script makes your life more comfortable, cause I was lazy to type long texts. Just say it!

Cite As

Nikita (2024). Say it! (https://www.mathworks.com/matlabcentral/fileexchange/49045-say-it), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0