简体   繁体   中英

Java sound: which is more efficient - WAV or MIDI

I have a Java application that needs to play a few distinct 'sounds/riffs' to indicate status. I would like to know whether it is better to record these as audio files (wav or whatever format) and play them back using the Java audio classes, or whether it would be better to store MIDI data and play them using the Java MIDI classes.

In my case, storage space is not a problem (within reason). I have about 5-8 status that I would like to play different melodies for. Each melody would be 1-3 seconds, consisting of 2-8 notes.

PCM (found within your WAV file) and MIDI are tools for entirely different jobs.

PCM is a way to encode audio, the sound itself. MIDI is a way to encode messages for controlling synthesizes... note on, note off, etc.

If you're playing back music and you don't particularly need high control over what it sounds like (as each system's MIDI synth can sound different), MIDI is an efficient way to encode it. If you need good quality instruments, vocals, etc., you need an actual sound format like PCM in WAV, MP3, AAC, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM