• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Q] - QuickTime Music Synthesizer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] - QuickTime Music Synthesizer


  • Subject: Re: [Q] - QuickTime Music Synthesizer
  • From: Rolf Nilsson <email@hidden>
  • Date: Mon, 28 Oct 2002 18:31:57 +0100

> Message: 10
> Date: Fri, 25 Oct 2002 11:53:46 -0700
> To: email@hidden
> From: Chris Rogers <email@hidden>
> Subject: Re: [Q] - QuickTime Music Synthesizer
>
> Are you noticing the slow pitch bend on all platforms, or just with
OS 9
> with VM turned on? On OSX, I wouldn't expect such a behavior, but am
> curious to know.

The code below which is a simple rewrite of one of the functions in
QTMusic sample from Apples's site

It shows that QucikTime don't handle pitchbend as it should.

Any comments or suggestions is appreciated

thanks rolf nilsson


// start of example code


void this_do_not_work_PlaySomeBentNotes (void)
{

#define kInst_HammondOrgan 17


NoteAllocator myNoteAllocator;
NoteChannel myNoteChannel;
NoteRequest myNoteRequest;
unsigned long myDelay;
long myIndex;
ComponentResult myErr = noErr;

myNoteAllocator = NULL;
myNoteChannel = NULL;

// open the note allocator component
myNoteAllocator = OpenDefaultComponent(kNoteAllocatorComponentType, 0);
if (myNoteAllocator == NULL)
goto bail;

// fill out a note request, using NAStuffToneDescription
myNoteRequest.info.flags = 0;
//myNoteRequest.info.reserved = 0;
*(short *)(&myNoteRequest.info.polyphony) = EndianS16_NtoB(2); //
simultaneous
tones
*(Fixed *)(&myNoteRequest.info.typicalPolyphony) =
EndianU32_NtoB(0x00010000);

myErr = NAStuffToneDescription(myNoteAllocator, kInst_HammondOrgan,
&myNoteRequest.tone);
if (myErr != noErr)
goto bail;

// allocate a note channel
myErr = NANewNoteChannel(myNoteAllocator, &myNoteRequest,
&myNoteChannel);
if ((myErr != noErr) || (myNoteChannel == NULL))
goto bail;

Delay(30, &myDelay); // delay 1/2 of a second




// --- play one note

NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80

Delay(10, &myDelay); // delay 1/6 of a second

NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


// --- play one note, bend it up a wholetone first -> should sound as
middle D

long lBendValue = 0x200;

NASetController(myNoteAllocator, myNoteChannel,
kControllerPitchBend, lBendValue);
Delay(30, &myDelay); // delay 1/2 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80
Delay(10, &myDelay); // delay 1/6 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


// --- play one note, bend it down again -> should sound as middle C

lBendValue = 0x000;

NASetController(myNoteAllocator, myNoteChannel,
kControllerPitchBend, lBendValue);
Delay(30, &myDelay); // delay 1/2 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80
Delay(10, &myDelay); // delay 1/6 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


Delay(60, &myDelay); // delay 1 second

// works OK so far, melody is C D C

// now do it again with pitch bend being much closer


// --- play one note

NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80

Delay(10, &myDelay); // delay 1/6 of a second

NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


// --- play one note, bend it up a wholetone first -> should sound as
middle D

lBendValue = 0x200;
Delay(30, &myDelay); // delay 1/2 of a second

NASetController(myNoteAllocator, myNoteChannel,
kControllerPitchBend, lBendValue);
Delay(1, &myDelay); // delay 1/60 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80
Delay(10, &myDelay); // delay 1/6 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


// --- play one note, bend it down again -> should sound as middle C

lBendValue = 0x000;
Delay(30, &myDelay); // delay 1/2 of a second

NASetController(myNoteAllocator, myNoteChannel,
kControllerPitchBend, lBendValue);
Delay(1, &myDelay); // delay 1/60 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 80); // middle C
at velocity 80
Delay(10, &myDelay); // delay 1/6 of a second
NAPlayNote(myNoteAllocator, myNoteChannel, kMiddleC, 0); // middle
C off


// as anyone can hear this sounds as: C D D

// when pitch bend is close to a note on and the note length is short,
// this simply DOES NOT work




bail:
if (myNoteChannel != NULL)
NADisposeNoteChannel(myNoteAllocator, myNoteChannel);

if (myNoteAllocator != NULL)
CloseComponent(myNoteAllocator);
}


// end of example code






>
> If at all possible, I would recommend moving over to the
> AudioUnit/MusicDevice and MusicPlayer APIs to access the DLS synth
> directly. You have more
> precise control this way. If this still has to work on OS 9, then
you'll
> have to stick with QTMA.
>
> Chris Rogers
> Core Audio
> Apple Computer
_______________________________________________
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.

  • Follow-Ups:
    • Re: [Q] - QuickTime Music Synthesizer
      • From: Richard Dobson <email@hidden>
  • Prev by Date: Fwd: Urs: solution still crashes sometimes
  • Next by Date: com.apple.iokit.IOAudioFamily OSBundleLibraries dependency for 10.2
  • Previous by thread: Re: [Q] - QuickTime Music Synthesizer
  • Next by thread: Re: [Q] - QuickTime Music Synthesizer
  • Index(es):
    • Date
    • Thread