Getting valid PCM data from the Mic - Windows Mobile Development and Hacking General

Hey guys,
I am trying to record some pcm data from the built in microphone in my windows mobile 6 phone. (ATT Tilt)
I am using Waveform Audio functions to accomplish this and have a program written that looks for available input devices, lets me select from the found devices and then proceeds to store a few second's worth of data into my buffer.
Everything goes smoothly - the device opens and all of my calls to the waveform audio functions return MMSYSERR_NOERROR. When I start recording, I physically loop for the expected amount of time while I wait for the buffer to fill and once it finishes my WAVEHDR contains the expected number of samples.
The problem is that WAVEHDR.lpData is still all zero'd out (I zero it before I begin using it), except for the first byte which is always set to 0x03.
My two questions right now are these:
1 - My phone reports a single device, whose szPname is "Audio Input". Sounds pretty generic to me. I've not been able to find anything about what I should expect to see on google or searching the forums. I am wondering if this is really all I should be seeing?
2 - Assuming I am connecting to the correct input device to receive mic input, are there any cases where it might legitimately fill my buffer with zeroes?
Thanks,
Nick

Related

TAPI lineGetID on XDA II

Trying to write a program to record phone calls and act as answering machine. I'm initializing TAPI, opening the cellular line, then trying to use lineGetID to get the "wave/in" and "wave/out" devices id's, this last function call always returns the same error "the operation failed".
Any thoughts???
as I've wrote before it is impossible to make an answering machine. You can record phone calls, but cannot play anything to the line. It is a software limitation in CE 4.20
HOW can you record phone calls
(sounds handy when certain callcentre agents make promises)
built-in recorder can record calls. You may decompile it to find how it is working. I think that code used to record calls is the same as recording from a device microphone when the call is not active.
How would you use LineGetId in order to recieve data calls through TAPI ?? I'm struggling udnerstanding where this function should be implemented and what it actually does.
Thanks for all your help !!!
After you catch CONNECT event (media type is datamodem) you must get handler of opened serial device for data transmition
1)LPVARSTRING lpVarStr;
2)Allocate memory for lpVarStr;
3)Call lineGetID
for example: lineGetID(0, 0, hCall, LINECALLSELECT_CALL, lpVarStr, TEXT("comm/datamodem"))
4-th parameter means how call will be selected
LINECALLSELECT_CALL - select by specified call
also you can select by deviceID, address, line etc
last parameter specifies device class (look msdn for possible values)
4)check lpVarStr->dwNeededSize
5)Realloc lpVarStr
6)call lineGetID
7)get handle of serial device *(LPHANDLE)((BYTE*)lpVarStr + lpVarStr->dwStringOffset))
I think you will find that the ability to record the incoming audio is only as a result of the microphone picking up the audio from the speaker. I have tested everything I can think of to do this and hit a brick wall. firstly if you check the linedevcaps for each line device, non support the "wave/***" classes needed. Secondly the linegetid will always fail because of the way the line is being opened. To open a line correctly to use "wave/***" in linegetid, the dwmediamodes flag of lineopen needs to be set to LINEMEDIAMODE_AUTOMATEDVOICE. If you did not an error of LINEERR_INVALMEDIAMODE returns. If your error is LINEERR_OPERATIONFAILED, I think it could be coming from your timing of when you call linegetid. This will not work on any device I have because the hardware will not support it.
There is a physical seperation between the hardware that picks up and sends voice, and the computing hardware. I first encountered this while using an audiovox rtm8000 card in a toshiba e570. The modem built into the card can communicate data over the port but dose nothing with audio. That may sound irrelivant exept that later audiovox started selling the hardware combination built together under their brand as a pda phone to compeat with xda. They modified it by hooking the system speaker and mic up to the card with extra wires internally. All pda phones are arranged essentially like this. the fact that you cant see a seperate "phone card" makes it deceptive.
.
.
.
.
.
loose end. How dose my bluetooth wireless earpeice get the audio from my xdaII. Explore that, I am.

recording calls on wizard: SOLUTION

I have a working piece of soft:
[edit] Funny, their sire reads:
http://1800message.com/
CONFIDENTIAL, NOT FOR PUBLIC DISPLAY. DEMO SITE ONLY.
[/edit]
http://1800message.com/SPWM5CallRec.cab
http://king-bg.info/Temp/c500/soft/SPWM5CallRec.cab
It works, I have this to say:
1. I placed a shortcut to it in my STARTUP so it starts upon bootup, do you have any idea how I can make it start MINIMIZED?
2. As with all similar programs, the other party sound is with lower volume, but still can hear it
3. Records are in some internal format and can be played only with this program
Other the that I like it and it can be useful to you
Also note that in your country it may be illegal to record the conversations.
I use it mainly when someone call me with directions to some place ot phone numbers and so..
Something seems kinda fishy here, I highly doubt a company would post anything "highly confidential" and "not for public display" on PUBLIC INTERNET. Anyone else try this program? Seems like it could contain some malware/virus etc..
MilanoRex said:
Something seems kinda fishy here, I highly doubt a company would post anything "highly confidential" and "not for public display" on PUBLIC INTERNET. Anyone else try this program? Seems like it could contain some malware/virus etc..
Click to expand...
Click to collapse
I don't know what it is but it works on my PPC
do a google and it will pop-up on several other forums.
Well sounds fishy for me too...
Anyone else tried it?
this program only works if you have your speaker loud enough for your microphone to pick up the sound from it. I talked to their tech support last month and it went something like this.
> i've been playing around with pmvault and pm recorder on an htc wizard
> phone. Vault works flawlessly and is so convenient. Recorder doesn't
> record incoming audio though. My voice can be heard fine, but not the
> person I'm talking to. I know that the wizard devices are pocket pcs and
> not smartphones, but WM5 for ppc is supposed to run programs for both. Any
> thoughts on it?
>
The Wizard does not support the dual audio path. the HTC Tornado and Cingular 2125 both support it, but the PPC Wizard does not. Sorry about that. It is a hardware limitation on the device.
as already has been said,
the wizard will only record the audio picked up by the microphone,
if the speaker is loud enough the sound is picked up.
You may also want to read http://www.pocketpcmag.com/blogs/index.php?blog=3&p=513&more=1 on this subject - it gives a nice overview of what you can expect from PPC PE devices and what applications there're to (even automatically) record phone calls.
from my understanding it must be possible to access the incoming GSM audio stream - somehow it must be handed over to the CE-side, as the bluetooth driver also gets that stream - or did I get it wrong??? *confused*
Mamaich says that the GSM audio is wired directly into the bluetooth hardware.
V
vijay555 said:
Mamaich says that the GSM audio is wired directly into the bluetooth hardware.
V
Click to expand...
Click to collapse
so does that mean it is also not possible to record a phone call if you are using a BT headset?
Or a little bluetooth device that does the recording? ...

VoIP: SJPhone & TyTN | solution for choppy audio

Having installed SJPhone 3.20b for Windows Mobile 5.0 (download from: http://www.sjphone.org/preview/ce/) I experienced very choppy inbound audio.
The solution is changing SJPhone's advanced audio settings as follows:
buffer size: 80 ms
input queue length: 10
output queue length: 5
RTP jitter queue length: 5
Audio quality through WLAN is quite okay now. As soon I'm in a place with 3G coverage I'll try to place a VoIP call over 3G, if O2 Germany hasn't blocked VoIP ports yet.
I am getting better resutls with these settings:
Driver buffer size, msec: 100
Driver input queue length: 10
Driver output queue length: 10
RTP jitter queue length: 32
Btw, x-lite ce 1.01 has better quality than SJphone, at least on my TyTN, download here:
http://forum.xda-developers.com/viewtopic.php?t=58154
Also, calls must be done using the USB headset otherwise you get horrybly echo.
I do have the sound coming from the rear speaker...is that what you have?
Further, the sound with SJphone is absolutely horrible...whatever the audio settings....
I tried X-lite..gives same effects...
It s really unusable.
When I call the same correspondant with my PC, it s seemless..
Any clues?
Thx
use the usb headset
No sound...
Hi. I am using HTC X01HT (Softbank) which is supposed to be equivalent to TyTN. I installed SJphone but for some reason no sound is coming. Seemingly, even though I don't hear any sound, the recipient phone is normally ringing. Of course, even if the recipient picks up the phone, still silence on both sides. Any solution? Thank you in advance.
Check your SIP and NAT settings. You'll have problems if your internet connection or the voip server you are connecting to are behind a NAT.
You should use a STUN-server!
@Poof
Hi Poof,
Sorry for the trivial question but I geuss that answer isn't that obvious as it seems. YOu've mentioned that you're using X-Lite with some specific settings. I've downloaded the software using the link you had provided. I did manage to specify the SIP proxy and other SIP related settings during the first run of X-Light.
My question is: HOW DO YOU CHANGE OTHER SETTINGS? In case I need to change SIP IP HOW DO I DO THAT? I didn't succeed with finding searate file responsible for configuration nor I cold find settings changes option in the application itself.
I'd appreciate if you could advice me on these mattares.
TyTN and SJPhone
Hi,
I get horrible sound delays with SJPhone + TyTN. I tried all the settings from this forum and many others and although the sound quality seems OK (I didn't see any significant improvement because of the USB headsed) the delay is 2 to 3 times bigger (up to 1.5-2 s) than on my Wizard.
Please let me know if the above mentioned settings don't give you any delay. If there's no delay, could you please let me know the ROM (and any possible improvements) that you're using?
Please follow this thread also for news:
http://forum.labs.softjoys.com/viewtopic.php?t=409&postdays=0&postorder=asc&start=20
As for the X-Lite application - I get also delays and bad sound quality. As for its interface - it makes you go nuts, and even more. I never managed to find out how to change the settings for one SIP-account. (through the registry ? this is a joke, right?) Even the PC version is made as if that guy wanted to make a patience testing quiz, not a softphone.
Thank you all.
USB headset
It seems it has something to do wih the USB headset. If I use it - SJPhone gets stuck. If I don't use it - SJPhone runs fine and even the sound quality is acceptable
realn said:
Hi,
I get horrible sound delays with SJPhone + TyTN. I tried all the settings from this forum and many others and although the sound quality seems OK (I didn't see any significant improvement because of the USB headsed) the delay is 2 to 3 times bigger (up to 1.5-2 s) than on my Wizard.
Please let me know if the above mentioned settings don't give you any delay. If there's no delay, could you please let me know the ROM (and any possible improvements) that you're using?
Please follow this thread also for news:
http://forum.labs.softjoys.com/viewtopic.php?t=409&postdays=0&postorder=asc&start=20
As for the X-Lite application - I get also delays and bad sound quality. As for its interface - it makes you go nuts, and even more. I never managed to find out how to change the settings for one SIP-account. (through the registry ? this is a joke, right?) Even the PC version is made as if that guy wanted to make a patience testing quiz, not a softphone.
Thank you all.
Click to expand...
Click to collapse
You can change the settings in the X-Lite app by dialing *311 and *611, these take you to the settings pages. I have however not been able to connect to the network in any way, perhaps you can shed light on the right settings, pof? I am using a voipstunt account, but I have no idea what settings I should use to get a connection to the internet. I have entered the voipstunt settings I found on their website and my account data, but for some reason the app wil not connect.
edit: For some reason when dialing a fixed line phone numer, the Caller is is displayed on the screen as the whole phone numer followed by @voipstunt.com, e.g [email protected]. It looks like the app is trying to reach a voipstunt subsciber instead of a fixed line. How did you get this to work pof? The app keeps trying for a while and then reports Call failed: 480, temporarily not available.
edit 2: Duh, I really have to learn to try more before I post here. I think that by editting the right options and using it over 3G instead of AS I have been able to connect. I cannot try any calls however, none of my contacts with fixed lines appears to be home at the moment (Or they are refusing my calls, also a likely possibility)
Really annoying though is that the app does not sound the waiting tone when it is calling a no., so you have no idea wether or not it is dialing or the connection is just not being made.
I've just installed the latest sjphone beta for ce, to use with fwd. I can't find where to change the advanced audio options. In fact the only audio control I can find is the audio wizard. Can anyoine help me.
In addition my usb headphones long since stopped working, would sound and mic be better with a bluetooth headset (in my case the itech r35) or through the phone itself?
Currently audio is unuseable using the phone, and apparently not working at all with the bluetooth headset.
Your assistance appreciated.

Looking for a specific program/piece of code

Hi,
I am currently looking for a piece of software that will do a specific job, or possibly a better solution to what I am trying to do. Let me give you a little bit of background...
I have got an O2 XDA Mini S, and a Parrot hands-free kit that does not support the A2DP bluetooth profile (only the handsfree profile). I am currently using TomTom 6 on my XDA with a bluetooth GPS unit. Everything works really nicely together, except I cannot get instructions from TomTom through my parrot (which is ultimately my goal).
The only way I can see of getting the TT instructions through my Parrot is to make use of the programs floating about that allow you to turn on and off redirection of sound through bluetooth. The idea I had was that if there was a program about (or maybe even write something myself) that would be able to signal when the sound coming out of the XDA exceeded and then dropped back below a threshold level, and then somehow link that into the bluetooth redirection programs, I could basically have any sound that is produced go through the Parrot only when they occur (including obviously the TT instructions).
Does anybody have any ideas on this? Any help would be greatly appreciated.
Thanks.
Point UI, a UI wrapper, has a feature similar to what you're describing. It's used just to save battery power by turning on BT only when an incoming call is detected, and then killing BT after the call is ended. I don't know if it's open source, but you might want to head over to their forums and see if you can find out how they did it.
You probably also want to haunt any TomTom forum sites (if any even exist).
As a final option, look into Mortscripts. People have done amazing tricks with Mortscripts, and this might be just the ticket. Mort haunts these boards, and may pipe in with an "I can (or cannot) do that with Mortscript" too...
I have a question, though. What's wrong with using the Wizard's built-in speakers for getting directions?
Myrddin Wyllt said:
I have a question, though. What's wrong with using the Wizard's built-in speakers for getting directions?
Click to expand...
Click to collapse
To be honest, it's not too bad through the speakers although if I have my radio on which I usually do, sometimes it can be a little bit hard to hear, and it would be nice to just have the radio mute while it gives me the directions.
It's more of a "want" than a "need" really.
Thanks very much for the info
Myrddin Wyllt said:
Point UI, a UI wrapper, has a feature similar to what you're describing. It's used just to save battery power by turning on BT only when an incoming call is detected, and then killing BT after the call is ended. I don't know if it's open source, but you might want to head over to their forums and see if you can find out how they did it.
Click to expand...
Click to collapse
It is quite easy for programs to detect when you're in a call - MortScript, I presume, probably can detect that quite easily as it's an overall Windows feature and will probably have a readily available part in the API.
The problem is not with turning the bluetooth on and off, it's actually detecting when TomTom is giving an instruction. To be honest I think I'll look into MortScript and if that can't do it then I'll probably just give up.
Detecting phone calls isn't that easy, and it's especially not easy to make a check in a simple procedural script language like MortScript (up to WM5, there's no way to check whether a call is active, you have to monitor all the time if a call is accepted or hung up).
Detecting sound output of another application is entirely impossible - at least for most applications. If the app opens the output channel only during output (which most don't because it takes valuable time and causes ugly "click" noises on some devices), one could maybe query the number of free output channels - but that would need a CPU hog monitoring all the time, or half of the message would be over until it's detected.
And even if that would work, there's simply no way to redirect output to a BT headset (except with A2DP). At least on most devices. Once there was a simple way to do that (you just had to open a virtual port, and as long as it's open, everything was redirected similar to the A2DP way nowadays), but most manufacturers didn't implement it, and nowadays it seems like no modern device supports it anymore. (Had it for test purposes in a MortPlayer beta, no user reported it works...)
So, to put it short: Currently it's impossble. Maybe WM8 might change that... (Few hope for WM7, it's proposed to have the same kernel as WM5 and WM6.x)

Audio capture problem

Hi
We are developing a push-to-talk app -- Loudtalks. The free version is quite popular and many people on this forum use it.
We spent the last two days trying to fix or isolate a problem reported by a user with Hermes 200 -- all outgoing messages come silent and show up with 0:00 duration in History, even though the connection is good and everything else (including incoming messages work perfectly).
Still no luck. The last thing we found is that our code receives just 2 audio buffers from the sound card in 3 seconds, while normally that should be more like 30...
The same code (standard wave api stuff) works fine on many other devices. Is there any Hermes/HTC-specific secrets or hacks?
Or could you try it and report back if it works and which ROM/radio are you on? We don't have the device to test with so kind of walking in the dark... but very much want to have mystery fixed.
Here is today's build:
http://loudtalks.com/data/LoudtalksMobileSetup.cab
More details:
- We are using 8000 Hz, 16 bits per sample, mono sound format
- waveInStart fails returning 0x00000001 ( #define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */ HUH?)
Thanks!

Categories

Resources