Code Directory
 Visual Basic & VB.NET
New Code
GetOrgChart 2.5.3
AnyGantt JS Gantt Charts 8.6.0
AnyChart JS Charts and Dashboards 8.6.0
Multi Vendor Ecommerce Script & Apps 4.0
Magento 2 Inventory Management Extension 1.0
Yipit Clone Script - Daily Deals Software 1.0.2
Devart Excel Add-in for Oracle 1.7
Devart Excel Add-in for Freshdesk 1.7
Devart Excel Add-in for G Suite 1.7
C# QR Code Generator
Salesforce WordPress Customer Portal 3.2.0
Single Leg MLM 1.2.1
OzGIS 14.6
Quick Maps For Dynamics CRM 3.1
Job Board Software 4.2
Top Code
MCU 8051 IDE 1.4.7
shopping mall management system 1.0
WinPoker 2.02
MATLAB Support Package for Arduino (aka ArduinoIO Package) 1.0
SynaSer Serial Port Library 5.0
MLM Software 1.0.2
sipmethod 1.0
STDF file reader 1.0
Maios 1.0
School Management Script 1.0.4
jArt Java Operating System 1.0
Planyo online reservation system module 6.x-1.8
Bank Transfer 6.x-1.x-dev
Azizi search engine script PHP 4.1.10
SuperGeek Free Document OCR 2.5.6
Top Rated
VisualNEO Web 2018.12.15
Paste phpSoftPro 1.4.1
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
Realtime audio input 1.0
File ID: 83632

Realtime audio input 1.0
Download Realtime audio input 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 10.0 KB
Downloads: 7
Submit Rating:
Realtime audio input 1.0 Description
Description: I explored different options for realtime audio input (see below for a summary) before having to settling for this option. Unfortunately this solution requires Windows and the Data Acquisition toolbox. I hope to be able to report at some point that this function has been superceded by something more generally useful, so please let me know if you come across something better.

Other possibilities:
PortAudio ( seem to be the workhorse of audio input, but it's in C++, not Matlab code

PlayRec.m ( An adaptation of PortAudio for Matlab. However, support seems to have ended around 2008, and I know several people who have spent many hours failing to compile it for more recent operating systems and/or Matlab versions.

PsychPortAudio ( This may be the best option, although it requires PsychToolbox, which can be challenging to install itself. Can anyone confirm that PsychPortAudio works for realtime audio input?

In the meantime, the detailed function of tgrabaudio.m is described in its help section, copied below for convenience:

1/ Initialisation (mandatory)
tgrabaudio('start', [fs, [maxduration]])

fs = the sample-rate [default = 44100]
maxduration = the maximum delay (in seconds) that is considered an
acceptable build-up of audio samples. If this buffer is
exceeded during auditory capture, an error will be generated.

2/ Audio capture

N = the number of samples to be "grabbed".

wave = by default, stereo input [hard-wired: search the code for "addchannel" to adapt for mono input]

3/ Tidying up (mandatory)


This clears the persistent variables and stops the background audio
input. Careful, if this step is omitted, Matlab is likely to crash or
behave strangely the next time tgrabaudio is run. NB if a program that
uses tgrabaudio crashes before calling tgrabaudio('stop'), don't forget
to call tgrabaudio('stop') as soon as possible (either manually or using
Matlab's try...catch keywords).


The following code shows how to use tgrabaudio to input sound in
realtime. For demo purposes, the audio is gathered over a finite period,
reconstructed into a single variable, and then simply played back.
However, the same construction could be used for continuous processing of
audio input.

>> framesamples=160; fs=16000; totalframes=100;
>> wave=zeros(framesamples*totalframes,2);
>> pointer=1;
>> tgrabaudio('start',fs);
>> for ii=1:totalframes
>> framedata=tgrabaudio(framesamples);
>> %do realtime processing here
>> wave(pointer:pointer+framesamples-1,:)=framedata;
>> pointer=pointer+framesamples;
>> end;
>> sound(wave,fs)

License: Shareware

Related: adapt, tidying, tgrabaudio stop, quotaddchannelquot, Search, quotgrabbedquot, Stereo, hardwired, clears, persistent

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 7

More Similar Code

Panning effect is implemented for both an audio file and any audio input device such as microphone.
Panning is used in stereo recordings. Stereo recordings has two channels, left & right. The volume of the two channels are adjusted so as to create an impression of audio moving between the two channels.

Used on cellular phones to filter out
background noise. Measure the signal to noise ratio of an audio input in realtime. Pass speech but give silence where the input is noise (hiss, snap crackle and pop).

Includes a tutorial on how...

Capture audio from selected audio device.Capture audio to Wave, WMA, MP3 file format. Capture audio from selected audio input pin. for example, Line In , Microphone, Stereo Mix, Mono Mix, Aux, Video, CD Audio, Phone Line. Include VB.Net,VFP, VB ,...

Capture audio from selected audio device.
Audio Effects, including Reverb, ParamEq, WavesReverb, Gargle, Compressor, Distortion,Echo, I3DL2Reverb, Flange
Capture audio to Wave, WMA, MP3 file format.
Capture audio from selected...

Capture audio from selected audio device.
Audio mixing specific audio device with specific Speaker at same time (include support Window 7 , Window 8 and vista).
In Window 7, Window 8 and vista, support enumerate and select all available...

MVE is an acronym for Modular Virtual Engine. It provides an interface for programming and running (your own) units (virtual machines), each unit consisting of several modules (CPU, Video, Audio, Input, Drive, et cetera). Furthermore the Modular...

Capture audio from selected audio device.

Include c# , VB.Net, VFP, VB , VC++, Delphi Audio Capture, Change Pitch Sample.

Allow display waveform with left, right channel.

Customizable the waveform allow you to...

Capture audio from selected audio device.
Capture audio from Speaker. Your sound card does not need have Stereo Mix (For Window 7, Window 8 and vista)
Capture audio to Wave, WMA, MP3 file format.
Capture audio to sample grabber. provides a very neat service which allows your users to leave you audio or video comments on your blog. The interface lets your record the audio or video comment while on your site using the user's webcam and microphone if they have...

Mobile Ringtone Converter can convert / record / mix audio to Moblie Ringtone as MP3, OGG, AMR, MMF, AMRWB, WAV. Key Features: Convert audio to Mobile Ringtone as MP3, OGG, AMR, MMF, AMRWB, WAV. Can import MP3, OGG, WAV, AU, AIFF, AMR, AMR WB+...

User Review for Realtime audio input
- required fields

Please enter text on the image