Solved

continuous WAV recorder "one button ware"

Posted on 1997-06-21
16
283 Views
Last Modified: 2013-12-03
null
0
Comment
Question by:norb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
  • +1
16 Comments
 

Expert Comment

by:nobody11
ID: 1398787
For doing audio input looping, see MMSYSTEM.HLP topic waveInAddBuffer(). For 5 minutes x 32kHz x 8bit you need 1MB "looping memory", conventional, locked (by MMSYSTEM's waveInPrepareHeader()) memory should be sufficient if the machine has more than 4MB (under Win31).
The memory you may split into 32KB buffers, each containing exactly 1s of sample data, and delegate the rest of the work (i.e. filling the blocks) to MMSYSTEM. (A bunch of callback handling is required, but this ist almost all.)

But are you dreaming about wave file conversion/compression?
The Real Audio format isn't yet documented, and MP3 is very complicated. (but it's possible to start external conversion programs e.g. in hidden DOS boxes)

0
 

Author Comment

by:norb
ID: 1398788
Edited text of question
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398789
I used two computers to do so. Connect Speaker Out of one computer to Line In of another computer via an audio cable. Run Sound Recorder or other utilities that comes with your sound cards to record it. Using two computers is more stable. BTW, 32kHz is not standard for Microsoft PCM format. It is not supported by many sound cards probably.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:norb
ID: 1398790
Edited text of question
0
 
LVL 3

Accepted Solution

by:
vinniew earned 50 total points
ID: 1398791
I've got the code from MSDN for that...  They have a CWave C++ class that will do exactly what you need.  You would just need to create a separate thread to do it in the background.  I think it outs to a file, so that would probably change too.  If I get bored, I'll take an hour and write the app you were talking about.

V

0
 

Author Comment

by:norb
ID: 1398792
Edited text of question
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398793
Most of the sound cards have four sources directed to recording: MIDI, CD, Line-In and Microphone, which means you can record nothing when another application is playing waveform sound with these sound cards. Of course, you can connect Microphone In or Line-In to Speaker Out via an audio cable on the computer. But, many sound cards are not duplex, which means you even cannot open the recording device (waveInOpen) while another application is playing waveform sound on the same computer. Maybe, your computer has got two sound cards just like my computer. Then you can do it on one computer.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398794
Have you recorded anything?
0
 
LVL 3

Expert Comment

by:vinniew
ID: 1398795
It's done.  Yes, it records fine.  Who wants to help improve the source?  I used MS's MSDN CWave class to do it.  Although it works, it was meant for NT 3.51 and there are memory leaks on NT 4.0 and Win95.  

Anyone want to help debug?

0
 
LVL 3

Expert Comment

by:vinniew
ID: 1398796
send e-mail to vinnie@usa.net
0
 
LVL 3

Expert Comment

by:vinniew
ID: 1398797
whoops,  vinnieW@usa.net
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398798
Send it to chensu@hotmail.com
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398799
vinniew:

I compiled the files you sent to me. In spite of the bugs, it can record nothing when the other applications are playing waveform audio on one computer. On the other hand, when your program is running, the other applications cannot play waveform audio (The wave device is in use.). This is what I thought. This is the hardware limitation. In fact, what your program does is the same as what the recording part of Sound Recorder that comes with Windows does. So, would you please tell me how you recorded fine? In addition, how do you handle the non-standard 32kHz format?


In the E-Mail you sent to me, you wrote:
>By the way, the Disjockey app ( I didn't bother sending the makefile - just
put it all into a project) requires the user to tell what kind of soundcard
they are using.  I'm positive that this isn't necessary, I'm not sure how to get that info
using Win32.

You can use waveInGetNumDevs() and waveInGetDevCaps() to get that information. They return the number of waveform-audio input devices present in the system and their capabilities.

0
 
LVL 3

Expert Comment

by:vinniew
ID: 1398800
chensu,

He was talking about recording a song from the radio, right?  If he was talking about recording from a .wav file that's playing... whoa, I'd have to modify the kernel to be double buffering.  I doubt I'd get the source from MS to do that.

I didn't bother with the 32kHz part. Is it *that* important?  

Did you figure out the bugs?  I'd be *really* interested in getting the new and improved CWave, CWaveodev, CWaveidev.  I know it's not much, but it's a building block.  And, I'm using this class in another application.

If you know how to use waveInGetNumDevs and waveInGetDevCaps, can you add it to the class, too?  It would help eliminate some of that hardcoded stuff.

later,

V

0
 
LVL 23

Expert Comment

by:chensu
ID: 1398801
vinniew:

Sorry, maybe I misunderstood. I really do not know what he means by recording a song from the radio. Is the output of the radio directed to the microphone in or line in (or other internal connections) of the sound card? If so, the program works. But, you can still use Sound Recorder since norb didn't mention he needed source code.

The 32kHz is norb's request. It is up to norb whether it is important or not.

I haven't started to debug the program because I have little time on it. I am sorry. I would improve it as long as I have time.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1398802
In the E-Mail norb sent to us, he said he uses line in and 32kHz is important for him. Now that it is clear.

I suggest that you can use any sound recording software (Sound Recorder or other software that comes with your sound card, and there are many freeware and shareware including COOL96), then convert the wave to 32kHz. Or, use vinniew's code to record and add some code to convert before saving. The sound cards cannot record and play 32kHz directly. You cannot guarantee the quality when you convert the standard PCM format (11.025kHz, 22.050kHz, 44.010kHz) to the 32kHz. For conversion, you can refer to the WAVEMIX.DLL source code (standard PCM format conversion) on Microsoft Multimedia JumpStart 2.0 CD-ROM. I wonder why you want 32kHz.

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question