You can use \draw plot for plotting functions. For the noise, you can use the rand function.
In general, plotting is more comfortable using the PGFPlots package, which builds on PGF/TikZ:
There is a deactivate option with media9 inclusion command \includemedia. Default setting of deactivate is pageclose to unload the media player upon page change. If set to onclick, the media keeps playing in the background.
To automatically start playing, the activate command option must be set to either pageopen or pagevisible and the autoPlay Flash ...
You are using package media9 and its APlayer.swf app. It offers a number of ways to play/pause/stop playback (see Pg. 20 of the documentation):
press mouse button over the widget and move the mouse out while keeping the button pressed
press the Space bar on the keyboard
press the Home / Pos1 key on the keyboard
The following example defines \embedaudio. It implements the same specification for embedded media as the media9 LaTeX package. Audio files in the MP3 format are played back within the player component APlayer.swf shipping with media9. MP3 files specified as URL are first downloaded before embedding. Adobe Reader on the Windows or OSX platforms is required ...
There are two problems with your MWE.
The first is that it looks like you're using the wrong encoding for the non-ASCII characters.
xstring should not have problems anymore.
The second is that there's a problem of expansion. The following should work. But you can get around this ...
Version 2014/06/25 of media9 has updated players APlayer.swf and VPlayer.swf.
The play and pause methods of their programming interface now accept optional arguments which are time offsets, measured in seconds, into the media file. Thus, a properly configured \mediabutton lets the embedded player play a portion of the media file.
A generic sound example ...
If you want just the noise part without any sinusoidal excitation, you can customize the Donig's code by just removing the sinusoidal excitation. In addition, you can shift the noise location by just adding the xshift and yshift commands, as