[LAD] reading and writing to /dev/dsp

2009-07-23 Thread Girish Hilage

Hi,

I am running a .mp3 file using 'xine' without any issues on my Fedora
Core 8 machine.

I am reading /dev/dsp and storing it in some file.
i.e. cat /dev/dsp  musicfile

Now I am stopping 'xine' and then writing 'musicfile' to /dev/dsp.
i.e. cat musicfile  /dev/dsp

In this case I can hear the music but with a lot of noise in it.
Is there any way I can remove/reduce this noise from 'musicfile'?

I also tried following program (it records the voice and plays it
immediately) that I got from net to understand how to write to /dev/dsp
but it does not seem to record my voice and hence plays nothing and
there is noise only.

---
#include unistd.h
#include fcntl.h
#include sys/types.h
#include sys/ioctl.h
#include stdlib.h
#include stdio.h
#include linux/soundcard.h

#define LENGTH 3/* how many seconds of speech to store */
#define RATE 8000   /* the sampling rate */
#define SIZE 8  /* sample size: 8 or 16 bits */
#define CHANNELS 1  /* 1 = mono 2 = stereo */

/* this buffer holds the digitized audio */
unsigned char buf[LENGTH*RATE*SIZE*CHANNELS/8];

int main()
{
int fd; /* sound device file descriptor */
int arg;/* argument for ioctl calls */
int status;   /* return status of system calls */

/* open sound device */
fd = open(/dev/dsp, O_RDWR);
if (fd  0) {
perror(open of /dev/dsp failed);
exit(1);
}

/* set sampling parameters */
arg = SIZE;/* sample size */
status = ioctl(fd, SOUND_PCM_WRITE_BITS, arg);
if (status == -1)
perror(SOUND_PCM_WRITE_BITS ioctl failed);
if (arg != SIZE)
perror(unable to set sample size);

arg = CHANNELS;  /* mono or stereo */
status = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, arg);
if (status == -1)
perror(SOUND_PCM_WRITE_CHANNELS ioctl failed);
if (arg != CHANNELS)
perror(unable to set number of channels);

arg = RATE;/* sampling rate */
status = ioctl(fd, SOUND_PCM_WRITE_RATE, arg);
if (status == -1)
perror(SOUND_PCM_WRITE_WRITE ioctl failed);

while (1) { /* loop until Control-C */
printf(Say something:\n);
status = read(fd, buf, sizeof(buf)); /* record some sound */
if (status != sizeof(buf))
perror(read wrong number of bytes);
printf(You said:\n);
status = write(fd, buf, sizeof(buf)); /* play it back */
if (status != sizeof(buf))
perror(wrote wrong number of bytes);
/* wait for playback to complete before recording again */
status = ioctl(fd, SOUND_PCM_SYNC, 0);
if (status == -1)
perror(SOUND_PCM_SYNC ioctl failed);
}
}
---
Regards,
Girish

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Paul Davis
On Thu, Jul 23, 2009 at 6:09 AM, Girish
Hilagegirish_hil...@persistent.co.in wrote:

 Hi,

 I am running a .mp3 file using 'xine' without any issues on my Fedora Core 8
 machine.

 I am reading /dev/dsp and storing it in some file.
 i.e. cat /dev/dsp  musicfile

 Now I am stopping 'xine' and then writing 'musicfile' to /dev/dsp.
 i.e. cat musicfile  /dev/dsp

 In this case I can hear the music but with a lot of noise in it.
 Is there any way I can remove/reduce this noise from 'musicfile'?

what actual task are you attempting to accomplish?
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Girish Hilage
Hi Paul,

   Thanks for your reply.

   The scenario is as follows :
   I have an FC8 machine and suppose my friend have a RH9 machine.
   I want to make him hear on his machine the song I am playing in
'xine' on my system.

   For that I have written a 'daemon' which listens for connections from
client and reads from /dev/dsp and writes to client.
   The 'client' I have written is running on RH9, which connects to the
daemon on FC8 and reads from it and writes to /dev/dsp on RH9.

   On RH9 I can hear the song but with a lot of noise which I want to
eliminate.
   Can it be done using some other tool like (sox, play or padsp etc.)?

Regards,
Girish


-Original Message-
From: Paul Davis p...@linuxaudiosystems.com
To: Girish Hilage girish_hil...@persistent.co.in
Cc: linux-audio-dev@lists.linuxaudio.org
linux-audio-dev@lists.linuxaudio.org
Subject: Re: [LAD] reading and writing to /dev/dsp
Date: Thu, 23 Jul 2009 17:50:15 +0530


On Thu, Jul 23, 2009 at 6:09 AM, Girish
Hilagegirish_hil...@persistent.co.in wrote:

 Hi,

 I am running a .mp3 file using 'xine' without any issues on my Fedora Core 8
 machine.

 I am reading /dev/dsp and storing it in some file.
 i.e. cat /dev/dsp  musicfile

 Now I am stopping 'xine' and then writing 'musicfile' to /dev/dsp.
 i.e. cat musicfile  /dev/dsp

 In this case I can hear the music but with a lot of noise in it.
 Is there any way I can remove/reduce this noise from 'musicfile'?

what actual task are you attempting to accomplish?

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Paul Davis
On Thu, Jul 23, 2009 at 8:49 AM, Girish
Hilagegirish_hil...@persistent.co.in wrote:
 Hi Paul,

    Thanks for your reply.

    The scenario is as follows :
    I have an FC8 machine and suppose my friend have a RH9 machine.
    I want to make him hear on his machine the song I am playing in 'xine' on
 my system.

    For that I have written a 'daemon' which listens for connections from
 client and reads from /dev/dsp and writes to client.
    The 'client' I have written is running on RH9, which connects to the
 daemon on FC8 and reads from it and writes to /dev/dsp on RH9.

    On RH9 I can hear the song but with a lot of noise which I want to
 eliminate.
    Can it be done using some other tool like (sox, play or padsp etc.)?

it would be nice if new software avoids the use of the OSS API
(read/write/open/close with /dev/dsp) as much as possible. it may look
like a perfectly reasonable way to write such a program to you, but
the continued use of this API by new (and old) software is a major
blocking factor to improving the state of audio on linux. please don't
do this.

there are several ways to accomplish what you want without writing any
software at all. i believe that PulseAudio can do this, so that might
be a first point of investigation, although I do not know what the
state of PulseAudio support on Fedora9 is. Xine also has JACK support,
and you can run netjack on both machines to pass audio back and forth.
this is a slightly fussier system to configure, but works very well
for those who have gotten to know it.
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Lennart Poettering
On Thu, 23.07.09 09:38, Paul Davis (p...@linuxaudiosystems.com) wrote:

 
 On Thu, Jul 23, 2009 at 8:49 AM, Girish
 Hilagegirish_hil...@persistent.co.in wrote:
  Hi Paul,
 
     Thanks for your reply.
 
     The scenario is as follows :
     I have an FC8 machine and suppose my friend have a RH9 machine.
     I want to make him hear on his machine the song I am playing in 'xine' on
  my system.
 
     For that I have written a 'daemon' which listens for connections from
  client and reads from /dev/dsp and writes to client.
     The 'client' I have written is running on RH9, which connects to the
  daemon on FC8 and reads from it and writes to /dev/dsp on RH9.
 
     On RH9 I can hear the song but with a lot of noise which I want to
  eliminate.
     Can it be done using some other tool like (sox, play or padsp etc.)?
 
 it would be nice if new software avoids the use of the OSS API
 (read/write/open/close with /dev/dsp) as much as possible. it may look
 like a perfectly reasonable way to write such a program to you, but
 the continued use of this API by new (and old) software is a major
 blocking factor to improving the state of audio on linux. please don't
 do this.

In fact Fedora 11 does not support OSS anymore (hwoever you can
reenable it via some minor hackery). I am expecting other distros will
follow soon.

Lennart

-- 
Lennart PoetteringRed Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/   GnuPG 0x1A015CC4
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Paul Davis
On Thu, Jul 23, 2009 at 10:01 AM, Lennart Poetteringmz...@0pointer.de wrote:

 In fact Fedora 11 does not support OSS anymore (hwoever you can
 reenable it via some minor hackery). I am expecting other distros will
 follow soon.

this is awesome news. who made this decision? how is it propagating to
other distros?
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Lennart Poettering
On Thu, 23.07.09 10:07, Paul Davis (p...@linuxaudiosystems.com) wrote:

 
 On Thu, Jul 23, 2009 at 10:01 AM, Lennart Poetteringmz...@0pointer.de wrote:
 
  In fact Fedora 11 does not support OSS anymore (hwoever you can
  reenable it via some minor hackery). I am expecting other distros will
  follow soon.
 
 this is awesome news. who made this decision? 

Someone brought it up on fedora-devel. There wasn't any opposition, so
we did it.

 how is it propagating to other distros?

I have now asked the resp. folks of the other distros again to follow
this move. We'll see if they'll do it.

Lennart

-- 
Lennart PoetteringRed Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/   GnuPG 0x1A015CC4
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] reading and writing to /dev/dsp

2009-07-23 Thread Paul Davis
[ ... fedora 11  OSS  ... ]

Is this a 100% removal of the API, or does Pulse (and/or other
user-space things) still support the API even though its not present
in the kernel?
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] wiki.linuxaudio.org

2009-07-23 Thread Robin Gareus
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arnout Engelen wrote:
 Hi,
 
 Looking for a distribution-agnostic, community-maintained place for gathering 
 linuxaudio-related documentation, wiki.linuxaudio.org seems to be one of the
 main resources.
 
 The visual style seemed a bit old-fashioned and cluttered. I took a stab at 
 cleaning it up a bit:
 
   http://arnout.engelen.eu/files/dev/linuxmusicians/linuxaudiostyle/
 
 How do you like it? 

nice job. Did you just make a mockup, or do you have dokuwiki templates?

Styling the wiki and apps sites has been on our ToDo list a very long
time. - There are some drafts of templates to test at
http://apps.linuxaudio.org/wiki/user/rgareus . The linuxaudio - no
background theme is similar to your re-design.

 'wiki.linuxaudio.org' and 'apps.linuxaudio.org' have a different logo and a 
 different start page, but apart from that share the exact same content.

Yes, they're the same dokuwiki-engine. wiki.linuxaudio.org is just an
alias for apps.linuxaudio.org.  The hostnames are interchangeable and
are simply entry points.

 This 
 is pretty confusing. Wouldn't it be more elegant to make 'apps.linuxaudio.org'
 redirect to something like 'wiki.linuxaudio.org/apps' ?

Historically apps preceded wiki. So it ended up the other way 'round.

The logo was a bug. The apps-logo should only appear if one is below
[apps|wiki].linuxaudio.org/apps/ - I've just fixed that.

To further reduce confusion I've taken your hint and made
wiki.linuxaudio.org the canonical hostname for both wiki.lao and apps.lao.

robin
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpoim0ACgkQeVUk8U+VK0J+gACffLvExrxT4Gtx7+qOPKORfJPk
S24AoLU36fnV5tt2uC3c1FJJMfU9vqlQ
=x24O
-END PGP SIGNATURE-
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] List archives

2009-07-23 Thread Robin Gareus
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arnout Engelen wrote:
 Hi,
 
 There seem to be several archives of this list: 
 
   http://lalists.stanford.edu/lad/

The original LAD list until 2002 server. Since then, they keep
backup-copies of all list emails; subscription there is no longer possible.

@Nando: on http://lalists.stanford.edu/ website links should point to
http://lists.linuxaudio.org


 as linked to and searchable from
 
   http://lad.linuxaudio.org/archive/lad.html

lad.linuxaudio.org is horribly out of date.  It's only 14 static html
pages and worthwhile content from there should be moved to the wiki.

Alike apps  wiki, lad.linuxaudio.org will become an entry point to the
wiki and the current lad-vhost will go off-line.
Only http://lad.linuxaudio.org/events/ - which hosts the LAC video
archive - will remain (as redirect to lac.linuxaudio.org).


 and 
 
   http://lists.linuxaudio.org/pipermail/linux-audio-dev/
 
 as linked to from
 
   http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev/

http://lists.linuxaudio.org/ is the main resource, we should always link
there.

 Additionally, there's search functionality at
   http://www.linuxaudio.org/search/swishmail/
 .. and another, not very convenient archive at
   http://www.linuxaudio.org/mailarchive/lad

The drupal-module at www.linuxaudio.org is a wrapper around
lists.linuxaudio.org. It provides RSS and ATOM feeds and the swishmail
search is kind of handy. The /mailarchive/ just comes with it.  There's
a gazillion others fi. gmane.org, mail-archive.com, marc.info, etc. etc.


 This is a bit confusing. Perhaps we should replace the references to the 
 archive hosted at stanford with references to 
 http://lists.linuxaudio.org/pipermail/linux-audio-dev and 
 http://www.linuxaudio.org/search/swishmail
 
 http://www.linuxaudio.org/mailarchive/lad is kindof neat, so I wouldn't want 
 to propose doing away with it, but in its current form it's not too useful 
 either: a 'thread view' of a whole month instead of only a single day would
 make it much better. What software is backing this? Perhaps we could 
 upgrade/improve it.

It's the mailarchive drupal module - same as on kerneltrap.org. lkml has
much more traffic, which justified the hardcoded daily-thread-view for
that module. I do not know if mailarchive version 6.x fixes this
shortcoming. We're still running a rather old version of this module.
Upgrading/Improving this is quite a bit of work.

robin
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpojm4ACgkQeVUk8U+VK0InIACfQhxDZHHW1bhuINGPDIlTbtjt
rNMAn3vz3XF6d2kULPMZ5mfmGd/tjOTT
=XgPx
-END PGP SIGNATURE-
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev


Re: [LAD] wiki.linuxaudio.org

2009-07-23 Thread Robin Gareus
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Arnout,

Your criticism is valid and you provide good suggestions.
I'll hook you up with an account to the www-drupal.

Arnout Engelen wrote:
 On Sun, Jul 19, 2009 at 02:52:40PM +0200, hollun...@gmx.at wrote:
 we should tackle the linuxaudio.org mainpage, which is quite bad at
 the moment.
 
 Let me give some (concrete) feedback on some of the rest of the site:
 
 I quite like the style of the main page.
 
 The 'Music' section is a bit embarassing as it still claims it is 'slated
 to become an annual CD', but then proceeds to mention only one CD created
 some 5 years ago.

ack. BTW. Does anyone know what happened to lam.fugal.net ?

 The 'Search' is good (though not great), would deserve some more exposure.
 
 The 'Mail archive' seems unusable for me (only browsing per-day? wtf?)

Instead of patching the drupal mail-archive-views, let's just make a
Mail Archive page that points to lists.linuxaudio.org along with some
information and links to the feeds (eg.
http://linuxaudio.org/mailarchive/lad/feed).

What do you think?

The browse-by-day is a shortcoming of drupal's mailmodule.
However once you're reading a message there (eg. search-result) you can
follow it's thread across days quite easily.

 The 'Resources' section might deserve some more attention, since that's where
 the links to the 'real stuff' are.

IMO, if we manage to visualize the resources list better, it should
become the front-page.

 http://lad.linuxaudio.org/subscribe/general.html has 2 links to 'list-specific
 pages' pointing to http://lad.linuxaudio.org/subscribe/subscribe.php. That 
 page
 no longer exist, I'd say replace those with 'index page' and just link to
 index.html.
 
 http://lad.linuxaudio.org/resources links to 'resourceslinks.html', this 
 should probably be replaced by a link to 
 http://wiki.linuxaudio.org/wiki/newbie
 
 The 'archive' link at http://lad.linuxaudio.org/subscribe/lad.html links to 
 http://lad.linuxaudio.org/subscribe/archive/lau.html , I suppose that should 
 be http://lad.linuxaudio.org/archive/lad.html .
 

lad is mostly deprecated. It's content is to be migrated to
www.linuxaudio.org and wiki.linuxaudio.org. See comments in earlier emails.

 Who has write access to the site?

Burkhard Ritter (CCed) is site-admin and with Ico responsible for
content of www.linuxaudio.org. Ico and I are root of the server.


robin
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpokgsACgkQeVUk8U+VK0KMhgCfay3mTqfahP130yfHEhRWxIDc
2CUAoIx50wkIbSZ/AIgI2QcixbYiiW5M
=yES1
-END PGP SIGNATURE-
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev