Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / February 2007



Tip: Looking for answers? Try searching our database.

creating sounds (tones) programatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Santa Claus - 10 Feb 2007 20:29 GMT
i THINK that's the proper word...

what has bothered me ever since mac os 7 is the following question.

if i wanted to hand code the different sound element levels for a
particular sound or tone, how would i get this array of sound level
numbers into a sound file the machine can play?

just speaking hypothetically, if i wanted to create an array as such:

double cycle[360];
int i;
for (i = 0; i < 360; i++)
 {
 cycle[i] = sin((i / 360.0) * 6.28); // yeah, i know, not really two
times pi but good enough as an example
 }

how would i get the cycle into a NSSound I can either write to a file or
play through NSSound's play?
Santa Claus - 11 Feb 2007 03:51 GMT
> i THINK that's the proper word...
>
[quoted text clipped - 16 lines]
> how would i get the cycle into a NSSound I can either write to a file or
> play through NSSound's play?

by the way, i DO know that the data needs to be converted somehow to
some form of integer (most likely 8 or 16 bits) either signed or
unsigned with 128 as zero point (8 bit) or 32768 as zero point (16 bit).

what i need to know is where would i go to find this information or
somebody simply tell me the information.  what coding does it use
(linear, logarithmic, mu-law, a-law, etc), what's the zero point, how
many bits, does it require dual channel or can one use a single channel?  
from all this information i can create the data array of numbers.  i
then need to know how it's supposed to be played using existing (not on
it's way out) routines.
Lawson English - 11 Feb 2007 06:44 GMT
>> i THINK that's the proper word...
>>
[quoted text clipped - 28 lines]
> then need to know how it's supposed to be played using existing (not on
> it's way out) routines.

That kind of stuff is now being handled in MacOS X by something called
Core Audio. There's plenty of built-in libraries and frameworks to
handle the issues:

http://www.apple.com/macosx/features/coreaudio/
Robert Dell - 21 Feb 2007 12:34 GMT
>>> i THINK that's the proper word...
>>>
[quoted text clipped - 34 lines]
>
> http://www.apple.com/macosx/features/coreaudio/
http://developer.apple.com/documentation/QuickTime/INMAC/SOUND/imsoundmgr.2c.htm
#pgfId=4097

 
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



©2010 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.