Eric Wing on OpenAL, on YouTube

58 views
Skip to first unread message

David Phillip Oster

unread,
Aug 30, 2011, 11:43:41 AM8/30/11
to CocoaHeads - Silicon Valley
Eric Wing's terrific presentation on OpenAL in iOS and Mac OS is at
http://www.youtube.com/watch?v=6QQAzhwalPI .

Thank you to Alix Herrmann for recording the presentation.

I loved it. I immediately went to "Beginning iPhone Games Development"
and started absorbing more details.

David Phillip Oster

unread,
Aug 30, 2011, 11:46:47 AM8/30/11
to CocoaHeads - Silicon Valley
I, David Oster, am excited about OpenAL, because I can use it to make
a sampler: OpenAL can change the pitch of an audio sample. Use a
pitchRatio of 2, and it goes up an octave, a pitch ratio of 0.5, and
it goes down an octave. (I was disappointed to discover there was no
easy way to play MIDI note data on iOS.)

Since there are 12 notes in the musical scale, you can use the twelfth
root of 2 to go up one step. So, to go from A (at 440 cycles per
second,) up to C (A A#, B, C - 3 steps), you use:

double alpha = pow(2.0, 1.0/12.);
double c5 = 440.0 * pow(alpha, 3); // 3 steps

Down, to the C, and octave below, you'd use:

double c4 = 440.0 * pow(alpha, -9); // 12 steps in an octave. up 3,
down 12.

Next step: dogs singing "Jingle Bells".

(Apple's auriTouch example gives sample code for recording audio, and
using Fast Fourier Transform to determine its principal pitch.)

On Aug 30, 8:43 am, David Phillip Oster <davidphillipos...@gmail.com>
wrote:

Eric Wing

unread,
Aug 31, 2011, 3:41:53 AM8/31/11
to cocoaheads---...@googlegroups.com
Wow, very cool David! Music theory I never learned :)

That reminds me that one of my readers, Johnny Sung (mentioned on my
book site), was doing something along these very same lines on his
iPad also.

Thanks for sharing. I'm really happy you enjoyed the presentation.
-Eric

>> and started absorbing more details./

Johnny Sung

unread,
Sep 13, 2011, 6:54:14 AM9/13/11
to CocoaHeads - Silicon Valley
Hi, everybody,

I am Johnny Sung, Eric Wing encouraged me to join the group, so I need
to say something about MIDI in iOS.

The early MIDI interface in PC, Sound blaster card was developed by
Creative company, which used Yamaha YM3812 as core controller. In that
time YM3812 was also largely used in Arcade games and high end
electronic organ. Many Taiwan companies(they are all my friends)
reverse engineering it and sold a lot without respecting the patent
owned by John Chowning; the way to synthesize the sound is called FM
( http://en.wikipedia.org/wiki/Frequency_modulation_synthesis ).

Since I had many contacts in that wonderful chip YM3812, I developed
an organ using that chip, and it attracted my major attentions till
now, and finally I can write a program to generate several sounds by
software. The original code is developed by generous Daniel R.
Mitchell, you can download his code in ( http://sourceforge.net/projects/basicsynth)
, and you'd better buy his book to see more details(http://
basicsynth.com/index.php), only costed me $25. To compile the program:
use visual studio 2008, file | open | project/solution | Downloads
\basicsynth-src-1-3-0\basicsynth\Src , choose BasicSynth 2008 version.
Build it, find FMExplorer and click Project | SetAsStartProject, run!
you can see an FM sythesizer panel to let you change parameters and
change sounds of Piano Organ Strings....

The sourec code is developed by C++, which is very hard to read by
Java/C# programmer as me, so I changed it to VB code, you can download
from my website(http://sing1234567.com/Shares/FMSynthesizer.7z), I
also changed it to Java code(http://sing1234567.com/Shares/Java/
FMSynthesizer.7z) so my Apple computer can run it.

Then reading Eric Wing's generous codes of OpenAL in his book, I
rewrote the code to generate Piano Organ Strings.... sounds in xCode,
and now I can run in iPad. It is a tedious work, and I am trying to
use it to sell an iPad hymnal.

The bad part of FM is you don't know how to change your instrument
sounds, the only way I know is just adjust parameters to hope to have
a good sound. The better way is PCM method, so you can record and
replay any sound of instrument. But since I have no source program
yet, so I cannot do.

If iOS5 have MIDI then I don't need to do such a lot of jobs. It is
said it has now, but who can tell me how to do it?

On Aug 31, 2:41 am, Eric Wing <ewmail...@gmail.com> wrote:
> Wow, very cool David! Music theory I never learned :)
>
> That reminds me that one of my readers, Johnny Sung (mentioned on my
> book site), was doing something along these very same lines on his
> iPad also.
>
> Thanks for sharing. I'm really happy you enjoyed the presentation.
> -Eric
>

Eric Wing

unread,
Jan 13, 2012, 4:30:09 AM1/13/12
to cocoaheads---...@googlegroups.com


Hi all,
I thought this seemed related and might be of interest.
A user of Corona which uses my ALmixer/OpenAL library just shipped
Wine Glass HD which uses OpenAL pitch to change the notes:
http://itunes.apple.com/us/app/wine-glass-hd/id490858996?mt=8

Incidentally, its first release got bit by the nasty iOS 5.0 OpenAL
bug I may have mentioned in passing at Cocoaheads. So I was working on
yet another workaround this week.

Anyway, it's a pretty neat app and it is free until the 14th.

-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Reply all
Reply to author
Forward
0 new messages