Re: was: HELP!
Re: was: HELP!
- Subject: Re: was: HELP!
- From: Jeff Moore <email@hidden>
- Date: Thu, 31 Aug 2006 09:52:25 -0700
On Aug 30, 2006, at 7:27 PM, Steve Majewski wrote:
On Aug 30, 2006, at 8:58 PM, jbrave wrote:
Hmm - forgive my ignorance of the deeper aspects of OS X, but
couldn't someone write a little C proggy that waits for midi
inputs, and stores the result somewhere that his applesscript could
check - like a text file with a flag 0 if none, keypress, 1 if
there is, followed by the note #, his script would launch the
program which would run in the background, and then his script
would just check the text file periodically? Is that really
impossible to do? Then he could just hire someone to write the
little app for him, and he could continue writing his script,
without having to learn the nitty gritty of java etc?
I didn't say, nor did I mean to imply, that it was impossible.
Actually, I think it may very well be impossible given the parameters
laid out in the original post without doing some deep coding. Granted,
I'm not totally up on what all AppleScript can do, but the solution
presented by the original post is totally unworkable. Hence my and Mr.
Majewski's answer.
BTW, storing the info in a file isn't any better than forking another
process. It has the same sort of limitations.
The "No" was in response to his very specific question:
So, being that I'm no C, C++, Obj C or Java programmer is there
anyway to easily create a command line executable that can be
called from AppleScript's 'do shell script' command to:-
1. run in the background waiting for a key press
2. return the decimal value of the key pressed
3. exit/quit
No -- There's not an easy way for a non-(whatever)-programmer to
write that program,
and if it were written to those specifications, it also might not
quite work as required.
But perhaps I was trying too subtly to imply what Jeff Moore just
simply said:
Perhaps you ought to step back and explain what you are trying to
do and perhaps folks can chime in on ways to make it work.
The original poster seemed impatient in his second message, that no-
one had yet answered the
question in his first message a day earlier. I suspect that one
reason for the initial silence was
the way he asked the question, and that since "No" doesn't seem like
a very useful answer,
most people are likely to just not reply at all. ( And since I
didn't want to leave it at just "No"
myself, I tried to describe the easiest path that came to mind, even
if it doesn't fit his stated
requirements. )
Amen. I have yet to see an answer to this query. All I've seen is a
tiny window where the original post suggested a specific solution
without providing the details as to what the actual problem is. For
example, what is the program trying to do? Why does it need to
interface to the MIDI hardware? Why does it need to do it in this
awkward way?
One other thing I'll throw out there: Back in OS 9, AppleScript
supported Scripting Additions which were bits of native code that
added capabilities to AppleScript, much like XCMDs did for Hypercard
or JNI does for Java. I definitely recall somebody, back in the day,
writing a Scripting Addition that interfaced to OMS and/or the MIDI
Manager. The best possible solution to this problem would be a similar
approach that connected AppleScript directly to CoreMIDI, provided
that AppleScript still has something like Scripting Additions in it.
Of course, another solution would be to just switch to a scripting
language that already knows how to call out to the native frameworks
on the system, like Python or Perl.
On Aug 29, 2006, at 8:48 PM, Steve Majewski wrote:
On Aug 29, 2006, at 6:51 PM, djl wrote:
Can anyone please advise on my previous request/post/message?
Many thanks in advance ...
I think the answer to your very specific question is: No.
Hi there,
I'm after some advice/help and would appreciate your comments.
Basically, I'm trying to create a simple application primarily
using FaceSpan (and hence AppleScript, not AppleScript Studio)
and I need to, if possible, call a command line executable that
returns MIDI In data.
I don't need to capture any data other than the MIDI note number
of the key pressed eg, I don't need velocity, after touch, note-
off or volume data or even the ability to route the MIDI anywhere.
So, being that I'm no C, C++, Obj C or Java programmer is there
anyway to easily create a command line executable that can be
called from AppleScript's 'do shell script' command to:-
1. run in the background waiting for a key press
2. return the decimal value of the key pressed
3. exit/quit
Hoping you can help!
Kind regards,
If you want some more general advice, I think writing something in
java using javax.sound.midi package
might be somewhat simpler and easier than programming CoreAudio in
C/C++/Obj-C.
You can also call java packages from jython ( python in java ) or
rhino/javascript, but this isn't exactly
a magic bullet. You have to understand java and the
javax.sound.midi package, as well as how the
data corecions between java and the scripting language work to use
it, so it's as best, a way of avoiding
having to write everything in java.
But, as Jeff Moore noted, it probably won't work to make a program
that runs once to grab a key press and exits.
You seem to have decided on a set of tools and part of a solution
before analyzing the problem.
That may be part of the problem.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >HELP! (From: djl <email@hidden>) |
| >Re: HELP! (From: Steve Majewski <email@hidden>) |
| >Re: HELP! (From: jbrave <email@hidden>) |
| >was: HELP! (From: Steve Majewski <email@hidden>) |