954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with audio in s60

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 ?

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

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

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

Yep ...! python got what is takes.
go here my friend!

http://www.mobilenin.com/pys60/menu.htm

Happy coding ;)

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

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 ...

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

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?

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

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
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

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.....
;)

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

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 ..

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

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...

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: