We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › error: "expecting SEMI found....."
Page Index Toggle Pages: 1
error: "expecting SEMI found....." (Read 833 times)
error: "expecting SEMI found....."
Apr 24th, 2007, 6:39am
 
Hi all,

still a beginner.... and I am getting this error and I can't locate the missing semicolon "expecting SEMI found lines"......is there a special way to "look" at the code when sth. like that happens?

And before I get stuck with this code another time, here is my plan and I would like to ask you if this will work:

I want the soundfiles to be picked up randomly after a mouse click...will that work or if not, what do I need to change??

int numLines = 3
string [] lines = {

"file1.wav",
"file2.wav",
"file3.wav",
}

void setup () {
size (200,200);
background (50)
}
void mouseClicked () {
 int i = 0;
 while (i < numLines);
 {
   int rand = (int)random(0, lines.length);
   
   String audiofile = lines [rand];
   Sample samp = new Sample(audiofile);
   samp.play ();
   i++;
 }
}

Many thanks in advance,

clicker
Re: error: "expecting SEMI found....."
Reply #1 - Apr 24th, 2007, 9:53am
 
Code:
 int numLines = 3; // ; <--
string [] lines = {
"file1.wav",
"file2.wav",
"file3.wav" // no comma here
}; // ; <--

void setup () {
size (200,200);
background (50); // ; <--
}
void mouseClicked () {
int i = 0;
while (i < numLines) // no ; here or it'll not work
{
int rand = (int)random(0, lines.length);

String audiofile = lines [rand];
Sample samp = new Sample(audiofile);
samp.play ();
i++;
}
}
Re: error: "expecting SEMI found....."
Reply #2 - Apr 24th, 2007, 11:38pm
 
Thanks for your reply...but i have new errors going on, saying

JSyn using native library JSynV142

PortAudio on WMME - Latency = 18432 frames, 417 msec

Input Device #0: Microsoft Soundmapper - Input has 2 channels

Input Device #2: Microsoft Soundmapper - Output has 2 channels


....please see sketch below:

import pitaru.sonia_v2_9.*;

int numLines = 3;
String [] lines = {

"file1.wav",
"file2.wav",
"file3.wav"
};

void setup () {
size (200,200);
background (32);
Sonia.start(this);
}
void stop(){
 Sonia.stop();
 }
void mouseClicked () {
int i = 0;
while (i < numLines)
{
int rand = (int)random(0, lines.length);
 
String audiofile = lines [rand];
Sample samp = new Sample(audiofile);
samp.play ();
i++;
 }
}
Page Index Toggle Pages: 1