You can add small audio files (<100kB) to your MegunoLink project and play them on your computer by sending serial commands from your Arduino. Or have MegunoLink speak text using the system speech synthesizer.

To play sounds with serial commands:

  1. import a .wav file into your MegunoLink project, then
  2. create an Audio variable in your Arduino sketch and use its PlayAudioClip method to play the sound.

To speak text with commands:

  1. create an Audio variable in your Arduino sketch and use its Speak method to send the text you want spoken.

Importing Audio Files

Select Manage Audio Clips from the gear (⚙) menu to add, rename, delete and test audio clips in your MegunoLink project. Clips are stored in the project file so they are always available.

Import a new clip by clicking Add and browsing to the location of the audio clip. The audio clip must be a .wav and less than 100kB. You can download useful audio clips from websites such as free sound.

The default name for newly imported audio clips is their filename, however you can change this by selecting the clip in the clip-list and clicking the Rename button. This name is used when sending commands to MegunoLink to play the audio clip.

Audio clip manager

Use the audio clip manager to add and remove .wav files from your MegunoLink project.

Audio clips can be removed from your project by clicking the Delete button.

Select a clip and click the Play button to play the clip. Use the Stop button to stop long running audio clips.

Triggering Playback

Create an Audio variable with our Arduino library and use its PlayAudioClip method to trigger playback of an audio clip loaded into your MegunoLink project. The clip will play back on your computer’s speakers.

Configuring the Speech Synthesizer

Select Text to Speech Settings from the gear (⚙) menu to change the settings used to synthesize speech from text. The settings available may vary depending on the voices you have installed. Click Open system speech settings to launch the system speech settings to manage voices installed on your computer.

The Speaking rate controls how fast the text is spoken. The volume controls how loud the speech is, relative to the system volume setting. Select from installed speakers using the voice control. Click the Test button to speak a short text passage with the selected settings.

Text to speech settings

Set the speaking rate, volume and voice used when converting text into speech.

Speak a message

Create an Audio variable with our Arduino library and use its Speak method to speak a message. The speech will play back on your computer’s speakers.

Arduino library reference

The Audio definition is found in our Arduino library. The library sends the serial commands that MegunoLink will recognize to trigger playback of audio clips loaded into your project or speak text.

Methods

An Audio variable has the following methods:

Method Descriptions

Audio Constructor

Creates a Audio variable, which can be used to send commands to MegunoLink to trigger playback of audio files.

Audio(Print &Destination = Serial);

Parameters
Name Type Required? Description
Destination Print & No Sets the serial connection to use for sending messages to MegunoLink. Defaults to Serial, the default Arduino RS232 port.

Play audio clip

Sends a command to MegunoLink to trigger playback of a named audio clip.

PlayAudioClip(const char* ClipName);
PlayAudioClip(const __FlashStringHelper* ClipName);
PlayAudioClip(const String* ClipName);

Parameters
Name Type Required? Description
ClipName const char*, const __FlashStringHelper*, String Yes The name of the clip to play.

Speak text

Sends a command to MegunoLink to speak a message.

Speak(const char* Message);
Speak(const __FlashStringHelper* Message);
Speak(const String* Message);

Parameters
Name Type Required? Description
Message const char*, const __FlashStringHelper*, String Yes The text to speak.

Stop audio playback

Sends a command to MegunoLink to stop playback of any audio clips and/or speech still playing.

Stop();

Start typing and press Enter to search