how do I use lejos.hardware.Sound.playSample?

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

Moderators: roger, gloomyandy, skoehler

how do I use lejos.hardware.Sound.playSample?

Postby GeekDude » Thu Nov 14, 2013 12:51 am

My code isn't working, all I hear is a slight static sound coming out of the speakers. No error code. Am I using it incorrectly?

Code: Select all
import static java.lang.System.out;
import lejos.hardware.Sound;

public class FirstEV3 {
   public static void main(String[] args) {
      File myFile = new File("nyan.wav");

Edit: Also, how do you properly shut off your EV3 running lejos? From ssh I usually have to call "shutdown -h 0", but what if I turn it on by accident when it's not connected to a network?
New User
Posts: 9
Joined: Wed Nov 13, 2013 12:50 pm

Re: how do I use lejos.hardware.Sound.playSample?

Postby gloomyandy » Thu Nov 14, 2013 12:07 pm

How have you encoded your .wav file, it needs to be 8bit mono 8KHz. There are other threads on the forum about this...

At the moment you need a network connection to shut things down, or simply remove a battery...
User avatar
leJOS Team Member
Posts: 3967
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Return to EV3 Software

Who is online

Users browsing this forum: Google [Bot] and 1 guest

more stuff