I'm currently trying to Capture through DirectSound, I've been trying toying around with WaveLib(Ported to VB) but this is very confusing. Anyway, I cant figure out how I am supposed to do this and would like some assistance. The end goal of this project is to: Record Microphone > Encode with Speex Codec > Send over UDP > Decode > Play on Speakers
i am new to directsound. I was wondering if someone could point to a resource that explains how to load wav files and play them using directsound. I found one webpage that explains how to load wavs and play them but you load them by clicking a button and searching a window for the file; what I need is programmatic loading. I can't use simpler methods to play the wavs because I need multiple sounds playing at once and very fast execution times. If it isn't too difficult, perhaps someone could post some code.
I am trying to follow some tutorials on using DirectSound in VB.NET and I need a reference to Microsoft.DirectX.DirectSound in my project. I have downloaded and installed the Microsoft DirectX SDK (June 2010) but after a restart I have no additional .NET references available to add to my project. I must be doing something really dumb
where I'm going wrong with my circular DirectSound Capture buffer here? If I just capture sound into a big non-circular buffer it works fine, but with a 1 second (44100 bytes) buffer and a 100ms timer to poll the read position it goes haywire. No error messages, just long blocks of zeros with short bursts of valid data. calculation of the number of bytes to read and/or the read position.
Here is the code. gBuffer is defined elsewhere as a big byte array. In this example I am just trying to copy the captured sound data from the small temporary byte array (tempBuffer) into the big gBuffer byte array. Obviously this must be done so that every byte is read and copied into the byte array with no gaps or duplication of values. Timer1 is set to 100mS:
Dim McaptureBuffer As CaptureBuffer Dim MiLastReadPos As Integer Dim MiBufferOffset As Integer
I have used DirectSound to play a wave file in my application using the function CreateSoundBufferFromFile. It works perfectly.Now I want to play files from a resource dll file. I have created 1n2v32.dll file having nearly 100 small wave files named 1,2,3... I can play them using LoadLibraryEx, PlaySound & FreeLibrary.Now, I am trying to use CreateSoundBufferFromResource function from DirectSound api to play these files. I get Run-time error '432': File name or class name not found during Automation operation I used the following code to create the buffer.
Set LDSB = LDS.CreateSoundBufferFromResource(App.Path & "1n2v32.dll", "14", BufferDesc, gw)
I use the following code (with Imports Microsoft.DirectX.DirectSound and Microsoft.DirectX) to play sound using an 8 second static buffer:
Dim SD As Device = New Device SD.SetCooperativeLevel(Me.Handle, CooperativeLevel.Priority) Dim MS As New IO.MemoryStream(Gbuffer) ' Gbuffer is byte array with properly formatted WAV data Dim waveFormat As New WaveFormat waveFormat.SamplesPerSecond = 44100 [Code] .....
What I would like to do next is to change to a "circular" or "streaming" buffer so that I can write new data "on the fly". I've done a lot of Googling but can't quite see how to adapt my present code to use a circular buffer. I can get the current write and play positions using Msb.GetCurrentPosition(iPlayPos, iWritePos) but how do I actually insert new data into the buffer? I have tried "manually" writing new data into my Gbuffer byte array but that doesn't work - I guess once a sound has been played through once, the data is cached somewhere and the contents of Gbuffer are not used again.
So I was working in the forums and on the side bar of some thread I saw this link: [URL]...It turned out to be almost entirely about MIDI, but it made me think that I really need to share some code I wrote a few months ago and see if perhaps there is reason to create what the above thread really asked for.Here's a little background on the following code:
Back in April or so of this year I was doing some spring cleaning and came across the old Yahama PSR-6 synthesizer keyboard I had received one year for Christmas when I was around eight. I remember I used to like the Bagpipe voice because at the low notes it made a good fart sound. For a Toys-R-Us/Radio Shack model keyboard, running on six D-Cell batteries, produced in the early to mid eighties, that was an impressive achievement. LOL Anyway, I always did want to learn to play piano (or keyboard) so I decided to literally dust the thing off, put batteries in it, and fiddle around a bit. A couple YouTube videos later and I was convinced that I wanted to do this. While I was waiting for the thing to ship and arrive, I thought that it really shouldn't be that hard to take a DirectSound SecondaryBuffer object and inject it with sound data which whas calculated based on the harmonic values of musical notes, thereby creating your own synthesizer.
First, I really had little idea what I was doing when I first set about doing this other than the general structure of calculating byte data for notes and stuffing them into a SecondaryBuffer object while it played. I had used direct sound a number of times in a number of ways, but always playing sound data that came from a source (file, stream, etc.). This would be my first attempt at generating sound data for the buffer.
Second, I'm a "code-as-you-learn-learn-as-you-code" kinda guy, so that means that I developed the initial project as I went. I would research a specific portion of the project (and there was a LOT of research to do! lol) and then code it and move on to the next. Of course, this eventually leads to a mess of a project in most cases where the foundation is a bit complex to begin with. So the code I'm posting is the second version of the concept. But even at that, I'm only going to post the primary user control at this point and hold back on the code for the test application I created with it (I will provide a download to the compiled app however). After getting the user control cleaned up (if not ideally redesigned), the second app became a "develop-as-you-go" project for the test application - so it is a bit of a mess now too; but mostly just to look at code-wise - it actually runs pretty well.
Third, there are still a few design issues that could be improved upon in the user control, and a few choices which were made for ease of coding that could be changed for performance. But because of this, other than for a couple of routines, most of the code should actually be pretty straight forward to anyone who's comfortable in VB already.
Ok, on to the example: we are going to create a MusicKeyboard control. This control will draw itself like a pinao keyboard and will render keys for the specified number of full octaves. Clicking a key will play the associated note in the specified voice. Voices will be created using a simple digital oscillator and optional even-noise generator on top of a sine wave form.
To get started, you'll first need to have the DirectX SDK installed. The latest one is available here:[URL]..displaylang=en however the example was created using the version from March 09. There should be no impact from using the newer version.
Once you have the SDK installed, create a new Windows Application and add a new User Control named MusicKeyboard to the project. Note that you could create a Windows Class Library project, but I personally like to develop in an Application for ease of testing and later convert to a class library.You'll need to drag a BackgoundWorker component from the toolbox onto the usercontrol and name it "SynthWorker". Set the worker's WorkerSupportsCancellation property to True.
Now you'll need to add the DirectX reference to the project. You can rightclick the project in the solution explorer and select Add Reference or go to My Project and the References Tab. From the list of .Net references,add Microsoft.DirectX.DirectSound.That should be all we need to get started. In the following posts we'll create a bunch of code files and get the keyboard noise-worthy.Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
I was wondering if anyone could point me to a really good tutorial on Directsound.I don't know if trying to digest an API is a good thing for a beginner but I really need something that has a beginner in mind.I especially liked some of the Microsoft video tutorials on VB.NET so perhaps they offer some on Directsound?The goal is to stream a WAV file, (not just "play it") and I want to LEARN the process.
I'm using VisualBasic (and I'm kind of new to it) how can I check if the microphone is on? I'm capturing a video from the web cam, but I need also to make sure that the microphone is on. I caould not find out how to check that.
I am trying to record many small MP3 files from my computer's microphone. There are numberous examples using mciSendString Library "Winmm.dll" to record .wav files. I find the .wav quality to be lacking and I really want to record straight into the MP3 format rather than converting my .wav files.
I am trying to record many small MP3 files from my computer's microphone. There are numberous examples using mciSendString Library "Winmm.dll" to record .wav files. I find the .wav quality to be lacking and I really want to record straight into the MP3 format rather than converting my .wav files.
I have no idea how to tackle this project. I need to write an MP3 file to the microphone in. So when i'm using VOIP, the mp3 file get played. I tried to write an mp3 to the default CAPTURE DRIVE with directsound out (with Naudio): this doesnt work (it does compile, execute, but the microphone in does not seem to get input:
I am trying to record many small MP3 files from my computer's microphone. I know how to do this using mciSendString with the "Winmm.dll" to record .wav files. I need to record straight into the MP3 format from Visual Basic 2010.
there are many C# things for this but I DONT KNOW C#, this link has FOUR C# PROJECTS - when it is posted in this forum:[URL]..it is ticking me off that all of the volume control i can find is in, yet again, C#!
please help, i NEED something to mute/unmute mic on button click and speakers on button click
I am looking into recording sound from a microphone using vb.net into a wav or mp3 file. I've Googled loads but only found 3rd party controls and C# code, which looks too sticky to convert..[url]...
I found this article on the code project which uses WaveIn and WaveOut but this looks unconvertible.... and I would like to avoid using DirectX SDK because the installation files are large and I wouldn't like users to have to do that.
Can I use Visual Basic 2008 Express Edition to make a program that can take audio directly from the microphone line and decode it to from data? ( I'm building wireless transmition software for ameteur radio )
I want to basically have a program that recognizes certain phrases from the microphone just like windows speech recognitionI pretty much think that it is probably going to be a microphone stream and then have speech recognition somewhat like Kinect speech recognition but in VB and not using XNA game studio.
I'm writing a windows application that need to access the raw data of the microphone input. Basically there's an electronic circuit connect to the microphone jack, and I need to get that data and process it. All I could find are some examples of using API to save the data to a wav file or something like that. But I need to process the data in real time. Get the exactly value of the input on that time. Is it possible?
I'm developing video intercom system. i have push button to talk. when user press the push button, i need to increase the system microphone volume and mute the system speaker. While releasing the push button, i need increase the system speaker volume and mute the system microphone volume.
Is a way of creating a program (either in C(+,++,#) or VB.net) that would be able to send a beep sound through the same line-in that is being used for audacity (not stereo mix)?
I am trying to make a way of syncing up audio and video from 2 different programs, in a similar way that a clapper bored works in the movies.
Would there be a way of using a sort of microphone enhancement that could be created because they affect the microphone input?
I'm learning to play the Trumpet and thought it would be a great idea to write myself a flash card type program that would flash a note, pick up the sound from the microphone, determine the pitch, compare it to the note and evaluate right/wrong. For example, it puts a middle C on the screen, listens for a tone above the din and beeps or buzzes if the result is right or wrong.