DPlot provides FFT and histogram functions which are very easy to use.
Here is a step-by-step example:
! open a wav file "tada.wav" from Windows media directory Doc_num=FNDplot_doc_open(FNDplot_getsfpath$("CSIDL_WINDOWS","Media",0)&"\tada.wav") Dummy=FNDplot_send_cmd("[Color(1,0,0,255)]") ! curve 1 = blue |
Dummy=FNDplot_send_cmd("[SelectCurve(1)]") ! select Curve 1 = left channel Dummy=FNDplot_send_cmd("[FFT()]") ! the FFT command creates a *new* document |
! get the document number of the newly created document as a reference Doc_num2=VAL(FNDplot_request$("","LastNewDocNum")) ! ! activate this document for subsequent commands Dummy=FNDplot_doc_activ(Doc_num2) Dummy=FNDplot_send_cmd("[Color(1,255,0,0)]") ! FFT curve = red |
! show the diagram, 100% screen size CALL Dplot_show(Doc_num2)
.. which should give the following result*: |
! activate the document containing the wav data for subsequent commands Dummy=FNDplot_doc_activ(Doc_num) Dummy=FNDplot_send_cmd("[SelectCurve(1)]") ! select Curve 1 = left channel ! make histogram of this curve (a new document will be created) Dummy=FNDplot_send_cmd("[Histogram(0.020)]") |
! get the document number of the newly created document as a reference Doc_num3=VAL(FNDplot_request$("","LastNewDocNum")) ! ! activate this document for subsequent commands Dummy=FNDplot_doc_activ(Doc_num3) Dummy=FNDplot_send_cmd("[Color(1,0,255,0)]") ! histogram curve = green Dummy=FNDplot_send_cmd("[BarChartStyle(0x00000808)]") ! shaded bars, percentage labels Dummy=FNDplot_send_cmd("[FillStyle(1,1)]") |
! show the diagram, 100% screen size CALL Dplot_show(Doc_num3)
.. which should give the following result*: |
Dummy=FNDplot_doc_close(Doc_num) ! close the document 1 Dummy=FNDplot_doc_close(Doc_num2) ! close the document 2 Dummy=FNDplot_doc_close(Doc_num3) ! close the document 3 |
|
* On Windows Vista the results may differ from the results shown here since Vista uses 44.1 kHz wav files where earlier Windows versions uses 22 kHz wav files.