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 Professional Discussion / RECORD SOUND does not work / I need 8 bit sound recording too

Author
Message
Leonid
User Banned
Posted: 29th Jan 2012 20:38
My tamagocha must listen what player says into microfone and do what it listen. But RECORD SOUND kills existing sound or not producing new sound: PLAY SOUND and SAVE SOUND writes error "No sound existing at line ...". It will be cool if RECORD SOUND command will have flag "8 bit record" because I don't know how 16 bit PCM (Phase Carrying Modulation) works and because 8 bit is just easier to control (1 byte = 1 quantum of sound).
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Jan 2012 22:31
I'm not sure, but I think it might work with whatever you have your sound card set up to do.
As for programmatically setting flags for your sound card (such as recording resolution) you might find something by googling it, although it seems like you might have to dig around for a while.


"Why do programmers get Halloween and Christmas mixed up?"
Leonid
User Banned
Posted: 30th Jan 2012 14:33
No, Dark BASIC Deluxe (1.09c) works with my sound card - Dark BASIC Professional 1.075 does not work. And, If player have not sound card (or sound chip on motherboard does not work correctly) - my programs will cuicide after this things - it looks bad. Program must say: "Error: there is no sound chips on your computer", but not close itself.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 30th Jan 2012 16:29
Quote: "Dark BASIC Deluxe (1.09c) works with my sound card"

I've never heard of Dark Basic Deluxe?

My signature is NOT a moderator plaything! Stop changing it!
Leonid
User Banned
Posted: 30th Jan 2012 22:58
DBDeluxe: It is still sold in Russia on ozon.ru (Type there "Dark Basic"). It is a simple DB Classic.

FUF! Now I know how to do the DBPro will want to record a sound. It needs a STOP RECORDING SOUND after 2 - 3 seconds after RECORD SOUND command. BUT! If STOP RECORDING SOUND will be less than after 2 second, the program kills itself again!

Evrika (for me): PCM (Phase Carrying Modulation) - is not a compression method - it is a simplest data of sound amplitude byte-to-byte! 127 or 128 is Zero-point for 8 bit.

GOOD THING. The recording of the sound works in background mode (Program continues to work, it is not waiting for the end of recording). My tamagocha will continue to do something else and will be listening the player.

Have you the same problem? (Program crashes if STOP RECORDING SOUND will be less after 2 seconds from beginning of recording). I can not make watch control for the sound 1 (it is existing only afrer STOP RECORDING SOUND command, but this command kills the program if sound is not existing).

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 31st Jan 2012 00:50 Edited at: 31st Jan 2012 01:19
Your code seems to work except for this bit:



Why do you use 3000? I get an error if the sound recording is too short - as you should.

Edit: Forgot to add that I'm using U7.7RC7.

Edit2: Something like the following should work:



The above code doesn't crash for me (although it could obviously be made much neater ).
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 31st Jan 2012 01:24
Just wanted to point out that PCM in the given context stands for Pulse Code Modulation and not phase-carrying modulation, in case you try to search for that


"Why do programmers get Halloween and Christmas mixed up?"
Leonid
User Banned
Posted: 31st Jan 2012 14:24
Program closes itself writed "Could not load sound at line 23". This line has STOP RECORDING SOUND command. You can remove program code with WRITE MEMBLOCK BYTE or just do not press "1" - any way if you will use the STOP RECORDING SOUND too early (less than 1 second) - program will close itself with error message.

Lee Bamber, it is too bad for program's reputation when it can not handle the error inside the program. Program must see the error and allow the programmer repair it with the special code. Make SOUND RECORDED() command to control this mistake.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 31st Jan 2012 19:16
Quote: "any way if you will use the STOP RECORDING SOUND too early (less than 1 second) - program will close itself with error message."


Your snippet, with my amendment, works perfectly for me - even if I stop the recording almost immediately.
Leonid
User Banned
Posted: 31st Jan 2012 21:57
Green Gandalf, can you show me your amendmented code?

My little market investigations:

I have Pentium-4 processor with 1.7 GHz and Windows XP Professional. DBPro is 1.075 . I believe, many russian players (and near Moscow too) has not fast computers. I had been buying my computer (and many people too) from other hands. Windows' are 90% is pitate's copies with crack (CDs "Crack Inside!"). I worked in cable TV and Internet provider company and know: one company (not first on this market) has 1 - 2% of Internet-connected town inhabitants. Inhabitants which has computers: 20 - 50%, not newest models. Global financial crisis compels people to stop buy not life-important things. My program (tamagocha) will contain an advertising reminders (I believe). If my program will close itself, player just will abuse me and will not want to play again.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Feb 2012 02:31
Quote: "Green Gandalf, can you show me your amendmented code?"


I posted the changes a few posts back, but here's the whole code again. Works as far as I can tell.

Leonid
User Banned
Posted: 1st Feb 2012 16:16
Green Gandalf, what computer you have (Processor, memory, OS)?
What appears in my test program "Info in the head of memblock" (nChannels, nSamplesPerSec, nAvgBytesPerSec)?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Feb 2012 18:54 Edited at: 1st Feb 2012 18:55
I get this:



I added a line to print the memblock size - the rest should be specific to DBPro not my machine (my laptop). I'll post the results for my PC later.
Leonid
User Banned
Posted: 1st Feb 2012 19:26
So, I see, already 2 computers records only 8-bit sound!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Feb 2012 19:56 Edited at: 1st Feb 2012 19:57
Here's what I get using my PC:

Leonid
User Banned
Posted: 2nd Feb 2012 03:02
Thank you, Green Gandalf for testing my program - use it freely. Now I have no questions about 8-bit recording, may be only I need a test between people, which have slow computers to catch a pause between real recording of sound and using a STOP RECORDING SOUND command.

Login to post a reply

Server time is: 2026-07-10 20:11:21
Your offset time is: 2026-07-10 20:11:21