Re: Requesting audio samples using gstreamer

2007-10-21 Thread Sayamindu Dasgupta

On Sun, 2007-10-21 at 12:56 +0530, Arjun Sarwal wrote:
> Is there a way to explicitly request samples from Alsa using
> gstreamer ?
> 
> Currently, I set up a pipeline comprising of alsasrc and fakesink as
> the elements and have connected the handoff signal to a signal handler
> function. I've set sampling to 48Khz, 16bit, single channel. Within
> the signal handler function I get a buffer/list of  480,  16bit values
> when the handoff signal is emitted. It'd be great if I could request
> samples on the fly using gstreamer. 


I'm not very sure, but would the audiotestsrc element help here ?

From
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audiotestsrc.html

Description
AudioTestSrc can be used to generate basic audio signals. It support
several different waveforms and allows you to set the base frequency and
volume.


Example launch line
gst-launch audiotestsrc ! audioconvert ! alsasink

This pipeline produces a sine with default frequency (mid-C) and volume.

gst-launch audiotestsrc wave=2 freq=200 ! audioconvert ! tee name=t !
queue ! alsasink t. ! queue ! libvisual_lv_scope ! ffmpegcolorspace !
xvimagesink

In this example a saw wave is generated. The wave is shown using a scope
visualizer from libvisual, allowing you to visually verify that the saw
wave is correct.

Regards,
Sayamindu



-- 
সায়মিন্দু দাশগুপ্ত (Sayamindu Dasgupta)
http://sayamindu.randomink.org/ramblings

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Requesting audio samples using gstreamer

2007-10-21 Thread Benjamin M. Schwartz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arjun Sarwal wrote:
> Is there a way to explicitly request samples from Alsa using gstreamer ?

Not that I'm aware of.  You could set up a gstreamer pipeline that writes raw
audio into a named pipe (FIFO), and then read the data out of the FIFO in
python, throwing away data you don't want.

If you're recording from the microphone, amplifier weirdness requires an
approach like this, because the microphone must be turned on well before you
start recording (see bug 3813).  I don't know if there's an amplifier between
the line-in and ADC.

- --Ben
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHCbPUJT6e6HFtqQRAlrJAKCNxLpg44QGETi+nhXzDhB3upn2nACeKS5x
FdJFtCSc8pxOo7GrPSqpLJ4=
=fkHg
-END PGP SIGNATURE-
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Calibration of Software/Measure activity

2007-10-21 Thread Hal Murray

[EMAIL PROTECTED] said:
> As work on a USB ADC continues, somewhere along the lines the problem
> of calibration came up both with regards to the sound card, and the
> in-development peripheral. 

There are 2 dimensions to calibration: time and voltage.

How accurate do you need?  (or want?)

Calibrating the time should be simple.  All you need to know is the frequency 
that the A/D is collecting samples, so time how long that takes...  A simple 
user program could grab the time, collect a large number of samples, then 
grab the time again and do the calculations.  You need a lot of data so that 
the time to get started/stopped doesn't introduce much of an error.  Try a 
second or so, and compare that with twice as long.

That assumes your CPU clock is accurate.  (You are comparing the CPU clock 
with the A/D clock.)  That's probably a reasonable assumption.

The sound card runs off the CPU crystal.  If you are using it, the nominal 
value should be very close.  (It would be worth checking.)

The schematic that you posted the URL for a few days ago used an 8051 without 
an external crystal.  I assume it's running on an internal R/C oscillator.  See 
Mitch's comments.  The data sheet probably has some specs for accuracy.

The 8051 has a couple of pins labeld XTAL.  t might be worth leaving space on 
the board for a crystal connected to those pins.  Using it will probably 
require tweaking a mode bit in the 8051.


I don't know a great way to calibrate the voltage.

The obvious quick and easy way is to compare the A/C with a good meter.  That 
requires a good meter.  Handheld DVMs are usually good for around 1%.

You can get chips that make a reference voltage.  Higher accuracy or better 
temperature stability cost more.  Google for LM4132 if you want a straw man.  
There are probably cheaper ones.  That was just the first one I hit.

I remember an old tale of using fresh batteries for a reference.  It woiuld be 
fun to test that.


-- 
These are my opinions, not necessarily my employer's.  I hate spam.



___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Calibration of Software/Measure activity

2007-10-21 Thread Mitch Bradley
Ceramic resonators are less expensive than crystals.  Their stability 
and accuracy is not as good as crystals, but is much better than RC 
oscillators.

The waveform that comes from most oscillators is nominally a square 
wave, but when the frequency gets into the tens of megahertz range, it 
usually doesn't look particularly square on an oscilloscope.

In order of cost, from highest to lowest, the usual timing alternatives are:

a) Self-contained crystal oscillator
b) Built-in oscillator circuit stabilized with a crystal
c) Built-in oscillator circuit stabilized with a ceramic resonator
d) Built-in oscillator circuit timed with RC components.



Ian Daniher wrote:
> As work on a USB ADC continues, somewhere along the lines the problem 
> of calibration came up both with regards to the sound card, and the 
> in-development peripheral.
> It was quickly suggested that a crystal oscillator based circuit be 
> used to generate square waves to help calibrate the time scale of the 
> measure activity.
> This might also help calibrate voltages, as well.
> I bounced this suggestion off the ##electronics guys and the 
> conversation went something like this:
> (02:10:12 PM) *DyDisMe:* Crystal oscillators generate square wave 
> pulses, right?
> (02:10:19 PM) SpeedEvil: depends
> (02:10:29 PM) SpeedEvil: you can get them producing anything from 
> squarewave to sine
> (02:10:43 PM) SpeedEvil: to some sort of rectangle poorly specified.
> (02:11:00 PM) *DyDisMe:* I'm attempting to come up with a method of 
> cheap calibration
> (02:11:10 PM) SpeedEvil: For what?
> (02:11:16 PM) *DyDisMe:* the soundcard of the hardware I'm developing 
> for is built with 5% parts.
> (02:11:17 PM) icee: most oscillators you buy put out squarewave though
> (02:11:20 PM) icee: oscillator modules
> (02:11:22 PM) *DyDisMe:* ok
> Anyone have suggestions, questions, comments, etc?
> -- 
> Ian Daniher
> [EMAIL PROTECTED] 
> Skype : it.daniher
> irc.freenode.com : DyDisMe
> 
>
> ___
> Devel mailing list
> Devel@lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>   

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Calibration of Software/Measure activity

2007-10-21 Thread Ian Daniher
As work on a USB ADC continues, somewhere along the lines the problem of
calibration came up both with regards to the sound card, and the
in-development peripheral.
It was quickly suggested that a crystal oscillator based circuit be used to
generate square waves to help calibrate the time scale of the measure
activity.
This might also help calibrate voltages, as well.
I bounced this suggestion off the ##electronics guys and the conversation
went something like this:
(02:10:12 PM) *DyDisMe:* Crystal oscillators generate square wave pulses,
right?
(02:10:19 PM) SpeedEvil: depends
(02:10:29 PM) SpeedEvil: you can get them producing anything from squarewave
to sine
(02:10:43 PM) SpeedEvil: to some sort of rectangle poorly specified.
(02:11:00 PM) *DyDisMe:* I'm attempting to come up with a method of cheap
calibration
(02:11:10 PM) SpeedEvil: For what?
(02:11:16 PM) *DyDisMe:* the soundcard of the hardware I'm developing for is
built with 5% parts.
(02:11:17 PM) icee: most oscillators you buy put out squarewave though
(02:11:20 PM) icee: oscillator modules
(02:11:22 PM) *DyDisMe:* ok
Anyone have suggestions, questions, comments, etc?
-- 
Ian Daniher
[EMAIL PROTECTED]
Skype : it.daniher
irc.freenode.com: DyDisMe
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Sugar API pydoc string (Re: OLPC News 2007-10-20)

2007-10-21 Thread Pascal Scheffers
Hi,

On 20-okt-2007, at 20:49, Walter Bender wrote:
> 26. How-tos/documentation: A few groups have independently developed
> their own "how-tos" about using Sugar and the XOs. Christoph Derndofer
> and Eduardo Silva each took a stab at how-tos for using activities and
> Todd Kelsey and Val Scarlatta worked on updating the 542 Demo Notes
> with more detailed information from the wiki and updates for recent

I'm also doing some documentation.

I've written some python doc strings for the python sugar base class  
sugar.activity.Activity. Tomeu told me to 'use the source' and it  
seems like a good idea to keep at least the API docs tightly bound to  
the actual sources. I'll do some more of those on the other basic  
APIs I'll be needing at least for my own activities.

They are slightly verbose, not too formal, so the children can use  
them too. Especially the file and class level comments will contain  
general 'do this to get a working Activity' hints.  See https:// 
dev.laptop.org/ticket/4358 or the source once someone has committed  
them.

> builds. John Gilmore wrote in with his own ideas for help files. There
> is a group discussion planned for next Saturday to bring these similar
> works together.

I think it would be very nice to try to tie the API docs into the How- 
tos and other docs on the wiki. This discussion is planned on IRC?  
Where, when?

- Pascal.


___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Measure Scale

2007-10-21 Thread Arjun Sarwal
Ian,

There is a grid (light grey) overlayed on the black background.

In Version 9 of Measure there used to be a show/hide details option that
showed you details about the signal (rms,pk-pk and average values) and
showed you the X Axis scale and Y Axis scale
For example
Scale X Axis: One division = 5ms
Scale Y Axis : One division = 40mV etc...

It needed some refinements (and also needs an icon) so has been out for
version 11 but should be back again in the next version!

Technically, calibration is needed because the circuit is populated with 5%
parts , but I thought that the procedure would be tough for kids and have
not yet incorporated it.

Suggestions/thoughts welcome.

regards,
Arjun



On 10/21/07, Ian Daniher <[EMAIL PROTECTED]> wrote:
>
> Arjun et alia,
> Is there a functional scale for the measure program?
> Is it possible to display a grid representing this scale in the
> background, to potentially provide more functionality as an o'scope?
> Would it necessitate calibration?
> Thanks,
> --
> Ian Daniher
> [EMAIL PROTECTED]
> Skype : it.daniher
> irc.freenode.com: DyDisMe




-- 
Arjun Sarwal ( [EMAIL PROTECTED] )
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Measure Scale

2007-10-21 Thread Ian Daniher
Arjun et alia,
Is there a functional scale for the measure program?
Is it possible to display a grid representing this scale in the background,
to potentially provide more functionality as an o'scope?
Would it necessitate calibration?
Thanks,
-- 
Ian Daniher
[EMAIL PROTECTED]
Skype : it.daniher
irc.freenode.com: DyDisMe
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Journal integration doubt

2007-10-21 Thread Ivan Krstić
On Oct 21, 2007, at 1:10 PM, Arjun Sarwal wrote:
> am trying to associate with the journal object would basically  
> contain the file paths of the logs made in that session

Make sure you're storing the full files -- not paths -- in the  
journal, e.g. as a zip file.

> #Create a unique file name using the current time
> self._jobject.file_path = os.path.join("/tmp/myLogs" + str(time.time 
> ()))

Don't do this. See os.tmpfile() or the tempfile module.

(Journal/activity questions are more appropriate for sugar@; Reply-To  
set.)

--
Ivan Krstić <[EMAIL PROTECTED]> | http://radian.org
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Journal integration doubt

2007-10-21 Thread Tomeu Vizoso
On Sun, 2007-10-21 at 16:40 +0530, Arjun Sarwal wrote:
> I am trying to associate a simple text file with the journal object.
> Within a logging session of Measure activity, many logs are created
> and the file that I am trying to associate with the journal object
> would basically contain the file paths of the logs made in that
> session so that when the session is resumed from the journal those log
> files can be opened and displayed on the oscilloscope like interface.
> 
> The seperate log files get created and written properly. However, I am
> facing problems regarding the main file that I try and associate with
> the Journal object. This file does get created but disappears when I
> quit the activity. I have attached relevant code portions below. 
> 
> Please point me to some code that might be doing something similar to
> what I am trying to do or let me know where I am going wrong.

I see you case similar to what Record does, here is the code:

http://www.mediamods.com/public-svn/camera-activity/tags/33/

Most python activities just have to implement the read_file and
write_file methods in their Activity subclass. Record is a bit more
complicated, because apart from the session data, it also creates an
object in the journal for every photograph and every recording, so they
can be dragged around or opened with other activities.

In your case, if you don't need to make each individual log accessible
to other activities, you could just write a zip file containing all your
logs in the write_file method. In this case, see this example activity
from Marco:

git-clone http://dev.laptop.org/~marco/edit-activity/

Hope this helps,

Tomeu

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Journal integration doubt

2007-10-21 Thread Arjun Sarwal
I am trying to associate a simple text file with the journal object. Within
a logging session of Measure activity, many logs are created and the file
that I am trying to associate with the journal object would basically
contain the file paths of the logs made in that session so that when the
session is resumed from the journal those log files can be opened and
displayed on the oscilloscope like interface.

The seperate log files get created and written properly. However, I am
facing problems regarding the main file that I try and associate with the
Journal object. This file does get created but disappears when I quit the
activity. I have attached relevant code portions below.

Please point me to some code that might be doing something similar to what I
am trying to do or let me know where I am going wrong.

many thanks,
Arjun


#Create a unique file name using the current time
self._jobject.file_path = os.path.join("/tmp/myLogs" + str(time.time()))

#Create the metadata file to be associated with the journal object
#and write a first line to it
self.f = open(self._jobject.file_path, 'w')
self.f.write("Measure Activity logs metadata file\n")


#Now generate a unique name for the log file and write the name of the log
file #created into the metadata file
self.file_name = ("/tmp/myLogs" + str( time.time()))
self.log_file = open(self.file_name, 'w')
self.f.write(self.file_name + "\n")


#Close metadata file
self.f.close()
self.datastore.write(self._jobject)


#Write the required values onto the log file(s) and then close it(them)
self.log_file.write(str(value1))
self.log_file.write(str(value2))
self.log_file.close()
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Hosting Request

2007-10-21 Thread Antoine van Gelder
1. Project name : jokemachine
2. Existing website, if any : http://wiki.laptop.org/go/Joke_Machine
3. One-line description : Joke Machine allows XO users to start a 
multimedia jokebook with images and sound effects and invite others to 
read their jokes via the mesh.
4. Longer description   : Friends can also submit their own jokes to 
a shared jokebook.
 : The jokebook author can edit and reject 
all submissions.
 : Children love to hear and tell jokes.
 : This activity helps with reading, writing 
and cultural learning.
 : Each culture has its own jokes which 
reflect a unique world perspective.
5. URLs of similar projects : N/A

6. Committer list
Please list the maintainer (lead developer) as the first entry. Only 
list
developers who need to be given accounts so that they can commit to your
project's code repository, or push their own. There is no need to list
non-committer developers.

   Username  Full name   SSH2 key URLE-mail
     -   --
#1 antoine   Antoine van Gelder 
http://laptop.org.za/~antoine/id_rsa.pub[EMAIL PROTECTED]
#2
#3
   ...

If any developers don't have their SSH2 keys on the web, please 
attach them
to the application e-mail.

7. Preferred development model

[X] Central tree. Every developer can push his changes directly to the
project's git tree. This is the standard model that will be 
familiar to
CVS and Subversion users, and that tends to work well for most 
projects.

[ ] Maintainer-owned tree. Every developer creates his own git tree, or
multiple git trees. He periodically asks the maintainer to look 
at one
or more of these trees, and merge changes into the maintainer-owned,
"main" tree. This is the model used by the Linux kernel, and is
well-suited to projects wishing to maintain a tighter control on 
code
entering the main tree.

If you choose the maintainer-owned tree model, but wish to set up some
shared trees where all of your project's committers can commit 
directly,
as might be the case with a "discussion" tree, or a tree for an 
individual
feature, you may send us such a request by e-mail, and we will set 
up the
tree for you.

8. Set up a project mailing list:

[ ] Yes, named after our project name
[ ] Yes, named __
[X] No

When your project is just getting off the ground, we suggest you eschew
a separate mailing list and instead keep discussion about your project
on the main OLPC development list. This will give you more input and
potentially attract more developers to your project; when the volume of
messages related to your project reaches some critical mass, we can
trivially create a separate mailing list for you.

If you need multiple lists, let us know. We discourage having many
mailing lists for smaller projects, as this tends to
stunt the growth of your project community. You can always add more 
lists
later.

9. Commit notifications

[ ] Notification of commits to the main tree should be e-mailed to 
the list
we chose to create above
[ ] A separate mailing list, -git, should be created 
for commit
notifications
[X] No commit notifications, please

10. Shell accounts

As a general rule, we don't provide shell accounts to developers unless
there's a demonstrated need. If you have one, please explain here, and
list the usernames of the committers above needing shell access.

11. Notes/comments:

None
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Requesting audio samples using gstreamer

2007-10-21 Thread Arjun Sarwal
Is there a way to explicitly request samples from Alsa using gstreamer ?

Currently, I set up a pipeline comprising of alsasrc and fakesink as the
elements and have connected the handoff signal to a signal handler function.
I've set sampling to 48Khz, 16bit, single channel. Within the signal handler
function I get a buffer/list of  480,  16bit values when the handoff signal
is emitted. It'd be great if I could request samples on the fly using
gstreamer.

thanks,
Arjun
-- 
Arjun Sarwal ( [EMAIL PROTECTED] )
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel