• Post Reply Bookmark Topic Watch Topic
  • New Topic

MIDI assignment  RSS feed

 
J Han
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been assigned hits Java-MIDI project by my professor. I'm not even sure where to begin, really...It has 5 parts(programs)

The first is this...."Write a program to make a sound of a given pitch and length"

I'm assuming this program needs to prompt the user for a note, octave, and number of beats, or something like that. I know a little about midi; how you have to import the midi package, make a sequencer, sequence, track, etc.

What I realized I have no idea how to do is get input from the user? C has the simple "scanf" command but I didn't see anything like that for Java.

Java is only like, 2 months old for me (and C is about 3 weeks), so bear with me...

Help?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can read from the console with System.in. Wrap it with a BufferedReader so you can read a line at a time. Everyone has to ask, but no, there is no way to read single characters or keystrokes.

I'd start on the guts of the thing - making notes - and worry about the input later. To do that, make a test harness program that exercises the MIDI stuff.

I haven't done MIDI for about 15 years and that was in Pascal. Hope those ideas are close to the APIs that Java has! Show us what you come up with.
 
J Han
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone else? Head First Java said this was a "very active" forum
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

It is an active forum, but you have to ask a question first. "I have no idea how to do input" isn't really a question. People on forums like this love to help out by answering specific questions, and by critiquing code. They don't like to waste time duplicating stuff that's in easy-to-find publically available documentation. See my signature for a link to our guide to getting good answers here on the Ranch.

Anyway: so have you read "Head First Java"? Is there nothing in there about reading input? (Maybe there isn't. ) If there isn't, then Sun's free Java Tutorial is a great place to learn the basics of just about anything Java-related, with decent examples. You'll learn about console I/O in there. In Java 5, there actually is a class named java.util.Scanner which makes console input much easier than it's traditionally been. It's Javadoc page gives some simple usage examples.

Regarding Java and MIDI: Have you Googled "Java MIDI?" There's a "Java Media API" which you'll want to learn about.

Good luck! C'mon back when you have some more specific questions to ask.
 
J Han
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wasn't insulting the forum I was just wondering if there was any more input before I dove into this

I'll keep everyone posted...

[ September 15, 2005: Message edited by: J Han ]
[ September 15, 2005: Message edited by: J Han ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!