Generate/play sounds without files
BlitzMax Forums/BlitzMax Beginners Area/Generate/play sounds without files
| ||
Is there a way to generate or play a 'sound' without loading an external .wav .ogg etc file? It doesn't have to resemble anything, a variety of beeps of differing frequencies or notes will do nicely! Thanks. |
| ||
Extern "win32" Function Beep:Int(freq:Int , duration:Int) EndExtern Beep(500,100) |
| ||
Thanks! :D What does Beep return? |
| ||
I tried it but I don't hear anything. |
| ||
See the CreateAudioSample example in the docs for generating a basic audio wave. |
| ||
hi, the duration parameter is in milisecs, so try something greater than 100, the first (frequency) is in hertz, try 1000 for starting, below 200 probably you ear nothing, avobe 10,000 the same do a loop with increments of 100 herts wiht a duration of 0.1 seconds: 100 milisecs i try it in blitz3d and work perfectly in my laptop (same api call, i guess sould be the same from bMax) Juan |
| ||
afaik, that command control the internal pc speaker (that is controlled by the timer 2 of the old 8253 chip), not the sound card, in some older motherboards it should be disconnected and so, it never sounds, in other it should be connected to an input of the sound card to ear it, check the mixer to see if the speaker is conected to it, not muted etc hope that help Juan |
| ||
Thanks for the CreateAudioSample suggestion. Hm, it appears I may not have an internal pc speaker (or it isn't plugged in).. |