- Record audio data
- Play audio data
It is quite straight forward to install the audio package,
-
Install Octave and Octave development package.
sudo apt-get install octave liboctave-dev
The latter is required to install Octave packages from Octave Forge.
-
Install the audio package from Octave Forge.
In Octave, runsudo octave
We may list installed packages in Octave to verify that it is successfully installed bypkg install -forge audio
The output should look like the following,pkg list
which shows that the audio package is version 1.1.4 and installed atPackage Name | Version | Installation directory --------------+---------+----------------------- audio *| 1.1.4 | /usr/share/octave/packages/audio-1.1.4
/usr/share/octave/packages/audio-1.1.4
. The "*" next to the package name indicates that the package is loaded and ready to use.
If you run Octave as a non-root user, the Octave package will be installed under the user's home directory and can only be used by the user. By running Octave as root (i.e., usingsudo octave
), we install the Octave package for everyone.
-
The audio package uses some external programs to play and record audio data. Sox is sufficient for playing sound. We now install Sox in Linux.
apt-get install sox
-
The audio package uses OSS to record audio data. Ubuntu 13.10 does not have an OSS
package. Instead, it provides an ALSA wrapper for OSS. We now install the wrapper.
apt-get install alsa-oss
-
To use the ALSA wrapper for OSS, we must invoke the
aoss
command. Then to run Octave, we run,
Without usingaoss octave
aoss
to invoke octave, you would encounter an error indicating that it failed to open/dev/dsp
that is supposedly created by OSS. Since we are emulating OSS using ALSA, the system does not have the device file.
-
Now, let us play a tone of 2 seconds at 400 Hz in Octave.
y = cos(2 * pi * 400 * (0:1/44100:2)); sound(6, 44100);
Note that the sampling rate is 44100Hz in the above.
-
To record and then play the recorded audio data, we may do
[y, fs, ch] = aurecord(5, 44100, 2); sound(y, fs, ch);
-
Finally, if you do not hear anything when you play the sound, check your virtual machine setting. It must have an appropriate
audio card. The following shows the audio card setting for the Ubuntu virtual machine running in VMware Player.
At the same time, the mixer of the Windows host should show that the virtual machine is a source as shown below. You can open the mixer by right-cliking on the "speaker" icon in the system tray, then choose "Open Volume Mixer".
If you are running VirtualBox, you will have more than one audio driver to choose from when configuring the virtual machine. My experience is that not all driver works on a particular host. You can test the driver one by one until you find one that works. When the driver works and the virtual machine is running, you should observe that Windows Mixer shows the virtual machine as a sound source similar to the figure above.
Thanks for sharing & Its Great information. And Look on right now!
ReplyDeleteCan help you BlogSpot Blog, Sbcglobal email not working on iPhone/Mac/Phone, and Sbcglobal.net not sending and receiving emails| How to Reset My Spotify Password? How to Recover My Spotify Password?
ReplyDeleteThank you so much!
Best deals on Spy Audio Devices in Delhi from Spy Camera India; Select Spy Gadgets as your choice because we sale all types of Spy Gadgets/Devices. Get Contact Number: +91-9999332499, 999332099.