Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Anyone have a simple wav recorder/player that works?
Anyone have a simple wav recorder/player that works? [message #33648] Sat, 03 September 2011 20:53 Go to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
I am looking for a simple wav recorder/player that works on Windows vista, and hopefully doesn't use winmm.dll as a basis for it to work.

So far I have not found working examples of a a simple wav recorder/player that works on vista.

I don't need bells and whistles, as it is just to record .wav files, one right after another.

David
Re: Anyone have a simple wav recorder/player that works? [message #33654 is a reply to message #33648] Sun, 04 September 2011 11:00 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

Hi David,

There is some basic support for sound in bazaar/plugin/portaudio. Just include plugin/wav package to your project. Good place to start could be PlayWav() function. It is not much documented and not very extensively tested, but if you start using it, it would be a good reason for me to start working on it again (minor problem is that I don't have windows, so I can test on linux only Smile ).

The portaudio library supports various backends, on windows you can choose from WinMME, Direct Sound, ASAPI and DMKS backends (I don't even know what some of them mean). It even supports to use more of them at the same time. Let me know if it works for you, or what can be enhanced Wink

Besst regards,
Honza
Re: Anyone have a simple wav recorder/player that works? [message #33658 is a reply to message #33654] Sun, 04 September 2011 15:17 Go to previous messageGo to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
Ok, I tried sound example in Bazaar, which uses the Portaudio. However, a few things. It will play a wav file ok.

It doesn't record any sound though, or at least when I try and play it back I get nothing. Also it does the sound as raw, and not as a wav file. And if I run the record and try and play 2 times I get:

Warning Heap leaks detected.

I am using windows vista for an operating system.

I will happy to help test sound items for you on Vista.

The tone part of the example works fine as well.

I downloaded portaudio, and will try and figure out how to make it work.

David
Re: Anyone have a simple wav recorder/player that works? [message #33663 is a reply to message #33658] Sun, 04 September 2011 18:34 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

silverx wrote on Sun, 04 September 2011 15:17

Ok, I tried sound example in Bazaar, which uses the Portaudio. However, a few things. It will play a wav file ok.

One thing I forgot - it doesn't support every wav file. Only the basic uncompressed formats.

silverx wrote on Sun, 04 September 2011 15:17


It doesn't record any sound though, or at least when I try and play it back I get nothing. Also it does the sound as raw, and not as a wav file. And if I run the record and try and play 2 times I get:

Warning Heap leaks detected.


I'll try to have a look at this. There shouldn't be any leaks. Can you have a look into the recorded "raw" sound saved to file? If there is a problem with the portaudio part, it would be most probably all zero bytes. Does it detect any recording device in the info tab?

I'll also try to pull together some example of recording to wav file. Probably tomorrow, hope you don't hurry too much Smile

Honza
Re: Anyone have a simple wav recorder/player that works? [message #33664 is a reply to message #33663] Sun, 04 September 2011 20:22 Go to previous messageGo to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
It contains all 0's.
Re: Anyone have a simple wav recorder/player that works? [message #33665 is a reply to message #33663] Sun, 04 September 2011 20:23 Go to previous messageGo to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
I didn't find an info tab.

david
Re: Anyone have a simple wav recorder/player that works? [message #33685 is a reply to message #33648] Mon, 05 September 2011 18:28 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

I've uploaded some changes to the SoundExample package, most notably example code showing how to save recorded sound to wav file. It is pretty simple Wink

Now to your problems: By default, WMME and WASAPI backends are enabled, since they don't have any external dependecies. If you have installed DirectX SDK (and maybe set some include paths etc.), you can try to add more backends. It can be done simply by compiling with flags "GUI .WMME .WASAPI .DSOUND .WDMKS". It migh or might not help, I have never tested those.

Also, I will soon submit some changes that will allow to select the source for the recording (default is used now, for simplicity). I think that actually has a best chance to fix the problem for you...

As for the heap leaks, I didn't detect any :-/ Must be some specialty of Vista...

Honza
Re: Anyone have a simple wav recorder/player that works? [message #33686 is a reply to message #33685] Mon, 05 September 2011 20:34 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

dolik.rce wrote on Mon, 05 September 2011 18:28

Also, I will soon submit some changes that will allow to select the source for the recording (default is used now, for simplicity). I think that actually has a best chance to fix the problem for you...

Uploaded the new changes to the svn. You can now select which input device to use when recording. Can you try if you can get it working with at least one of them? Also, did you check that the inputs are not muted? Wink

When compiled in debug mode, the application emits a lot of informations about portaudio actions to stderr. There might be something interesting too...

Honza

Re: Anyone have a simple wav recorder/player that works? [message #33700 is a reply to message #33685] Tue, 06 September 2011 10:42 Go to previous messageGo to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
Thanks, for working on the code.

I got the new code, both of them.

I tried it and same result, except that the output file has:

000000000 52 49 46 46 24 60 03 00 57 41 56 45 66 6D 74 20 RIFF$` WAVEfmt
000000010 10 00 00 00 01 00 01 00 44 AC 00 00 44 AC 00 00 D D
000000020 01 00 08 00 64 61 74 61 00 60 03 00 00 00 00 00 data `
000000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


It is all 0's after the first little part of it. I tried it with various devices, and was never able to get it to play. When I tried to open the file in the play tab, it says it is not a valid wav file.

I got the heap leak detected a couple of times, then it went away doing the same thing. Not sure what is up with that.

Where would I find the stderr file? Is it the .pdb file? If so what do I need to be able to open and read the data in it?

David

Re: Anyone have a simple wav recorder/player that works? [message #33704 is a reply to message #33700] Tue, 06 September 2011 15:28 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

silverx wrote on Tue, 06 September 2011 10:42

I tried it and same result, except that the output file has:

000000000 52 49 46 46 24 60 03 00 57 41 56 45 66 6D 74 20 RIFF$` WAVEfmt
000000010 10 00 00 00 01 00 01 00 44 AC 00 00 44 AC 00 00 D D
000000020 01 00 08 00 64 61 74 61 00 60 03 00 00 00 00 00 data `
000000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


It is all 0's after the first little part of it. I tried it with various devices, and was never able to get it to play. When I tried to open the file in the play tab, it says it is not a valid wav file.
The non-zero bytes at the beginning are just the riff header. If you save it as raw bytes, it will be only the zeros. Since it happens for all the devices, the problem is probably something general ... I presume other recording software works as expected, right? As for the invalid file: I bet you just saved it as raw and tried to play it as wav Smile Playing the recorded wav in the other tab works for me.

silverx wrote on Tue, 06 September 2011 10:42

Where would I find the stderr file? Is it the .pdb file? If so what do I need to be able to open and read the data in it?
As I already said, I'm not a windows user... but if I remember correctly it should be possible to redirect the output when you run the app from cmd.exe, like this:
SoundExample.exe 2>stderr.log 1>stdout.log
Or simply run it from theide, after setting Debug>Run Options...>Standard output to "console" or "file".

Also, I'm leaving for a holiday tomorrow, so my answers will most probably be quite slow for a the next week or so...

Honza
Re: Anyone have a simple wav recorder/player that works? [message #33706 is a reply to message #33704] Tue, 06 September 2011 21:40 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

I upgraded the package to current upstream version of portaudio, just in case it would make some difference. But it seems it doesn't - I found out that I can experience the same bug when compiling and running the application in wine.

After some googling I found some hints about broken event-based recording in Vista. It is quite an old informations, but it might be related. If that it is the case, then possible workaround would be to use blocking interface. Unfortunately, I didn't have time to try it out yet, but if you want you can try yourself Wink It should be actually quite simple: Just use the SoundStream class from Sound package. You'd need to call OpenDefault() followed by Start() and then in some loop read the count of available bytes ReadAvailable() to figure out how much bytes can be safely retrieved by a call to Read(). You don't have to worry about the saving etc. for now, just check if the buffers have some non-zero values...

Honza

Re: Anyone have a simple wav recorder/player that works? [message #33719 is a reply to message #33706] Wed, 07 September 2011 14:49 Go to previous messageGo to next message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
Progress has been made. It records the sound if I use the WASAPI, however, when I use the play on that tab it sounds like someone is scratching the mike and has lots of static in it.

But if I go to the play wav tab, go down and find the saved file and play the sound it is all clear and fine. So not sure why, the one on the record page doesn't work.

Thanks for the help on this.

David
Re: Anyone have a simple wav recorder/player that works? [message #33783 is a reply to message #33719] Tue, 13 September 2011 13:04 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Senior Contributor

Hi David,
Sorry it took me so long to reply, I was off-line all week... Bu now I'm on my way home, so I'll be able to communicate normally again.

silverx wrote on Wed, 07 September 2011 14:49

Progress has been made. It records the sound if I use the WASAPI, however, when I use the play on that tab it sounds like someone is scratching the mike and has lots of static in it.

But if I go to the play wav tab, go down and find the saved file and play the sound it is all clear and fine. So not sure why, the one on the record page doesn't work.
I think I know what happened. When I rewrote it to support the device selection I changed the format of the saved sound a bit (from int8 to uint8) and forgot to make the same change for playback Smile I'll fix it soon. Now if you have good results with wasapi, you can just compile your app with .WASAPI flag, which will disable all other backends, so it will become default and should work without too much fiddling with the settings Wink

Honza
Re: Anyone have a simple wav recorder/player that works? [message #33818 is a reply to message #33783] Fri, 16 September 2011 09:15 Go to previous message
silverx is currently offline  silverx
Messages: 62
Registered: March 2011
Member
Let me know when you change the code for the player, and I will be happy to test it.

David
Previous Topic: Suggestion about Execute command
Next Topic: build flag problem
Goto Forum:
  


Current Time: Mon Jul 06 21:35:15 CEST 2020

Total time taken to generate the page: 0.01102 seconds