Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Tone generation in Dark Basic

Author
Message
robmaggs
19
Years of Service
User Offline
Joined: 17th Apr 2006
Location: Anglesey UK
Posted: 18th Apr 2006 12:53
Anyone know how to generate tones in HZ with a given duration?

ie I would like to create two tones one 100hz and another 110hz and play them together for a duration selected by the user. I can't see how this can be done in dark basic. I had a zx spectrum years ago and i remember the "beep" command...but does dark basic have anything like this hidden away?, or do you have to call a windows dll and if so how do you do it?

Thankyou in advance oh splendid programmers, I respect you!

All the best Rob

http://www.moonfish-design.co.uk

www.moonfish-design.co.uk
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Apr 2006 07:27
There's no equivalent to the old Speccy beep command in DB.

However, you should be able to 'kludge' it using the Beep function in Kernel32.dll with a DLL call.

The code below ought to work, but on my machine it doesn't, so you can try it. If it doesn't work, then I don't think you can do anything about it - other than record two wav files using a third-party tone generator program.

If you record half a second, you can use a timer in DB to loop them for the specified amount of time.



TDK_Man

robmaggs
19
Years of Service
User Offline
Joined: 17th Apr 2006
Location: Anglesey UK
Posted: 19th Apr 2006 13:45
Thanks TDK, your help is invaluable, tried both methods but the second technique using a sample is the best approach.

I made a 100hz sample and then used the SET SOUND SPEED command to alter the frequency. Fantastic exactly what I want...well almost.

How can the frequency of the sample be changed according to values the user inputs, Ie user types in 110hz and by using "set sound speed" 110 hz is played.

Thankyou in anticipation, your help is greatly appreciated.

Cheers Rob



http://www.moonfish-design.co.uk

www.moonfish-design.co.uk
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 19th Apr 2006 23:22 Edited at: 19th Apr 2006 23:22
Is it possible to record the dll sound?
afaik no but what are you think?

[/center]
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 20th Apr 2006 00:52
@TDK

Not seen you about here in a while, good to see you're back

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 23rd Apr 2006 21:01
Ive got a question:How can I open the windows standart Dlls and look in
it?

[/center]
Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 6th May 2006 07:17
I'll put this on a dll to-do list.

Bluestar4~

Login to post a reply

Server time is: 2025-05-23 14:40:49
Your offset time is: 2025-05-23 14:40:49