Sound files in EV3 are stored in .rsf format.
There is a command line utility wavrsocvt that allows you to convert wav to rso files (this was the format for the old NXT kits). The format still works with EV3, but the file needs to be simply renamed to be .rsf file. The maximum file size accepted by wavrsocvt is 64Kbs.
You can use an online conversion tool to create a wav file of an acceptable size. I used this one:
https://www.online-convert.com/
To reduce the file size to less than 64Kbs:
1) select less than 8 seconds of the sound file you want.
2) change the bit rate and the sampling rate to lowest values.
After the conversion is complete run your file through wavrsocvt to get .rso file. Rename .rso file to .rsf file to upload to your EV3 brick. To upload the file to the EV3 brick use the BT_upload_file(dest, src) API call. (To be visible from the brick navigation window, the file should be placed in a subfolder inside /home/root/lms2012/apps, /home/root/lms2012/prjs or /home/root/lms2012/tools. The subfolder is created automatically if it is included in the destination path).
Use BT_play_sound_file(path, volume) API call to play the file.
No comments:
Post a Comment