KorsaR-ZN / wami-recorder

Automatically exported from code.google.com/p/wami-recorder
0 stars 0 forks source link

Audio sent OK but received only a tiny fraction on local client & local server, on a Windows PC #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start python server: C:\Python27\python server.py
2. start flash app ( I ran using FlashDevelop, after getting the same error in 
Firefox)
3. record, send. Hit play - nothing happens.

What is the expected output? What do you see instead?
I get a wav file created by the server in the specified location. For some 
reason the answer received by the client is way too small - the client reports 
receiving audio of 1138 bytes while the actual size was 
1892396 bytes.

What version of the WAMI recorder are you using? What version of Flash are you 
using?  In what browser?  On what operating system?
Windows PC. Tried both Firefox and from FlashDevelop, ran in FlashPlayer.

Describe your server-side set-up if it is relevant to this issue.
local python server

Please provide any additional information below.
I have set WamiParams.testPlayUrl = WamiParams.testRecordUrl = 
"http://localhost:9000"

Also I modified in the server.py
def do_GET(self):
        f = open("I:\my-flash\WAMI_PROJ_HTML_EU\server\python\\test.wav")
[.....]

    def do_POST(self):
        f = open("I:\my-flash\WAMI_PROJ_HTML_EU\server\python\\test.wav", "wb")
[.....]

Here's the server output:
Started server...
POST of length 1892396
Mister-VAIO - - [24/Jan/2012 13:37:24] "GET / HTTP/1.1" 200 -

Here's the client's output:
[Starting debug session with FDB]
WAMI Flash Version 1.0
No ExternalInterface - External.addCallback: setSettings
No ExternalInterface - External.addCallback: getSettings
No ExternalInterface - External.addCallback: startListening
No ExternalInterface - External.addCallback: stopListening
No ExternalInterface - External.addCallback: startRecording
No ExternalInterface - External.addCallback: stopRecording
No ExternalInterface - External.addCallback: getRecordingLevel
No ExternalInterface - External.addCallback: startPlaying
No ExternalInterface - External.addCallback: stopPlaying
No ExternalInterface - External.addCallback: getPlayingLevel
No ExternalInterface - External.addCallback: showSecurity
No ExternalInterface - External.call: null()
Listening...
Recording at rate: 22050
No ExternalInterface - External.call: null()
POST 1892396 bytes of type audio/x-wav
Expected Samples: 948017 Actual Samples: 946176
No ExternalInterface - External.call: null()
Unlistening.
openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false 
cancelable=false eventPhase=2 status=200 responseURL=null]
No ExternalInterface - External.call: null()
Playing audio of 1138 bytes.
Format: Rate: 22050 Channels 1 Bits: 16 Endian: littleEndian
Playing audio with 2188 samples.
Stop playing.
No ExternalInterface - External.call: null()

Original issue reported on code.google.com by andre...@gmail.com on 24 Jan 2012 at 12:00

GoogleCodeExporter commented 9 years ago
Thanks for filing an issue on this.  It looks like the "post" itself is going 
well.  On the server-side, I would try to print out: 
self.headers.getheader('content-length').  If it's the same as the number in 
"POST 1892396 bytes of type audio/x-wav", then it's probably the process of 
writing the file itself.  If the content-length is wrong, then maybe there is 
something we can do in SinglePost.as to set it correctly (I'd assumed it was 
being set automatically based on the request.data.length).

Original comment by mcgrawian@gmail.com on 28 Jan 2012 at 6:49

GoogleCodeExporter commented 9 years ago
Hi, 

I'm sorry, must have been my imperfect English skills.

The audio is sent ok to the server, and gets written to a test.wav file which 
plays fine with Winamp.

It also leaves ok the server following the GET request from the client, as 
shown by this printout:

Started server...
POST of length 159156
GET of length 159156

Somehow the WamiPlayer client only receives a fraction of it, as shown in the 
above printout. It's really strange. Communication is being done, the GET call 
gets to the server, which writes a file of the correct size.

I assume there's a problem on the client but can't figure out where it is.
I didn't modify the code in neither the client nor the server, except setting 
the correct paths and the server GET printout above.

Original comment by andre...@gmail.com on 30 Jan 2012 at 10:19

GoogleCodeExporter commented 9 years ago
To verify that the client is the problem, did you try to put 
"http://localhost:9000" in your browser.  In the GET request, you may need to 
specify a contentType of "x-wav" and perhaps give a content length.  This will 
verify that the server is not the problem.

Original comment by mcgrawian@gmail.com on 1 Feb 2012 at 1:14

GoogleCodeExporter commented 9 years ago
Thanks! Following on your advice to look more closer on the server code, I 
found this on a website:

# Always read in binary mode. Opening files in text mode may cause
# newline translations, making the actual size of the content
# transmitted *less* than the content-length!

Sure enough, I added "rb" to the open of the GET and it now works!
Thanks again

Original comment by andre...@gmail.com on 1 Feb 2012 at 7:28

GoogleCodeExporter commented 9 years ago

Original comment by mcgrawian@gmail.com on 4 Feb 2012 at 1:56

GoogleCodeExporter commented 9 years ago
I am a newbie and I am trying to capture audio locally on the box. I have the 
same specs as this thread, windows 7 with local python running server.py. I 
havnt modified server.py but I did modify the index.html file to use URL 
"http://localhost:9000". I run the python server and start recording however I 
do not know where the file is saving to. Question is where do you specify where 
to save the audio wav file and set its filename?

Original comment by shaunaa...@gmail.com on 21 Feb 2012 at 5:04

GoogleCodeExporter commented 9 years ago
That particular server saves it to a directory called /tmp... which probably 
doesn't exist on Windows.  Look towards the top of the .py file and change the 
directory to one of your choosing.

Original comment by mcgrawian@gmail.com on 21 Feb 2012 at 5:59