Applescript application call problem...

Hi all...

I am trying to create a shell project purely for this Macbook Pro.
I do NOT want to use SOX as the sampling _source_ but Quicktime
instead, the idea being that NO third party installs will be needed.

The code below works fine except the commented out Applescript line
does not do what it says on the tin...

I want to sample 1 second snatches of a signal without the small audio
recording image appearing on screen. In other words a pseudo-embedded
mode...

Does anyone know if or how this can be done?
If not then I can live with it during each snatch...

Ignore the lines below the asterisks they are for my test purposes only
and be aware of wordwrapping...

Any help would be greatly appreciated...

TIA.

#!/bin/bash
# qt.sh
cd /Users/barrywalker/Desktop/Audio
rm *.aifc >/dev/null 2>&1
sample()
{
osascript << APPLESCRIPT
	tell application "QuickTime Player"
		# set visible of process "QuickTime Player" to false
		set sample to (new audio recording)
		tell sample
			delay 1.5
			start
			delay 1.5
			stop
		end tell
		quit
	end tell
APPLESCRIPT
wait
}
sample
# *********************************************************
afconvert -f 'WAVE' -c 1 -d UI8@8000 "/Users/barrywalker/Desktop/Audio/Audio Recording.aifc" waveform.wav
ls -l waveform.wav
afplay -d waveform.wav
dd if=waveform.wav of=waveform.raw skip=4096 bs=1 count=8000
/Users/barrywalker/Downloads/sox-14.4.0/play -v 0.5 -r 8000 -b 8 -c 1 -e unsigned-integer /Users/barrywalker/Desktop/Audio/waveform.raw

What does it do, then?

Hi Corona688...

The error report is below but it is now solved anyhow and I will correct the title.

54:63: syntax error: A �"� can't go after this identifier. (-2740)
Error: Couldn't open input file (-43)

Final code inside the function:-

sample()
{
osascript << APPLESCRIPT
	tell application "QuickTime Player"
		set sample to (new audio recording)
		set visible of front window to false
		tell sample
			delay 1.5
			start
			delay 1.5
			stop
		end tell
		quit
	end tell
APPLESCRIPT
wait
}