|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Sound Card Programming!
Hi Karel, First of all, I apologize for a little late reply, and thank you very, very much for your reply. I knew about HAL, and HEL and that's why I want to port in Windows. The code I developed runs fine with my Aztech Sound Card, but doesn't even detect my other ESS Sound Card, may be some hardware level register twinkling is needed. I don't know, with DirectX, is it possible to determine the input frequency on the fly and realtime..., let me elaborate a little on this, and I think the problem is platform independent, that is it shouldn't matter whether I am doing it from DOS, Windows or whatever. When I am recording sound from input like Microphone, all I get a Sine Wave, if you have access to the Sound Recorder provided with Windows, open any wav file with it and look at the wave. The output read from the microphone (I am using DSP), is some value between -127 to +127, and to get 44.1Khz sample rate, all I have to do is read this value 44100 times per second, and upon replay, write it to the output port 44100 times per second. I tried to plot this values, with 0 as the base, and positive numbers upward and negative numbers downward, and I have been able to get a sine curve something like this: | * * *** * |* * * * * * ** * * ** |-----*-----*---*---*-*-*------**-------**---*-**---*--*-*------ | * * * * * ** ** * * * * | * * ** * hope you would get the idea. The problem is it doesn't matter whether there is one note playing, or multinote playing, or a whole orchestra or voice, it always shows this curve, with only a little more dense, or sparse. How do I determine what is the frequency, or how many notes are playing, or how do I detect all the frequencies of all the notes playing at a given time? Now, my approach to the problem is first of all, I want to detect a single note, then if possible, detect multiple notes, then even voice or rhythm. If you have Winamp, it has a plugin that changes the voice with reverb, and more echo on the fly (wow!). Somehow it detects the voice and chages that. Now, all I want is that I want to play guitar and get piano sound, or flute sound... with the assumption that there will be no rhythm or voice (for the time being), and only single note is playing, not even multi-note (chord), and I don't know how. All I need is the Input frequency, determine whether it was a C note or D note etc. Every note has a frequncy tag with it, you know, and with frequency, I can generate it back with different tone. Let me ask you a side question. Do you know the parameters of a Voice? Let's say, two person are singing, one male and one female, the frequency must be same, because otherwise it will be heard as distuned, but still we can identify that there's a male voice and a female voice. How? What are the conditions for a voice to be a male or female? With even male voices, there are different qualities, different shades. The reason behind it is that I was thinking, if I could detect a voice and know the parameters, I would want to replace it with, say my voice. Thanks again for your reply, I would check out the site. If you have any suggestion, any info, or query, feel free to write. Towhidun Nabi >From: Karel Bagchus <H.Bagchus@cable.a2000.nl> >Reply-To: gameprogrammer@gameprogrammer.com >To: gameprogrammer@gameprogrammer.com >Subject: Re: Sound Card Programming! >Date: Sun, 05 Sep 1999 17:58:59 +0200 > >Hi Towhidun, > >Okay, I didn't know you where coding for DOS. What I meanth with >"DirectHardware" is that you are accessing the hardware directly, without >the use of an abstraction layer like DirectX. > >Your argumentation for doing this the DOS way is that you like to have >control. If you look at it from a layered viewpoint, you are trying to >operate on the lowest level possible, close to or on top of the hardware. >Although this gives you absolute control, it also gives you an absolute >amount of work to do becouse every hardware manufacturer implements their >own way of doing things, and that will always require you to write many >software versions for all hardware that you want to support. > >The main objection by game/demo programmers in the ancient days of win 3.1 >was that windows was too cluttered with abstraction layers to be useful for >fast graphics or multimedia in general. The reason why windows is organised >in that way is that it assures a success no matter what you do, with all >possible hardware. The downside of this was that it makes your programs >slow. > >Microsoft listened to the game industry's objections against windows, and >designed an architecture to bypass the thick layer of windows and access >the hardware directly (well.. almost) called DirectX. The reason I write >"almost" is that DirectX is a very thin semi-abstraction layer (i'll >explain the"semi-" part later). The idea is this: there is one layer called >DirectX that defines the hardware on a PC as objects. Those objects expose >functions that a programmer can use to access the desired effects on the >hardware. > >Below the DirectX programming interface are 2 other layers, not on top of >eachother, but they exists next to eachother. The first is a layer that is >programmed by the hardware manufacturer called the "Hardware Abstraction >Layer" or HAL. this layer does the same thing as the things you are trying >to program in your DOS application. Since the manufacturer has more >knowledge of their hardware then you have, you defenetly want them to do >the lowest level stuff for you ! > >The other layer that co-exists next to the HAL is the "Hardware Emulation >Layer" or HEL and is written by Microsoft. The reason for this is that not >all functions may be supported on all hardware, and if it can be emulated >in software this layer will do that for you. So that's another headache >taken out of your hands. > >I wrote earlyer on that DirectX is a semi-abstraction layer, becouse many >DirectX interfaces allow you to send manufacturer specific escape codes to >the hardware (for instance with keyboards). The other reason is that you >still have to query the device for support of features. This seems a bit >contradicting to what I said, but it isn't that hard to understand. > >Take for instance blitting in DirectDraw. Almost all video hardware have a >hardware blitter on the card. In the event that your program happens to be >running on a PC of which the hardware doesn't have a blitter, the HEL will >do that for you becouse the latency implications of using HEL isn't that >big of a burden for your PC. > > >It becomes another story if you are trying to use features that would >really slow down your program if they would be done in software emulation. >No-one is going to be satisfied with a framerate of 1 frame in 3 seconds, >so no programmer would want to use those functions in the HEL for >emulation, so Microsoft didn't bother to implement them in the HEL at all. > >So whenever you use a DirectX interface, you should query the interface for >the capabilities it has, and if it doesn't support them, you should degrade >the functionality as appropriate. > >Okay, that was my general introduction to DirectX. Let's go on with Windows >programming. Anything that you learn seems difficult at first, but after a >while becomes your second nature. Win32 programming is no different from >that. I've put some good examples of changing from DOS to Windows: > >Converting MS-DOS-based Games to Windows 95 : > >http://www.perplexed.com/GPMega/directx/convertdos2win95.htm > >Moving Your Game to Windows Part I,II & III > >http://www.perplexed.com/GPMega/directx/dos2win.htm > >http://www.perplexed.com/GPMega/directx/dos2win2.htm > >http://www.perplexed.com/GPMega/directx/dos2win3.htm > >If you have any further questions, feel free to ask. > >Karel. > >At 08:23 PM 9/5/99 +0000, you wrote: > >Hi Karel, > > > >Thank you for your reply, you know you are the only one who replied, may >be > >the text was a little too big. > > > >Sorry, you may have misunderstood my problem. It has nothing to do with > >DirectSound or DirectHardware. I have no idea what are those. I have >heard > >of them, off course, but avoided them cautiously, because I think those >are > >for Windows, I am only trying to survive with DOS. I am planning to port >in > >Windows, but my problem is only lack the information. May be you will >read > >again the mail, specially no #10. > > > >Any info on how to use DirectSound or DirectHardware, or where to find >more > >info will be great. But right now, my main focus is how do I correct my > >problem, like Timer, identifying Frequency from input in realtime etc. >which > >is described in previous mail. Under DOS, off course, because under DOS, >I > >have full control, and I like control. > > > >But, thank you again for your concern. > > > >regards, > >Towhidun Nabi > >naeeym@hotmail.com > > > >______________________________________________________ > >Get Your Private, Free Email at http://www.hotmail.com > >================================================================= > >To SUBSCRIBE or UNSUBSCRIBE please visit > >http://gameprogrammer.com/mailinglist.html > > > > >-------------------------====#### Class Logic ####====--------------------- > > Software Development > > Microsoft Certified Professional > > Karel Bagchus > mailto:karel@classlogic.com > http://www.classlogic.com > > Transvaalstraat 15 / 3-hoog > 1092 HA Amsterdam > the Netherlands > > Tel: +31 (0)20 - 77 75 344 > Fax: +31 (0)20 - 77 75 344 > GSM: 06 - 22 987 327 > > >-------------------------====###################====--------------------- > >================================================================= >To SUBSCRIBE or UNSUBSCRIBE please visit >http://gameprogrammer.com/mailinglist.html ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com ================================================================= To SUBSCRIBE or UNSUBSCRIBE please visit http://gameprogrammer.com/mailinglist.html
|
|