I can't listen to SoundSample.java

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

Moderators: 99jonathan, roger, imaqine

I can't listen to SoundSample.java

Postby esmetaman » Tue Sep 11, 2007 8:39 pm

Hi,

I was testing SoundSample with my own wav sound in the same folder where I have the Java Class SoundSample. When I compile SoundSample.java and send SoundSample.nxj to NXTBrick I notice that the wav file doesnt sound.

What happend:

import lejos.nxt.*;
import java.io.*;


public class SoundSample {
public static void main(String [] options) throws Exception {
File f = new File("c_keepem.wav");
Sound.playSample(f,2500,2000);
Thread.sleep(2000);
}

}

Thanks
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Postby lawrie » Sun Sep 16, 2007 7:39 pm

Have you tried it with ringin.wav, which you can download from\Windows\Media (on XP)?

It will only work with 8-bit WAV files, and the second parameter (freq) sometimes needs a bit of trial and error.

The code for playing samples needs rto be improved.
lawrie
leJOS Team Member
 
Posts: 922
Joined: Mon Feb 05, 2007 1:27 pm

I was not able to run that sample

Postby esmetaman » Thu Sep 20, 2007 8:31 pm

Yes Lawrie, I tried to use that sound, but I was able to listen the sample from NXT brick. I dont know the cause.

Do you have any hipothesis?
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://www.iloveneutrinos.com/
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Postby CoBB » Fri Sep 21, 2007 9:23 am

Well, it works for me. All I need to do is upload the nxj and the wav file, and run the program.
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

upload wav file

Postby esmetaman » Fri Sep 21, 2007 2:36 pm

How do you upload wav file?

thanks.
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://www.iloveneutrinos.com/
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Postby CoBB » Fri Sep 21, 2007 9:51 pm

You can upload any file, not just .nxjs. I personally prefer using nxjbrowse for this purpose.
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

Re: I was not able to run that sample

Postby 99jonathan » Sat Sep 22, 2007 5:18 am

esmetaman wrote:Yes Lawrie, I tried to use that sound, but I was able to listen the sample from NXT brick. I dont know the cause.

Do you have any hipothesis?


was ABLE or was UNABLE?
99jonathan
Moderator
 
Posts: 122
Joined: Thu Mar 01, 2007 5:30 am

What is the sintax to upload ringin.wav?

Postby esmetaman » Sat Sep 22, 2007 9:36 am

Hi, I have never used nxjbrowse to upload .wav file. Anybody can explain me how to upload that file?

thanks.
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://www.iloveneutrinos.com/
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Postby CoBB » Sun Sep 23, 2007 7:07 pm

I don’t understand the problem. You connect to your brick as usual and choose to send a file to the brick, then pick the wav file in the dialog box instead of an nxj.
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

I was able to run the program

Postby esmetaman » Sun Sep 23, 2007 9:28 pm

Hi,

I was able to run the program.

I used the command nxjupload ringin.wav. I tested others wav sound, but Lawrie said me that currently NXT brick only listen sounds in 8bits.

I can run NXJbrowse
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://www.iloveneutrinos.com/
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Re: I was able to run the program

Postby CoBB » Mon Sep 24, 2007 11:26 am

esmetaman wrote:I used the command nxjupload ringin.wav. I tested others wav sound, but Lawrie said me that currently NXT brick only listen sounds in 8bits.

And that won't change, because it is impossible to play back 16-bit sounds on this hardware (I know because I was the one who coded the current playback routine). The only way to deal with such wav files directly would be simply ignoring every other byte, which would be a waste of space. You have to convert the sound to a low-frequency (no point in making it more than 8kHz) 8-bit mono sample yourself before sending for this reason.
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

Postby julle » Mon Nov 12, 2007 7:31 am

Hi, I'm a new programer and I wonder how I uplad soundfiles to my brick. How do I use nxjupload? How do I use nxjbrowse?
julle
New User
 
Posts: 1
Joined: Mon Nov 12, 2007 7:01 am

Postby bbagnall » Thu Nov 29, 2007 5:24 pm

You can use nxjbrowse to upload a file, or if you need to do it within your Java code you can use the File class.
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 3 guests

more stuff