Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Import midi to AVI file

Thread view: 
ahjiang@gmail.com - 06 Jul 2006 02:41 GMT
Hi all,

Is it possible to use Java Media Framework to import a midi file into
an existing AVI file?

Appreciate any inputs.
Andrew T. - 06 Jul 2006 06:25 GMT
...
> Is it possible to use Java Media Framework to import a midi file into
> an existing AVI file?

Do you mean
a) Play the MIDI at the same time as the AVI. 'attach' it at
runtime as the soundtrack for the AVI?
b) Write the AVI file to disk with the MIDI file attached as a
soundtrack?

a) is fairly east, but for b)...
Maybe, but you have some challenges ahead.

1.  A MIDI tune generates no sampled audio signal (on my
PC) so this is one PC that would require a loop-back before it
was even possible to detect the audio signal generated by the
notes.

2.  The MIDI synthesizers of different PC's will produce different
sounds, so you cannot expect any two sound cards to generate
the tune quite the same way.

I recommend breaking this problem into parts if you intend
to pursue it.  On the one hand check that you can merge
a sampled sound file into an AVI as the soundtrack (requires
JMF), on the other check that you can obtain a MIDI sequence
as a sound signal (core J2SE).

HTH

Andrew T.
ahjiang@gmail.com - 06 Jul 2006 06:41 GMT
> b) Write the AVI file to disk with the MIDI file attached as a
> soundtrack?
[quoted text clipped - 13 lines]
> JMF), on the other check that you can obtain a MIDI sequence
> as a sound signal (core J2SE).

I would need to import the midi file into the avi file as a soundtrack
without using the player or so.

If a midi sequence can be obtain as a sound signal, how would that help
in importing into the avi file?
Andrew T. - 06 Jul 2006 07:14 GMT
> > b) Write the AVI file to disk with the MIDI file attached as a
> > soundtrack?
..
> I would need to import the midi file into the avi file as a soundtrack
> without using the player or so.

I think I understand.

> If a midi sequence can be obtain as a sound signal, how would that help
> in importing into the avi file?

MIDI is like a musical score, it stores the notes, not the
sound of the notes.

Only sampled sound can be stored in the more common
sound formats such as those used by AVI or MOV videos.

To store a MIDI into the soundtrack of a video, you first
need to convert it to a sampled sound.

Andrew T.
ahjiang@gmail.com - 06 Jul 2006 07:36 GMT
Thanks for the advice on the sound signal. So even if midi can't work,
just forcefully allow wav files.

The other problem would be much tougher. I have no idea how to open up
the avi file as a stream in Java and putting music in it. Will need to
look further into this issue.

> > > b) Write the AVI file to disk with the MIDI file attached as a
> > > soundtrack?
[quoted text clipped - 17 lines]
>
> Andrew T.
Andrew T. - 06 Jul 2006 08:35 GMT
> Thanks for the advice on the sound signal. So even if midi can't work,
> just forcefully allow wav files.

? I do not understand what you mean by 'forcefully', but
WAV files, as well as AU files are 'sampled sound' files.

If you can convert your MIDI to either of those types of
sampled sound format (or some other type*), I suspect
you have the major part of the task done.

* I mentioned AU and WAV because core Java understands
them.  But if you add the JMF, that opens up a lot more
formats.

That being said, if you want to continue with the MIDI's,
I think you should at first stick to AU's or WAVs and core
J2SE, notably packages javax.sound.sampled &
javax.sound.midi.

> The other problem would be much tougher. I have no idea how to open up
> the avi file as a stream in Java and putting music in it. Will need to
> look further into this issue.

That is where the JMF comes in - in fact, if MIDI is
unimportant and you just want 'sound in your AVI'
you should go straight to the JMF.

Then you can use any old WAV or AU (or MP3..) and try
stitching it in as the soundtrack of an existing AVI.

I have not used the JMF much, beyond playing with
JMStudio (which was quite handy recently in helping
me strip the soundtrack *out* of MOV files!).

By the way - please trim earlier words that are not needed,
and put your comments in-between the earlier words that
*are* needed (as I did above).

'In-line' posting makes threads much easier to understand.

HTH

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.