Starting a tool with Applescript

edited December 1969 in Electroacoustics Toolbox
Cheers,

I am trying to automate a few measurements, for now specifically i want to plot THD+N and THD vs. frequency.

I can create a signal generator tool with
set siggen to make new signal generator tool with properties {id:"siggen"}

and then set the properties I need and enable the signal I need, but when i try to start the tool with
tell siggen to start

it appears started, but does not output a signal.

If I manually stop and start it on the generator window, then it begins to output my signal.  The documentation in applescript specifically states:
running (boolean) : Specifies whether the tool is currently running (sending or receiving data). Setting this value to 'true' (or using the start command on this object) does not start the selected device.

but I cannot see how I could actually start the output.  I have the same issue trying to start the FFT analyzer.

any ideas?
-pjotr

Comments

  • Just as you quoted from the documentation, starting a tool does not start the selected output device, so you need to tell the appropriate device to start.

    Here's a sample script that picks the first available output device on the system, and outputs a 1 kHz tone on that device:
    tell application "Electroacoustics Toolbox"
	activate
	create new project
	set devList to name of devices
	
	-- make sure there is at least one device connected to the system
	if (count of devList) is greater than 1 then
		-- make sure there is at least one device with output channels connected to the system
		-- pick the first output device found
		set foundOutputDevice to false
		repeat with i from 1 to count of devList
			set dev to device (item i of devList)
			if (count of output channels of dev) is greater than 0 then
				set foundOutputDevice to true
				exit repeat
			end if
		end repeat
		
		if foundOutputDevice then
			set sigGen to make new signal generator tool with properties {id:"siggen"}
			tell sigGen
				set selected device to dev
				set periodic signal A enabled to true
			end tell
			tell dev to start
			tell sigGen to start
		else
			display dialog "There are no devices with output channels available on your system. Please connect an audio output device and try again."
		end if
	else
		display dialog "There are no devices available on your system. Please connect an audio device and try again."
	end if
end tell
    
Sign In or Register to comment.

We use cookies and similar tracking technologies on our website. This enables us to enhance your experience, provide certain website features and functions, and to improve the services we offer. Learn more in our Privacy Policy.