How to generate sound of given frequency and duration?

Hi,

 I am trying to port one old DOS game that just beeps its sounds to PC-Speaker or AdLib if it finds one. The frequency and 

duration are computed at run-time. What do I have to use in SDL to port this functionality ? May be there is other extension or
3rd-party library to achieve this ?

 I am porting to ruby-SDL (or RUDL, undecided yet) under Linux+X11 now, but I would prefer to know about portable functions 

for sound generation.

 Thank you in advance for your replies.