Sounds on new Build

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Sounds on new Build

Postby Adun » Mon Jan 14, 2008 6:18 pm

I have never gotten sounds to work on the NXT. On v 0.4 I atleast got it to beep for the duration of the file, but on .5 I cannot even get it to play. How to I get the sounds to play? The file is about 35kb, 8bit mono at 64kHs sample rate and 64kbps bitrate. What do I need to do to the file to get it to play?

-kthxbai
<(^o^)>
Adun
New User
 
Posts: 9
Joined: Wed Oct 17, 2007 10:37 pm

Postby bbagnall » Fri Feb 01, 2008 12:34 am

Hi Adun, You should be able to play a sound file using the following code:
Code: Select all
public static void main(String[] args) throws Exception {
   java.io.File sample = new java.io.File("ringin.wav");
   Sound.playSample(sample, 5000);
   Thread.sleep(5000);
}


The example above uses the ringin.wav file found in the Windows media directory. Keep in mind the sound code is preliminary still and doesn't sound very good.
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests

more stuff