Page 1 of 1

Sounds in Algodoo

PostPosted: Sat Jan 26, 2013 12:07 pm
by uCriterion
Hello everyone, I wrote a program to play sounds in Algodoo.



Step 1
Download program with sounds samples and unzip to %USERPROFILE%/Documents/Algodoo

Step 2
Run snd.exe together with Algodoo.

Step 3
Put the sound files that you want to use in %USERPROFILE%/Documents/Algodoo/sounds (or subfolders).

Step 4
Use script
Code: Select all
System.WriteToFile("snd.file","<file location>/<file name>.<file extension> ");

For example, open the console with "~" and enter
Code: Select all
System.WriteToFile("snd.file","glass2.wav ");

or create a box and in the field onCollide= write
Code: Select all
(e)=>{System.WriteToFile("snd.file", "materials/wood.wav ")}

File location relative to the directory %USERPROFILE%/Documents/Algodoo/sounds

Note 1
After the file extension must be one or more spaces.

Note 2
Modifiers:
Play sound if not playing System.WriteToFile("snd.file","glass2.wav ")
Stop sound if playing System.WriteToFile("snd.file","-glass2.wav ")
Stop and play sound System.WriteToFile("snd.file","*glass2.wav ")
Stop all playing sounds System.WriteToFile("snd.file","stop ")

Note 3
It is better to create a separate folder in the sounds/ for audio files from each scene

Note 4
In console You can initialize function
Code: Select all
scene.my.PlaySound:=(name)=>{System.WriteToFile("snd.file","materials/"+name+" ")}
then to play sounds in "sounds/materials/" directory enough script
Code: Select all
Scene.my.PlaySound("glass1.wav");


Rating: rated 7.2
Filesize: 333.24 kB
Comments: 17
Ratings: 13
download

//sorry for my bad English

Re: Sounds in Algodoo

PostPosted: Sat Jan 26, 2013 1:33 pm
by faytree
hi,you're back.Does the script is safe and usable? i'm not sure!

Re: Sounds in Algodoo

PostPosted: Sat Jan 26, 2013 1:38 pm
by faytree
well,nice suggestion.But can the script will make it simplified like :
Code: Select all
vel>7.90?{System.WriteToFile("snd.file", "materials/wood.wav ")}:{}

for example. :clap:

Re: Sounds in Algodoo

PostPosted: Sat Jan 26, 2013 2:06 pm
by uCriterion
1.
faytree wrote:Does the script is safe and usable?

Completely. Script System.WriteToFile writes the title of sound to "snd.file", where it reads and plays my program. No more.
2. Yeap. You can use this script.

Re: Sounds in Algodoo

PostPosted: Thu Feb 28, 2013 8:06 pm
by Luezma
in what kind of programming language is wroten this program? Visual Basic or Visual C++?

Re: Sounds in Algodoo

PostPosted: Sun Mar 10, 2013 6:26 pm
by uCriterion
C++