Saving voice input

i am making a program that says of sings what ever you put in a little box.
that part works
but i also want it to be able to save whatever is in the little box to the desktop as a .aiff
in a singing voice if a talking voice so far i have…

set fileName to "audio.aiff"
set helper_path to ((path to desktop as alias) as string) & fileName
set hi to the text returned of (display dialog "What do you want to say?" default answer "") as string
say hi using "Fred" saving to helper_path


to save as a talking file and




set fileName to “audio.aiff”
set helper_path to ((path to desktop as alias) as string) & fileName
set hi to the text returned of (display dialog “What do you want to say?” default answer “”) as string
say hi usinbg “Cellos” saving to helper_path

for saving as a singing file
niether work
something about not understanding the message

ok so i messed up the code boxes

Does this work?

set fileName to "audio.aiff"
set helper_path to ((path to desktop as text) & fileName)
set hi to the text returned of (display dialog "What do you want to say?" default answer "")
say hi using "Fred"
say hi using "Fred" saving to file helper_path

– Rob

no, but if you change the line:

set hi to the text returned of (display dialog "What do you want to say?" default answer "")

to

set hi to the text returned of (display dialog "What do you want to say?" default answer "") as text

then yes
thank you very mucho

It works both ways for me, even if a number is entered. I don’t see why the “as text” is required since the variable is set to “text returned” of the dialog.

– Rob