|
|
Can I play a mp3 file with Flux Studio?The answer is yes and no. You can use Flux Studio to build the code that will support a mp3 file and then hand edit the output to make two or three little changes which enable the file to be played. [NOTE: This example is for an mp3 audio file, but it can also support mp3 video, real audio, mov, avi, gif89a, swf, and many other multimedia formats.] The basic steps are...
The detailed instructions are...[Advanced users skip down to the mp3 with VCR controls example at the bottom.] Have an object in the scene that you will not use a texture for. In this simplified example, I will use a box. Add a temporary texture to this object, later we will replace this filename with the mp3 file name. Add a sound to the scene by hitting the speaker icon and putting in a temporary WAV file so you can test to see that your sensor is working. Later we will delete this entire sound node section (brackets and all). Add a sensor that will start the sound (touch sensor, proximity sensor, visibility), I will use a touch sensor in this simplified example.
Temporary texture (any image will do) Temporary WAV file (any WAV will do) Touch sensor trigger code, we will edit the script that this makes later. Test your model to make sure it works, it should ;-) OK, now to dive into a little code...Export the VRML97 file as ASCII text so you can edit it. Open your exported file in your favorite text editor (*) and look the lines that match my comments in the A and B files. [NOTE: In VRML a comment is anything following a # sign. ] It should look like this.... You want to change it so it looks like this... So, read my comments in both text files, then change your file A to look like my file B. Here is a Flux Studio file if you want to examine how the initial file is set up (the A file). [NOTE: The itspider.wav file is 65KB, the itspider.mp3 file is 3KB; a big difference in download time but it gets across the same message.] You have greater control over the sound properties is you use both the MovieTexture and the Sound node. Here is an example of VCR style controls for playing, stopping, and pausing an mp3 file. * For a free text editor you can't beat www.notetab.com if you have $50 in you want the best VRML text editor you need to get VRMLpad ( www.parallelgraphics.com ). I used Goldwave (the free demo) to read in the sound file and the Lame Encoder (from the same site) to convert it to a very small MP3 file. |
|