Chapter 9 - Sound Help?

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

Moderators: 99jonathan, roger, imaqine

Chapter 9 - Sound Help?

Postby KennyMcCormick » Tue Aug 26, 2008 9:11 pm

I am having trouble using iCommand to play custom rso. files on the NXT.

iCommand - 0.7
leJOS - 0.6
eclipse - ganymede

This is a section of my program:

NXTCommand.open();
File myFile = new File("Red.rso");
FileSystem.upload(myFile);
Sound.playSoundFile(myFile.getName());
NXTCommand.close();

I run the program and it downloads Red.rso on my nxt but plays nothing.

I run it again and it says on PC:

Properties location: C:\Documents and Settings\TEMP\icommand.properties
BlueCove version 2.0.2 on widcomm
BlueCove stack shutdown completed

And on NXT:

Java Exception:
Class: 8
Method: 35
PC: 8753

I am using Windows XP

What do I have to do?



:!: :?: :idea: :arrow:
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby gloomyandy » Tue Aug 26, 2008 9:42 pm

Hi,
It looks like you have leJOS installed on your NXT. leJOS does not understand .rso files. Try installing the Lego firmware and see if that works...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3643
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby KennyMcCormick » Tue Aug 26, 2008 11:16 pm

Yes, I do have leJOS installed.

I'll check it out and respond back.

Thanks
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby bbagnall » Wed Aug 27, 2008 5:55 pm

Andy is correct. If you want to run this example using leJOS NXJ on your NXT brick, you need to alter the code so that it doesn't convert the WAV file to an RSO file. leJOS has the capability to play WAV files natively with Sound.playSample().
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby KennyMcCormick » Thu Aug 28, 2008 12:53 am

Your post helped me. The only problem is, I don't understand how to use leJOS or iCommand to make the program work. I have changed the rso file to a wav file with Wav2Rso software. I still don't understand how to make the program play the file. I tried out my other wav file and also ringin.wav

I checked out these 3 links but I still need help:

http://lejos.sourceforge.net/forum/viewtopic.php?p=3763&highlight=#3763
http://lejos.sourceforge.net/forum/viewtopic.php?p=2291&highlight=#2291
http://lejos.sourceforge.net/forum/viewtopic.php?p=1308&highlight=#1308

Thanks. :? [/url]
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby gloomyandy » Fri Aug 29, 2008 5:22 pm

Hi Kenny,
Just to re-iterate if you want to use ICommand you may well be better off running the standard Lego firmware on your nxt (it is easy to re-install it), rather than leJOS.

If you just want to test your wav file on leJOS. Then do the following...
1. Create the wav file on your PC.
2. Use nxjbrowse to upload the .wav file to your nxt.
3. Use the menu on the nxt to select the file and play it.
4. If it does not play check the volume settings on your nxt, they are in the sound menu set the volume to around 8 and try again.

If you are still having problems playing the file then post details of the file size, audio encoding and bit rates here.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3643
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby KennyMcCormick » Fri Aug 29, 2008 6:45 pm

I'm still having problems:

1. I uploaded the rso file Red.rso from the Lego NXT-G software and used Wav2Rso to change it to wav.
2. I used nxjbrowse to upload the wav file to the NXT.
3. I used the menu on the nxt to select the file and play it, and it said the word red. That's good.

I tried it with a different wav file that I got from a webpage as a mp3 and converted it to a wav, but it doesn't play. Why?

Also, how do you play the sound file in a program?

Thank you.
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby gloomyandy » Fri Aug 29, 2008 9:06 pm

Hi,
Take a look at SoundSample in the samples directory.

The wav file needs to be mono, PCM, 8 bits per sample with a bit rate of between 8 and 20KHz (around 11KHz is a good rate to use). Note however that some conversion programs add extra data into the wav file and these will prevent the file from playing with leJOS 0.6. The next release will be able to ignore this extra data. You may be able to remove the extra data by converting the wav file to rso and then back again...

Andy
Last edited by gloomyandy on Mon Sep 01, 2008 5:22 pm, edited 1 time in total.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3643
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby bbagnall » Mon Sep 01, 2008 4:35 pm

KennyMcCormick wrote:I'm still having problems:

1. I uploaded the rso file Red.rso from the Lego NXT-G software and used Wav2Rso to change it to wav.


Wav2Rso converts a WAV file into an RSO file, not the other way around. As I mentioned before, you do NOT want to do any conversion. If you are using leJOS NXJ on your NXT brick, just upload a WAV file to the brick and you can play it using Sound.playSample().

So assuming you are trying the project in Chapter 9, you want to alter the code so that it no longer uses Wav2Rso in order to convert the sound file.
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby KennyMcCormick » Mon Sep 01, 2008 5:20 pm

I understand that.

What I don't understand is how some wavs work for me and other wavs don't.

Why?
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby gloomyandy » Mon Sep 01, 2008 5:22 pm

Perhaps if you read my last post to you, you would understand why...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3643
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby KennyMcCormick » Mon Sep 01, 2008 5:41 pm

I have read it and am trying to work it out.
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby KennyMcCormick » Mon Sep 01, 2008 10:05 pm

Ok, I uploaded a wav file from the internet and I tried to convert it through wav to rso.

It gave me this message: wav must be pcm

So I converted it to a pcm wav file, also mono, and 8 bits.

It said: Successful!

Then I converted it back to a wav.

I opened Command Prompt, typed in nxjbrowse, connected to the NXT, uploaded the file and tried to play it but it didn't play. My volume is set to 8 and click volume is set to 2.

Did I download it wrong? Or is it the wav file wrong altogether?
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Postby gloomyandy » Mon Sep 01, 2008 10:40 pm

It may have some extra data sections in it. But I can't be sure without taking a look at the file. The next version of leJOS is more tolerant of different wav file formats. If you send me the converted file I'll take a look at it.... (andy at gloomy-place dot com).

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3643
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby KennyMcCormick » Tue Sep 02, 2008 12:30 am

Thanks to everyone who posted to this forum! :)

I realized there is a 1-2 second wait before it plays the sound.

Before it didn't work at all, but now it does!

Thanks again! :D
Pfmmmmfmfpmf Fppmffmpppfffmmppmmmm mppmmmfmpfmm pfmppfppfpfm!
KennyMcCormick
New User
 
Posts: 17
Joined: Tue Aug 26, 2008 8:54 pm

Next

Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider], ljdedseyrooov and 2 guests

more stuff