Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:



Spectrum Analyzer

Signal Generator

(Absolutely FREE!)


Pitch Tracker


DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Spectral Event

    MHz Frequencies

Data Logger

Waveform Averager


Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls


Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording



Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery


Product test

Contact us about
your application!

File Path and Name Macros

Macros: GetFilePath, FileName

Some macro operations that save or load files may need to use a file name and path that is not known ahead of time, instead allowing the user to select it from a File Open dialog. For example, the WAV_to_Mono Stereo-to-Mono macro allows you to select a stereo .WAV file, which it then opens, adds the two data channels together and divides by 2 to get mono, and saves as a new file with a variant of the same name.

It does this with Macro Arrays Buf0 and Buf1 using Macro Array File Operations to operate on 1024 samples at a time. The macro uses Buf0="<LoadWAV:" (with no A. prefix and no filename specified after the colon) to invoke an Open dialog for file selection. (It first sets Buf0#N=0 to specify a "dummy" open that tests for existence and returns the number of channels it reads from the WAV header.) If the file is stereo (IF.Buf0?N=2), the macro uses GetFilePath=1 to save a copy of the full file path, including name and extension.

GetFilePath options are:

    1 = Copy most-recently opened or loaded file path.
    2 = Copy most-recently saved file path.
    0 = Clear the copy.

Once the path is copied, various portions of the path or name can be inserted into string expressions via the FileName read-only macro, typically with a '?' followed by a query character:

    FileName = Insert entire path, name, and extension.
    FileName?p = Insert path only.
    FileName?P = Insert path and name only.
    FileName?n = Insert name only.
    FileName?N = Insert name with extension.
    FileName?E = Insert extension only, without period.

The WAV_to_Mono macro saves a mono file of the original name, but with a '_1' appended. For example, if the selected stereo file is MyFile.WAV, the mono version will be MyFile_1.WAV. This is specified via:

    A.Buf1="<LoadWAV:" + FileName?P + "_1"

The 'P' option specifies the path plus name (without file extension), to which is added "_1". The path is needed in case the originally-selected file is not in Daqarta's own User_Data folder; the mono version will be stored in the same folder as the original. The .WAV file extension isn't needed since it is implicit in the LoadWAV (and subsequent SAveWAV) commands.

You can likewise use GetFilePath with the proper 1 or 2 parameter, followed by FileName with the desired query character, to obtain the names and/or paths of files opened with the toolbar DD/Open, or saved as DDisk or single-screen .DQA, .WAV, .DAT, or .TXT format. This also works for all other file types such as .GEN, .CAL, .FRD, .CRV, .LIM, .PAL, .MID, .DQM, etc.

Note that these commands refer only to files actually opened or saved. You can't, for example, use them to get the filename entered into a File Open dialog if the file wasn't found, and hence not opened.

See also Macro Overview


Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved