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 & HelpPrograms › RE: Midi sound
Page Index Toggle Pages: 1
RE: Midi sound (Read 496 times)
RE: Midi sound
May 30th, 2006, 4:15pm
 
raden wrote on May 30th, 2006, 3:42pm:
I ther

i need to make samething like this:

a worg for ex: HELLO, to appear and whem i click in a letter of the word a midi sound need to play and i dont have no ideia how i make this! please sameone can help me this is for a work for the fac, if i dont make this i will not make this class Sad


tks



In response to the question about creating sounds.

First off you need to download a sound library. For your situation Ess would be a good choice.

http://www.tree-axis.com/Ess/_distros/Ess_r1.zip

The Ess.jar file goes in a folder named "code" you sketch's folder (ideally should go in the libraries folder of your Processing executable folder though - but I'm trying not to confuse you here).

What follows is the bare minimum code to tap a key on your computer to get some noise out. The wave() command sounds like what you're looking for.

I would detail things a bit more for you but it's best you sit and play with it for an hour or so, then you know what you're doing and can feel more confident.
Quote:


Channel myChannel;
void setup(){
 // start up Ess
 Ess.start(this);
 // create a new Channel
 myChannel=new Channel();
 // set the buffer size to 5 seconds
 myChannel.initBuffer(myChannel.frames(5000));
 // generate 3 seconds of a soft triangle wave
 myChannel.wave(Ess.TRIANGLE,480,.1,0,myChannel.frames(3000));
}
void draw(){
}
void keyPressed(){
 myChannel.play();
}
// we are done, clean up Ess
public void stop() {
 Ess.stop();
 super.stop();
}



If you want to learn more about sound generation on computer you could try experimenting with Pure Data. The examples in the documentation were very informative to someone who knows little about sound like I do.
Re: Midi sound
Reply #1 - May 30th, 2006, 5:14pm
 
i ther i allready delete the other post.

tks a lot for your help but the code you post whem a run it it not appear no word in the box and whem a press a key a continuous sound play and dont stop no mather the key a press.. sorry for this but i'm need this very mutch! the objective is very simple just need to appear any word in the box qhem run the program and in each letter of that word need to play a midi sound whem i click in it.. please help me! tks a LOT!
Re: Midi sound
Reply #2 - May 30th, 2006, 10:32pm
 
Ah I see. Sorry about that. Reading your posts is a bit like reading texts from my Swedish friend when I first met her. No offence of course, she's a very good friend.

Anyhoo, text() is how you get text to appear on the screen. Experiment with the examples on the reference page.

Ess, can be a little funny I've found. I had to use myChannel.stop()  on a project I was doing recently in order to get a sample to stop playing. The code works a little differently on each machine. You get used to this the more digital work you do.

If it's being a pain then I suggest making a "patch" so that it works for the public despite being ugly under the surface. You would use millis() to make a timer in your sketch. It's not pleasant work I know, but I have to do this all the time (just recently had to patch a bug with OPENGL on Dells and one with text() under OPENGL, etc, etc - still came up with the goods though)

If you're still stuck then try posting the code you've made progress with so far. It's a lot easier to help people that way.

I personally won't be able to help because I'm exhibiting shortly but if you can show people you've had a go at trying to make it work on your own I'm sure someone else will be willing to lend a hand.
Page Index Toggle Pages: 1