Sounds in Algodoo

Post your tutorials here.

Sounds in Algodoo

Postby uCriterion » 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
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 6.9
Filesize: 333.24 kB
Comments: 12
Ratings: 8
download

//sorry for my bad English
Last edited by uCriterion on Sat Jan 26, 2013 2:07 pm, edited 2 times in total.
uCriterion
 
Posts: 3
Joined: Fri Jan 25, 2013 9:57 pm

Re: Sounds in Algodoo

Postby faytree » Sat Jan 26, 2013 1:33 pm

hi,you're back.Does the script is safe and usable? i'm not sure!
Brother, I require your oats
User avatar
faytree
 
Posts: 921
Joined: Mon Nov 05, 2012 1:37 pm
Location: >implying that he lives in Gunma because of Initial D

Re: Sounds in Algodoo

Postby faytree » Sat Jan 26, 2013 1:38 pm

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:
Brother, I require your oats
User avatar
faytree
 
Posts: 921
Joined: Mon Nov 05, 2012 1:37 pm
Location: >implying that he lives in Gunma because of Initial D

Re: Sounds in Algodoo

Postby uCriterion » Sat Jan 26, 2013 2:06 pm

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.
uCriterion
 
Posts: 3
Joined: Fri Jan 25, 2013 9:57 pm

Re: Sounds in Algodoo

Postby Luezma » Thu Feb 28, 2013 8:06 pm

in what kind of programming language is wroten this program? Visual Basic or Visual C++?
Luezma
 
Posts: 10
Joined: Thu Dec 13, 2012 7:19 pm
Location: Argentina

Re: Sounds in Algodoo

Postby uCriterion » Sun Mar 10, 2013 6:26 pm

C++
uCriterion
 
Posts: 3
Joined: Fri Jan 25, 2013 9:57 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest