Re: MusicDevice instrument types
Re: MusicDevice instrument types
- Subject: Re: MusicDevice instrument types
- From: Christopher Corbell <email@hidden>
- Date: Sun, 8 Dec 2002 20:51:01 -0800
On Friday, December 6, 2002, at 01:01 PM, Chris Rogers wrote:
Chris,
The DLS and SoundFont spec don't have a concept of these instrument
categories (as far as I know) as they're shown in the instrument
picker in QuickTime. It turns out that certain categories exist
for the General MIDI standard and the QuickTime instrument picker
simply categorizes according to the GM standard.
So, there's no way to query a MusicDevice for this info...
Chris Rogers
Core Audio
Apple Computer
I would like to provide users with an NSBrowser to select
DLS synth instruments based on categories. I really just want the
default groupings for the Apple instruments as they appear in
the QuickTime instruments picker - Piano, Brass, Reed, Drum Kits, etc.
Is there a standard (MIDI or CoreAudio) way to determine this?
Using the AudioUnit properties I can get the ID and name of each
instrument but I do not see any obvious way to determine which belong
to which group. I could hard-code a scheme based on IDs or indices
but if there's a dynamic way to determine this at runtime I'd rather
use that...
Thanks for any help,
Chris
_______________________________________________
Thanks for the reply.
FWIW, if anyone else wants to do something similar, the solution I
adopted
was to look at the low-word of the MusicDeviceInstrumentID for each
instrument
and classify according to ranges of values. E.g. all keyboard
instruments have
a LowWord(nID) <= 7, pitched-percussion is > 7 && <= 15, organs are
> 15 && <= 23, etc. All of the QuickTime (GM) categories are contiguous
in this way as returned via ID through the default MusicDevice
component.
Below is my actual classification method with an enum I defined. This
scheme
doesn't follow the QuickTime / GM scheme exactly, I separate single
viol-family
sounds into their own group, put all ensemble & strings sounds in one
orchestral
category, and lump all synthesizer sounds together. But the basic gist
is there
if you want to adopt it to your own scheme.
- Chris
- (EInstrumentCategory) instrumentCategory:(MusicDeviceInstrumentID) nID
{
// Instrument category is determine by known ranges for low word of
instrument ID
UInt16 nLowWord = LoWord(nID);
EInstrumentCategory eCategory = kInstrumentCategory_Unknown;
if(nLowWord <= 7)
eCategory = kInstrumentCategory_Keyboard;
else
if(nLowWord <= 15)
eCategory = kInstrumentCategory_PitchedPercussion;
else
if(nLowWord <= 23)
eCategory = kInstrumentCategory_Organ;
else
if(nLowWord <= 31)
eCategory = kInstrumentCategory_Guitar;
else
if(nLowWord <= 39)
eCategory = kInstrumentCategory_Bass;
else
if(nLowWord <= 43)
eCategory = kInstrumentCategory_Violin;
else
if(nLowWord <= 55)
eCategory = kInstrumentCategory_Orchestral;
else
if(nLowWord <= 63)
eCategory = kInstrumentCategory_Brass;
else
if(nLowWord <= 71)
eCategory = kInstrumentCategory_Reed;
else
if(nLowWord <= 79)
eCategory = kInstrumentCategory_Flute;
else
if(nLowWord <= 103)
eCategory = kInstrumentCategory_Synthesizer;
else
if(nLowWord <= 111)
eCategory = kInstrumentCategory_Ethnic;
else
if(nLowWord <= 119)
eCategory = kInstrumentCategory_Percussion;
else
if(nLowWord <= 255) // all others up to 255 fall into Sound Effect
here
eCategory = kInstrumentCategory_SoundEffect;
else
eCategory = kInstrumentCategory_DrumKit;
return eCategory;
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.