Sounds in Algodoo
Posted: Sat Jan 26, 2013 12:07 pm
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
For example, open the console with "~" and enter
or create a box and in the field onCollide= write
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
//sorry for my bad English
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+" ")}
- Code: Select all
Scene.my.PlaySound("glass1.wav");
//sorry for my bad English