Chapter33: AudioProcessing
715
Givenoptionalargumentstart,beginplayingatstartsecondsintherecording. Given
atwo-elementvectorlimits,beginandendplayingatthenumberofsecondsspecified
bytheelementsofthevector.
[FunctionFile]
playblocking
(
player
)
[FunctionFile]
playblocking
(
player
,
start
)
[FunctionFile]
playblocking
(
player
,
limits
)
Playaudiostoredintheaudioplayerobjectplayerwithblocking.
Givenoptionalargumentstart,beginplayingatstartsecondsintherecording. Given
atwo-elementvectorlimits,beginandendplayingatthenumberofsecondsspecified
bytheelementsofthevector.
[FunctionFile]
pause
(
player
)
Pausetheaudioplayerplayer.
[FunctionFile]
resume
(
player
)
Resumeplaybackforthepausedaudioplayerobjectplayer.
[FunctionFile]
stop
(
player
)
Stoptheplaybackfortheaudioplayerplayerandresettherelevantvariablestotheir
startingvalues.
[FunctionFile]
isplaying
(
player
)
Returntrueiftheaudioplayerobjectplayer iscurrentlyplayingbackaudioandfalse
otherwise.
33.3.2 Properties
Theremainingcoupleofmethodsareusedtogetandsetvariouspropertiesoftheaudio-
playerobject.
[FunctionFile]
value = get
(
player
,
name
)
[FunctionFile]
values = = get
(
player
)
Returnthevalueofthepropertyidentifiedbyname.
Ifnameisacellarrayreturnthevaluesofthepropertiesidentifiedbytheelements
ofthecellarray. Givenonlytheplayerobject,returnascalarstructurewithvalues
ofallproperties ofplayer. . Thefieldnamesofthestructurecorrespondtoproperty
names.
[FunctionFile]
set
(
player
,
name
,
value
)
[FunctionFile]
set
(
player
,
properties
)
[FunctionFile]
properties = set
(
player
)
Setthevalueofpropertyspecifiedbyname toagivenvalue.
Ifnameandvaluearecellarrays,seteachpropertytothecorrespondingvalue.Given
astructureofproperties withfieldscorrespondingtopropertynames,setthevalue
ofthosepropertiestothefieldvalues. Givenonly y the audioplayer object,returna
structureofsettableproperties.
Pdf split - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
break pdf into multiple files; break pdf file into multiple files
Pdf split - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
reader split pdf; break a pdf file
716
GNUOctave
33.4 AudioRecorder
Thefollowingmethodsareusedtocreateanduseaudiorecorderobjects.Theseobjectscan
be usedtorecordaudiodatafromvarious devices available to the system. . Youcanuse
convenient methods toretrieve that dataor audioplayerobjects createdfromthat data.
Methods for r blocking and d non-blocking recording, , pausing g and d resuming g recording and
muchmoreisavailable.
[FunctionFile]
recorder = = audiorecorder
()
[FunctionFile]
recorder = = audiorecorder
(
fs
,
nbits
,
channels
)
[FunctionFile]
recorder = = audiorecorder
(
fs
,
nbits
,
channels
,
id
)
Createanaudiorecorderobjectrecording8bitmonoaudioat8000Hzsamplerate.
Theoptionalargumentsfs,nbits,channels,andidspecifythesamplerate,bitdepth,
numberofchannelsandrecordingdeviceid,respectively. DeviceIDsmaybefound
usingtheaudiodevinfofunction.
33.4.1 Recording
Thefollowingmethodscontroltherecordingprocess.
[FunctionFile]
record
(
recorder
)
[FunctionFile]
record
(
recorder
,
length
)
Recordaudiowithoutblockingusingtheaudiorecorderobjectrecorderuntilstopped
orpausedbythestoporpausemethod.
Giventheoptionalargumentlength,recordforlengthseconds.
[FunctionFile]
recordblocking
(
recorder
,
length
)
Recordaudiowithblocking(synchronousI/O).
Thelengthoftherecordinginseconds(length)mustbespecified.
[FunctionFile]
pause
(
recorder
)
Pauserecordingwithaudiorecorderobjectrecorder.
[FunctionFile]
resume
(
recorder
)
Resumerecordingwiththepausedaudiorecorderobjectrecorder.
[FunctionFile]
stop
(
recorder
)
Stoptheaudiorecorderobjectrecorder andcleanupanyaudiostreams.
[FunctionFile]
isrecording
(
recorder
)
Returntrueiftheaudiorecorderobjectrecorderiscurrentlyrecordingaudioandfalse
otherwise.
33.4.2 DataRetrieval
Thefollowingmethodsallowyoutoretrieverecordedaudiodatainvariousways.
[FunctionFile]
data = getaudiodata
(
recorder
)
[FunctionFile]
data = getaudiodata
(
recorder
,
datatype
)
Returnrecorderaudiodataasamatrixwithvaluesbetween-1.0and1.0andwithas
manycolumnsastherearechannelsintherecorder.
Giventhe optional argument t datatype, convert t therecordeddata tothe specified
type,whichmaybeoneof"double","single","int16","int8"or"uint8".
Online Split PDF file. Best free online split PDF tool.
Online Split PDF, Separate PDF file into Multiple ones. Download Free Trial. Split PDF file. Then set your PDF file split settings. The perfect split tool.
break a pdf apart; pdf split
C# Word - Split Word Document in C#.NET
C# Word - Split Word Document in C#.NET. Explain How to Split Word Document in Visual C#.NET Application. Overview. Split Word file into two files in C#.
can print pdf no pages selected; break a pdf into smaller files
Chapter33: AudioProcessing
717
[FunctionFile]
player = = getplayer
(
recorder
)
Returnanaudioplayerobjectwithdatarecordedbytheaudiorecorderobjectrecorder.
[FunctionFile]
player = = play
(
recorder
)
[FunctionFile]
player = = play
(
recorder
,
start
)
[FunctionFile]
player = = play
(
recorder
,
[start
,
end]
)
Playtheaudiorecordedinrecorderandreturnacorrespondingaudioplayerobject.
If the optional argument t start is provided, , begin n playing start seconds in to o the
recording.
Iftheoptionalargumentendisprovided,stopplayingatendsecondsintherecording.
33.4.3 Properties
The remaining two o methods allow w you to read or alter r the properties s of audiorecorder
objects.
[FunctionFile]
value = get
(
recorder
,
name
)
[FunctionFile]
values = = get
(
recorder
)
Returnthevalueofthepropertyidentifiedbyname.
Ifname isacellarray,returnthevaluesofthepropertiescorrespondingtotheele-
mentsofthecellarray.Givenonlytherecorderobject,returnascalarstructurewith
values ofallpropertiesofrecorder. . The e fieldnamesofthestructurecorrespondto
propertynames.
[FunctionFile]
set
(
recorder
,
name
,
value
)
[FunctionFile]
set
(
recorder
,
properties
)
[FunctionFile]
properties = set
(
recorder
)
Setthevalueofpropertyspecifiedbyname toagivenvalue.
Ifnameandvaluearecellarraysofthesamesize,seteachpropertytoacorresponding
value. Givenastructurewithfieldscorrespondingtopropertynames,setthevalue
ofthosepropertiestothecorrespondingfieldvalues.Givenonlytherecorderobject,
returnastructureofsettableproperties.
33.5 AudioDataProcessing
Octaveprovidesafewfunctionsfordealingwithaudiodata. Anaudio‘sample’isasingle
outputvaluefromanA/Dconverter,i.e.,asmallintegernumber(usually8or16bits),and
audiodataisjustaseriesofsuchsamples. Itcanbecharacterizedbythreeparameters:the
samplingrate(measuredinsamplespersecondorHz,e.g.,8000or44100),thenumberof
bitspersample(e.g.,8or16),andthenumberofchannels(1formono,2forstereo,etc.).
Therearemany differentformatsfor representingsuchdata. . Currently,only y thetwo
mostpopular,linearencoding andmu-lawencoding,aresupportedbyOctave. . Thereisan
excellentFAQonaudioformatsbyGuidovanRossumguido@cwi.nlwhichcanbefoundat
anyFAQftpsite,inparticularinthedirectory /pub/usenet/news.answers/audio-fmts
ofthearchivesitertfm.mit.edu.
Octavesimplytreatsaudiodataasvectorsofsamples(non-monodataarenotsupported
yet).Itisassumedthataudiofilesusinglinearencodinghaveoneoftheextensionslinor
raw,andthatfilesholdingdatainmu-lawencodingendinau,mu,orsnd.
C# TIFF: C#.NET Code to Split Multipage TIFF File
XDoc.Tiff ›› C# Tiff: Split Tiff. C# TIFF - Split Multi-page TIFF File in C#.NET. C# Guide for How to Use TIFF Processing DLL to Split Multi-page TIFF File.
cannot select text in pdf file; break password on pdf
C# PowerPoint - Split PowerPoint Document in C#.NET
C# PowerPoint - Split PowerPoint Document in C#.NET. Explain How to Split PowerPoint Document in Visual C#.NET Application. C# DLLs: Split PowerPoint Document.
break up pdf file; break apart pdf pages
718
GNUOctave
[FunctionFile]
lin2mu
(
x
,
n
)
Convertaudiodatafromlineartomu-law.
Mu-lawvaluesuse8-bitunsignedintegers. Linearvaluesusen-bitsignedintegersor
floatingpointvaluesintherange-1x 1ifnis0.
Ifnisnotspecifieditdefaultsto0,8,or16dependingontherangeofvaluesinx.
Seealso: [mu2lin],page718.
[FunctionFile]
mu2lin
(
x
,
n
)
Convertaudiodatafrommu-lawtolinear.
Mu-lawvaluesare8-bitunsignedintegers. Linearvaluesusen-bitsignedintegersor
floatingpointvaluesintherange-1y1ifnis0.
Ifnisnotspecifieditdefaultsto0.
Seealso: [lin2mu],page717.
[FunctionFile]
record
(
sec
)
[FunctionFile]
record
(
sec
,
fs
)
Recordsecsecondsofaudiofromthesystem’sdefaultaudioinputatasamplingrate
of8000samplespersecond.
Iftheoptionalargumentfsisgiven,itspecifiesthesamplingrateforrecording.
Formorecontroloveraudiorecording,usetheaudiorecorderclass.
Seealso: [sound],page718,[soundsc],page718.
[FunctionFile]
sound
(
y
)
[FunctionFile]
sound
(
y
,
fs
)
[FunctionFile]
sound
(
y
,
fs
,
nbits
)
Playaudiodatay atsampleratefstothedefaultaudiodevice.
Theaudiosignalycanbeavectororatwo-columnarray,representingmonoorstereo
audio,respectively.
Iffs isnotgiven,adefaultsamplerateof8000samplespersecondisused.
Theoptionalargumentnbits specifiesthebitdepthtoplaytotheaudiodeviceand
defaultsto8bits.
Formorecontroloveraudioplayback,usetheaudioplayerclass.
Seealso: [soundsc],page718,[record],page718.
[FunctionFile]
soundsc
(
y
)
[FunctionFile]
soundsc
(
y
,
fs
)
[FunctionFile]
soundsc
(
y
,
fs
,
nbits
)
[FunctionFile]
soundsc
(...,
[ymin
,
ymax]
)
Scaletheaudiodatay andplayitatsampleratefstothedefaultaudiodevice.
Theaudiosignalycanbeavectororatwo-columnarray,representingmonoorstereo
audio,respectively.
Iffs isnotgiven,adefaultsamplerateof8000samplespersecondisused.
Theoptionalargumentnbits specifiesthebitdepthtoplaytotheaudiodeviceand
defaultsto8bits.
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
C# PDF - Merge or Split PDF File in C#.NET. C#.NET Q 2: The target PDF document that I need to split is password-protected. Can I
break apart pdf; acrobat separate pdf pages
VB.NET PDF Library SDK to view, edit, convert, process PDF file
Tell VB.NET users how to: create a new PDF file and load PDF from other file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy
can't select text in pdf file; pdf will no pages selected
Chapter33: AudioProcessing
719
Bydefault, y isautomatically y normalizedtothe range[-1,1]. . If f the range [ymin,
ymax]isgiven,thenelementsofy thatfallwithintherangeyminy ymax are
scaledtotherange[-1,1]instead.
Formorecontroloveraudioplayback,usetheaudioplayerclass.
Seealso: [sound],page718,[record],page718.
[FunctionFile]
y = = wavread
(
filename
)
[FunctionFile]
[y, fs, , nbits] = = wavread
(
filename
)
[FunctionFile]
[...] = wavread
(
filename
,
n
)
[FunctionFile]
[...] = wavread
(
filename
,
[n1n2]
)
[FunctionFile]
[...] = wavread
(...,
datatype
)
[FunctionFile]
sz = wavread
(
filename
,
"
size
"
)
[FunctionFile]
[n_samp, n_chan] = = wavread
(
filename
,
"
size
"
)
ReadtheaudiosignalyfromtheRIFF/WAVEsoundfilefilename.
Ifthefilecontainsmultichanneldata,thenyisamatrixwiththechannelsrepresented
ascolumns.
Ifnisspecified,onlythefirstnsamplesofthefilearereturned.If[n1n2]isspecified,
onlytherangeofsamplesfromn1 ton2isreturned. . AvalueofInfcanbeusedto
representthetotalnumberofsamplesinthefile.
Iftheoption"size" isgiven,thenthesizeof theaudiosignalis returnedinstead
ofthedata. Thesizeisreturnedinarowvectoroftheform[samples s channels]. . If
therearetwooutputarguments,thenumberofsamplesisassignedtothefirstand
thenumberofchannelsisassignedtothesecond.
Theoptionalreturnvaluefs isthesamplerateoftheaudiofileinHz. . Theoptional
returnvaluenbitsisthenumberofbitspersampleasencodedinthefile.
Seealso: [audioread],page713,[audiowrite],page713,[wavwrite],page719.
[FunctionFile]
wavwrite
(
y
,
filename
)
[FunctionFile]
wavwrite
(
y
,
fs
,
filename
)
[FunctionFile]
wavwrite
(
y
,
fs
,
nbits
,
filename
)
Writetheaudiosignaly totheRIFF/WAVEsoundfilefilename.
Ify isamatrix,thecolumnsrepresentmultipleaudiochannels.
Theoptionalargumentfs specifiesthesamplerateoftheaudiosignalinHz.
The optional argument nbits s specifies the number of bits per sample to o write e to
filename.
Thedefaultsamplerateis8000Hzandthedefaultbitdepthis16bitspersample.
Seealso: [audiowrite],page713,[audioread],page713,[wavread],page719.
C# PDF Library SDK to view, edit, convert, process PDF file for C#
Tell C# users how to: create a new PDF file and load PDF from other file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy and
acrobat split pdf; pdf insert page break
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Jpeg. Convert PDF to Png, Gif, Bitmap Images. File and Page Process. File: Merge, Append PDF Files. File: Split PDF Document. File
pdf file specification; break pdf into multiple documents
Chapter34: ObjectOrientedProgramming
721
34 ObjectOrientedProgramming
Octaveincludesthecapabilitytoincludeuserclasses,includingthefeaturesofoperatorand
functionoverloading. Equallyauserclasscanbeusedtoencapsulatecertainpropertiesof
theclasssothattheycannotbealteredaccidentallyandcanbesetuptoaddresstheissue
ofclassprecedenceinmixedclassoperations.
Thischapter discussionsthemeans ofconstructingauser classwiththeexampleofa
polynomialclass,howtoqueryandsetthepropertiesofthisclass,togetherwiththemeans
tooverloadoperatorsandfunctions.
34.1 CreatingaClass
Weuseinthefollowingtextapolynomialclasstodemonstratetheuseofobjectoriented
programmingwithinOctave. Thisclasswaschosenasitissimple,andsodoesn’tdistract
unnecessarilyfromthediscussionoftheprogrammingfeaturesofOctave.However,evenstill
asmallunderstandofthepolynomialclassitselfisnecessarytofullygraspthetechniques
described.
Thepolynomialclassisusedtorepresentpolynomialsoftheform
a
0
+a
1
x+a
2
x
2
+:::a
n
x
n
wherea
0
,a
1
,etc.areelementsof<. Thusthepolynomialcanberepresentedbyavector
a = = [a0, a1, , a2, , ..., an];
Wethereforenowhavesufficientinformationabouttherequirements oftheclass con-
structorforourpolynomialclasstowriteit. AllobjectorientedclassesinOctave,mustbe
containedwithadirectorytakingthenameoftheclass,prependedwiththe@symbol.For
example,withourpolynomialclass,wewouldplacethemethods definingtheclassinthe
@polynomialdirectory.
Theconstructoroftheclass,musthavethenameoftheclassitselfandsoinourexample
theconstructor withhave the name @polynomial/polynomial.m. . Alsoideally y whenthe
constructoriscalledwithnoargumentstoshouldreturnavalueobject.Soforexampleour
polynomialmightlooklike
## -*- texinfo -*-
## @deftypefn n {Function n File} {} polynomial ()
## @deftypefnx {Function File} {} polynomial (@var{a})
## Create e a a polynomial object representing g the e polynomial
##
## @example
## a0 + a1 * * x x + a2 * x^2 + @dots{} + + an n * * x^n
## @end example
##
## @noindent
## from a a vector r of coefficients [a0 a1 a2 2 @dots{} } an].
## @end deftypefn
function p = = polynomial (a)
722
GNUOctave
if (nargin == 0)
p.poly = = [0];
p = class (p, "polynomial");
elseif (nargin == 1)
if (strcmp (class (a), , "polynomial"))
p = = a;
elseif (isvector r (a) ) && isreal l (a))
p.poly = = a(:).’;
p = = class (p, , "polynomial");
else
error ("polynomial: expecting real vector");
endif
else
print_usage ();
endif
endfunction
Notethatthereturnvalueoftheconstructormustbetheoutputoftheclassfunction
calledwiththefirstargumentbeingastructureandthesecondargumentbeingtheclass
name.Anexampleofthecalltothisconstructorfunctionisthen
p = = polynomial ([1, 0, 1]);
Notethat methods ofa class can n bedocumented. . Thehelpfor r theconstructoritself
canbe obtainedwiththeconstructorname, thatis forthe polynomialconstructor help
polynomialwillreturnthe helpstring. . Alsothehelpcanbeobtainedbyrestrictingthe
searchforthehelptoaparticularclass,forexamplehelp@polynomial/polynomial. This
secondmethodistheonlymeansofgettinghelpfortheoverloadedmethodsandfunctions
oftheclass.
ThesameistrueforotherOctavefunctionsthattakeafunctionnameasanargument.
Forexampletype@polynomial/displaywillprintthecodeofthedisplaymethodofthe
polynomialclasstothescreen,anddbstop@polynomial/displaywillsetabreakpointat
thefirstexecutablelineofthedisplaymethodofthepolynomialclass.
Tocheckwhereavariableisauserclass,theisobjectandisafunctionscanbeused.
Forexample:
p = = polynomial ([1, 0, 1]);
isobject (p)
) 1
isa (p, "polynomial")
) 1
[Built-inFunction]
isobject
(
x
)
Returntrueifx isaclassobject.
See also: [class],page 39[typeinfo], page39,[isa], page39,[ismethod], page 723,
[isprop],page357.
Theavailablemethodsofaclasscanbedisplayedwiththemethodsfunction.
Chapter34: ObjectOrientedProgramming
723
[FunctionFile]
methods
(
obj
)
[FunctionFile]
methods
(
"classname"
)
[FunctionFile]
mtds = methods
(...)
Returnacellarraycontainingthenames ofthemethods fortheobject obj or the
namedclassclassname.
objmaybeanOctaveclassobjectoraJavaobject.
Seealso: [fieldnames],page109.
Toinquirewhetheraparticularmethodisavailabletoauserclass,theismethodfunction
canbeused.
[Built-inFunction]
ismethod
(
obj
,
method
)
Returntrueifobjisaclassobjectandthestringmethodisamethodofthisclass.
Seealso: [isprop],page357,[isobject],page722.
Forexample:
p = = polynomial ([1, 0, 1]);
ismethod (p, , "roots")
)
1
34.2 ManipulatingClasses
Thereareanumberofbasicclassesmethodsthatcanbedefinedtoallowthecontentsofthe
classestobequeriedandset.Themostbasicoftheseisthedisplaymethod.Thedisplay
methodisusedbyOctavewhendisplayingaclassonthescreen,duetoanexpressionthat
isnotterminatedwithasemicolon.Ifthismethodisnotdefined,thenOctavewillprinted
nothingwhendisplayingthecontentsofaclass.
[FunctionFile]
display
(
a
)
Displaythecontentsofanobject.
Ifaisanobjectoftheclass"myclass",thendisplayiscalledinacaselike
myclass (...)
whereOctaveisrequiredtodisplaythecontentsofavariableofthetype"myclass".
Seealso: [class],page39,[subsref],page726,[subsasgn],page728.
Anexampleofadisplaymethodforthepolynomialclassmightbe
function display (p)
a = p.poly;
first = = true;
fprintf ("%s s =", inputname (1));
for i = = 1 1 : length h (a);
if (a(i) ) != 0)
if (first)
first = = false;
elseif (a(i) ) > > 0)
fprintf (" " +");
724
GNUOctave
endif
if (a(i) < 0)
fprintf (" " -");
endif
if (i == 1)
fprintf (" " %g", , abs s (a(i)));
elseif (abs(a(i)) != 1)
fprintf (" " %g *", abs (a(i)));
endif
if (i > 1)
fprintf (" " X");
endif
if (i > 2)
fprintf (" " ^ ^ %d", , i - 1);
endif
endif
endfor
if (first)
fprintf (" 0");
endif
fprintf ("\n");
endfunction
Notethatinthedisplaymethod,itmakessensetostartthemethodwiththelinefprintf
("%s=",inputname(1))tobeconsistentwiththerestofOctaveandprintthevariable
nametobedisplayedwhendisplayingtheclass.
TobeconsistentwiththeOctavegraphichandleclasses,aclass shouldalsodefinethe
getandsetmethods.Thegetmethodshouldacceptoneortwoarguments,andgivenone
argumentoftheappropriateclassitshouldreturnastructurewithallofthepropertiesof
theclass. Forexample:
function s = = get t (p, , f)
if (nargin == 1)
s.poly = = p.poly;
elseif (nargin == 2)
if (ischar (f))
switch (f)
case "poly"
s = p.poly;
otherwise
error ("get: : invalid property %s", f);
endswitch
else
error ("get: expecting the property to be a string");
endif
else
print_usage ();
Documents you may be interested
Documents you may be interested