Hi, I’m fairly new to applescript, but i have other programming expierence.
I learned in the language C++ and you can tell the CPU to make a tone of different frequencies, I this possible in applescript?
I’ve been trying to make a song maker but can’t get tones :(.
i have my basic structure for it but i can’t get sound!
on run
display dialog "Welcome to the Uber Sound machine!
Press 'OK' to continue"
set anothersong to true
repeat while anothersong is true
set choose1 to (choose from list {"C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5"} with prompt "Choose your first note")
set time1 to the text returned of (display dialog "Enter how long you want it to play" default answer "" buttons {"OK"})
if choose1 is "C4" then
set n1 to 261.63
else if choose1 is "D4" then
set n1 to 293.66
else if choose1 is "E4" then
set n1 to 329.63
else if choose1 is "F4" then
set n1 to 349.23
else if choose1 is "G4" then
set n1 to 392
else if choose1 is "A4" then
set n1 to 440
else if choose1 is "B4" then
set n1 to 493.88
else if choose1 is "C5" then
set n1 to 523.25
end if
set choose2 to (choose from list {"C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5"} with prompt "Choose your 2th note")
set time2 to the text returned of (display dialog "Enter how long you want it to play" default answer "" buttons {"OK"})
if choose2 is "C4" then
set n2 to 261.63
else if choose2 is "D4" then
set n2 to 293.66
else if choose2 is "E4" then
set n2 to 329.63
else if choose2 is "F4" then
set n2 to 349.23
else if choose2 is "G4" then
set n2 to 392
else if choose2 is "A4" then
set n2 to 440
else if choose2 is "B4" then
set n2 to 493.88
else if choose2 is "C5" then
set n2 to 523.25
end if
set choose3 to (choose from list {"C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5"} with prompt "Choose your 3th note")
set time3 to the text returned of (display dialog "Enter how long you want it to play" default answer "" buttons {"OK"})
if choose3 is "C4" then
set n3 to 261.63
else if choose3 is "D4" then
set n3 to 293.66
else if choose3 is "E4" then
set n3 to 329.63
else if choose3 is "F4" then
set n3 to 349.23
else if choose3 is "G4" then
set n3 to 392
else if choose3 is "A4" then
set n3 to 440
else if choose3 is "B4" then
set n3 to 493.88
else if choose3 is "C5" then
set n3 to 523.25
end if
set choose4 to (choose from list {"C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5"} with prompt "Choose your 4th note")
set time4 to the text returned of (display dialog "Enter how long you want it to play" default answer "" buttons {"OK"})
if choose4 is "C4" then
set n4 to 261.63
else if choose4 is "D4" then
set n4 to 293.66
else if choose4 is "E4" then
set n4 to 329.63
else if choose4 is "F4" then
set n4 to 349.23
else if choose4 is "G4" then
set n4 to 392
else if choose4 is "A4" then
set n4 to 440
else if choose4 is "B4" then
set n4 to 493.88
else if choose4 is "C5" then
set n4 to 523.25
end if
set choose5 to (choose from list {"C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5"} with prompt "Choose your last note") -- Choose last note
set time5 to the text returned of (display dialog "Enter how long you want it to play" default answer "" buttons {"OK"})
if choose5 is "C4" then
set n5 to 261.63
else if choose5 is "D4" then
set n5 to 293.66
else if choose5 is "E4" then
set n5 to 329.63
else if choose5 is "F4" then
set n5 to 349.23
else if choose5 is "G4" then
set n5 to 392
else if choose5 is "A4" then
set n5 to 440
else if choose5 is "B4" then
set n5 to 493.88
else if choose5 is "C5" then
set n5 to 523.25
end if
set songrep to the text returned of (display dialog "How many times would you like your song to repeat? (Numbers only please)" default answer "" buttons ("OK"))
set songagain to true
repeat while songagain is true
repeat songrep times -- beep (frequencey, time played)
beep {n1, time1}
beep {n2, time2}
beep {n3, time3}
beep {n4, time4}
beep {n5, time5}
end repeat
set againhelp to (display dialog "Would you like to hear your song again?" buttons {"Yes", "No"})
if againhelp is "No" then
set songagain to false
end if
end repeat
set anothersong1 to (display dialog "Would you like to compose another song?" buttons {"Yes", "No"})
if anothersong1 is "No" then
set anothersong to false
end if
end repeat
end run
I was hoping someone could get the sound 2 work?