Announcement

Collapse
No announcement yet.

SoundPool for Blocks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ketterrm
    replied
    Thanks guys for looking at this. Perhaps we can have it looked at for the next release.

    Leave a comment:


  • 4634 Programmer
    replied
    Originally posted by ketterrm View Post

    We were able to use multiple formats - .wav , .mp3. however we could only get the sound file to run for a max of 6 seconds, regardless of the file size so not sure why that is the case.
    I had that problem with MediaPlayer when I was building an Android app (totally separate from FTC) a while back. Turns out you have to declare the MediaPlayer object as an instance variable rather than a local variable, because apparently if it's a local variable the sound dies when the object is garbage collected after the method returns. Perhaps the Tech Team made a similar mistake when implementing SoundPool?

    Leave a comment:


  • schaferbw
    replied
    Thanks for figuring out that important detail about /blocks plus the other useful information! The limit to six seconds may have something to do with the file be preloaded into memory.

    Leave a comment:


  • ketterrm
    replied
    First thanks for the reply - Our team has learned a lot from your youtube videos so it was great to see your reply!

    We were able to get it to work from your hint. But we had to do 2 things:

    1. The file needs to go into the directory FIRST/blocks/sounds rather than just FIRST/sounds
    2. We had to exit and restart the Robot Controller and Driver Station and restart the apps or else it didn't seem to recognize the new file.

    We were able to use multiple formats - .wav , .mp3. however we could only get the sound file to run for a max of 6 seconds, regardless of the file size so not sure why that is the case.

    Leave a comment:


  • schaferbw
    replied
    Typo correction: "the blk files go in a "sounds" directory" above should be "the wav files go in a "sounds" directory"

    Leave a comment:


  • schaferbw
    replied
    As I understand it, the blk files go in a "sounds" directory under the "FIRST" directory on your RC phone. You'll need to create the "sounds" directory before copying your wav files there.

    I just did a test, and the preloadSound block doesn't appear to be working. I'm not know whether its a bug in the SoundPool feature or in my test op mode or perhaps the wav files no longer go in the sounds directory. I hope to report back with more information soon.

    Leave a comment:


  • ketterrm
    started a topic SoundPool for Blocks

    SoundPool for Blocks

    We were attempting to use the Android SoundPool block. Where in the file system does the .wav file need to be on the Robot controller for the preloadedSound soundName?
Working...
X