hey ... im a new member of this community
i have started developing python scripts for my phone
i made a voice messenger for laptop using pyaudio in python and using sockets to transfer data

self.pin=pyaudio.PyAudio()
                streamin=self.pin.open(format=self.format,
							   channels=self.channels,
							   rate=self.rate,
							   output = True,
							   frames_per_buffer = chunk)
		global wf
		while 1:
			data=self.sock.recv(4096)
			if data:
				streamin.write(data)

Above was my code for receiving data over socket and converting to audio...
i want to do the same over the phone in symbian s60 !
is it possible with the audio library in s60 ?
if not, is there a way i can import pyaudio in my phone ?

Recommended Answers

All 8 Replies

Moving to Python, as in this case more suitable for this question

i've already seen this tutorial ... but you didnt get my point...
i want a hack so that the person holding the phone speaks something and then that data is sent over a socket and vice versa...this site gave me information on how to record audio ...i dont want to use files even temporary ... want to rely solely on sockets ...

I get you.

Yes you can do this but what will be the audio format to put throught the socket???

You can use any of this python format.http://wiki.python.org/moin/Audio
i Find audioop and wav modules very handy to help your case.

You will have 2 Apps in to tatal.
1. One for the s60
2.For the recieving server.

But if i were you... i will write both as recieving and send sending server.
who know?

lol..yes i completely understand you...and i have three apps...but in a different way .. two are clients and one is a server (this provision so as to incorporate more than one client later)
i have made the client for my laptop and the server( using pyaudio in wav format ) ... they both work perfectly fine...
above is my code for receiving data over a socket and using pyaudio i convert it to voice...
i need a way through which i can do the same on my phone...
apparently the audio library on my phone isnt very helpful in this regard ... since i cant figure out a way to directly convert incoming data over socket to audio ...and
also ... this question has been bothering me for a while...

Ques ) Can i import other modules in my phone ( for python) other than the ones provided by default...it would be great if i could use lightblue or pyaudio on my phone too ..
and by the way .,.. thanks a lot for your help :)

PS : i went through the link you provided..but i assume all the wave functions defined there must open a wav file...which is what im trying to avoid...i only wish to open an audio stream and write straight to that audio stream ... looking at my code in my first post in thread might make my point more clearer...

Dos-killer,

The job is done i think.

Check with this link.
It will be great if you put the server on your notebook. Then you will have more control because you need to convert audio to MIDI because you can control that easily on the notebook to speed the audio transfer. Nokia CPU is a piece of ant brain. You need speed. Once the audio is converted to MIDI, s60 can handel MIDI without any issue.

Then use this S60 python module http://www.mobilenin.com/pys60/ex_sound_recorder_player.htm.

You code like this....

#Demo
import audio
import sockeck

## Like this

con,addr=s.accept()
midi=con.recv(1200)
audio.sound.play(midi)

#To record on the reciever ... Its very tricky. No that record do not have to finish. There must be a while 1: loop to keep sending data to both end.
# Here on the nokia.

audiorec=audio.sound.record()# kind of or you ....
socket.send(audiorec)

Take this link doc. http://www.mobilenin.com/pys60/resources/API_Reference_for_Python.pdf

Hay lil upvote will be nice ;)
Try this.....
;)

well thats exactly what i wanted...
and now i feel really stupid .. lol
but thanks a lot for your help ... i didnt receive much support over nokia forum ..

silly question...but doesnt nokia support wave ?
i have workede with wave and its lot easier to handle...midi seems to be a slight pain here.,.struggling with pygame...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.