ROBOTC.net forums
http://robotc.net/forums/

Using custom soundfiles
http://robotc.net/forums/viewtopic.php?f=1&t=9711
Page 1 of 1

Author:  KeesSmit [ Sun Nov 02, 2014 10:24 am ]
Post subject:  Using custom soundfiles

Hi there,

I'm trying to use custom soundfiles from within RobotC. I converted a WAV-file with WAV2RSO and renamed the file-extention to RSF (I found this trick somewhere on Internet). This works fine from within EV3-software and I can play this custom soundfile directly from the EV3-brick. So the soundfile seems to be OK.

But when using this soundfile in RobotC I hear no sound and I wonder what I'm doing wrong. Here's what I've done: in the end I stored the custom soundfile in the same directory as all the original EV3 soundfiles in de RobotC environment (directory Soundfiles in EV3 System Files). Furthermore I manually uploaded the soundfile to the EV3-brick, just to be sure it's on the brick. I wrote the following testprogram:

Code:
// Custom soundfile: NoBeacon.rsf.
// File stored in directory Sounds of EV3 Systems files of RobotC (just like original EV3 soundfiles)
// Furthermore manually uploaded custom soundfile to EV3 brick in same directory as program.

void checkSoundFile(const char *pFileName)
{
   bool bExists;

   bExists = bEv3FileExists(pFileName);
   while (!bSoundQueueAvailable)
   {}
   playSoundFile(pFileName);
   return;
}

task main()
{
   setSoundVolume(30);
   checkSoundFile("One");         // Original EV3 soundfile (one.rsf), works fine
   sleep(1000);
   checkSoundFile("NoBeacon");      // Custom soundfile (NoBeacon.rsf), no sound, bExists=false
   sleep(3000);
   checkSoundFile("NoBeacon.rsf");   // Same custom soundfile, no sound, bExists=true
   sleep(3000);
}


Result when running this program:
- Soundfile One.rsf is played successfully.
- Custom soundfile is not. At the first call the soundfile is not found (bExists = false), at the second call the custom soundfile is found on the EV3-brick (bExists = true), but still there's no sound.

Anyone can help me?

Author:  KeesSmit [ Thu Jul 16, 2015 4:42 pm ]
Post subject:  Re: Using custom soundfiles

Solution was as simple as is (as it often is :D ). When you download your own soundfile *.rsf to the EV3-brick, it's placed in the directory RC. In order for the program to find this file, you have to specify the full path:

Code:
task main()
{
   setSoundVolume(30);
   checkSoundFile("/home/root/lms2012/prjs/rc/No_Beacon");      // Custom soundfile: No_Beacon.rsf
   sleep(1000);
}


Now it works fine.

Author:  mightor [ Fri Jul 17, 2015 2:40 am ]
Post subject:  Re: Using custom soundfiles

That sounds like something that could use a little improvement, I'll put it on the list :)

= Xander

Author:  tabbycatrobots [ Fri Jul 17, 2015 11:01 am ]
Post subject:  Re: Using custom soundfiles

Hi,
Thanks for posting the idea of using the full pathname. This solved my problem posted
in the topic "Downloading Sound Files". Thanks again.
Howard

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/