-
May 12th, 2014, 07:47 PM
#1
Capture sounds from soundcard=speakers - NOT from microphone
What I would like to do is to capture the sounds you hear from the computer speakers - NOT from the microphone. I.E if you listen to song in youtube with the computer then to capture that song sound. I.E everything that is playing or should be playing on the speakers should be recorded. I found that best will be to use the waveIn* functions, such as
waveInOpen
waveInPrepareHeader
waveInAddBuffer // in loop for all buffers
waveInStart
waveInStop
waveInReset
waveInUnprepareHeader // in loop for all buffers
waveInClose
(this wave* is new to me so sorry for any dumb question)
My problems are:
I think that waveInOpen records what you speak on the mic and not the speakers so i am not sure how to tell it to capture the speakers/soundcard.
I am note sure i understand how to make the software to still be active while the recording is running I.E where to put the Wait().
I do not understand how to create sound file .pcm from the buffers. I.e should i append buf(1) + buf(2) + buf(3) + ... (the buf i sent to waveInAddBuffer) for creating the file?
And I do not understand how to connect everything - i.e., I do NOT want to record X minutes, then to stop and then save to file. I need to transmit this recording online in real time so i need immediate access to the data.
The final goal is to transmit the recording after it is encoded - to another device in real time - currently i am not asking about the encoder since i will deal with it latter.
So I need something like:
byte arr[1024*1024];
while (1)
{
GetCurrentSounds(arr);
Encode(arr);
Transmit(arr)
}
So GetCurrentSounds fill arr with the recording that took place (in another thread i guess) from the time GetCurrentSounds last called .
Yes, I do not really need to save to file - but the reason i asked how to save it to file is for debugging to see that I do everything ok. Hope you can provide explanation to the 3 question and even some code how to do what I need.
-
May 13th, 2014, 03:39 AM
#2
Re: Capture sounds from soundcard=speakers - NOT from microphone
Hi!
You should be able to use the recording API pretty straight off, but the device must also support so called "Stereo Mix", which you can read about here:
http://www.howtogeek.com/howto/39532...-record-audio/
Please note the Stereo Mix is disabled by default. Maybe you can programmatically enable it, but I have no idea how.
Nobody cares how it works as long as it works
-
May 13th, 2014, 04:16 AM
#3
Re: Capture sounds from soundcard=speakers - NOT from microphone
Originally Posted by zerver
Hi!
You should be able to use the recording API pretty straight off, but the device must also support so called "Stereo Mix", which you can read about here:
http://www.howtogeek.com/howto/39532...-record-audio/
Please note the Stereo Mix is disabled by default. Maybe you can programmatically enable it, but I have no idea how.
Thanks but this is not the solution:
From the article:
In other instances, however, it’s because the newest Windows 7 drivers don’t support this feature. This was the case on my Asus Eee PC (a 1000HE), but I got around the issue by downloading and installing the older Windows XP/Vista drivers for my audio chipset
--------------------------------
-
May 13th, 2014, 07:54 AM
#4
Re: Capture sounds from soundcard=speakers - NOT from microphone
the waveInOpen() needs a INPUT sound device
and there's the problem area.
you'll need to install (or create) a sounddriver that has save to disk or output-as-input.
-
May 13th, 2014, 08:07 AM
#5
Re: Capture sounds from soundcard=speakers - NOT from microphone
Originally Posted by OReubens
the waveInOpen() needs a INPUT sound device
and there's the problem area.
you'll need to install (or create) a sounddriver that has save to disk or output-as-input.
Hi.
Do you meant that I will write a Driver? .drv file?
-
May 13th, 2014, 08:42 AM
#6
Re: Capture sounds from soundcard=speakers - NOT from microphone
Writing a sound driver... I don't think you should reinvent the wheel...
Maybe have a look here: http://www.portaudio.com/
Nobody cares how it works as long as it works
-
May 13th, 2014, 04:01 PM
#7
Re: Capture sounds from soundcard=speakers - NOT from microphone
Originally Posted by zerver
Thanks for trying to help but portaudio has thousands of thousands of code lines so i do not even know how to approach that.
-
May 18th, 2014, 11:35 PM
#8
Re: Capture sounds from soundcard=speakers - NOT from microphone
You might be able to use a virtual sound card or Virtual Audio Cable: http://www.tomsguide.com/us/download...305-31100.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|