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

2009-07-23 Thread Johannes Mario Ringheim
Paul Davis skreiv:
> 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.

You can, I do it all the time. It gets very much more userfriendly if 
you have the GUI applets which exist for Gnome at least. There's also a 
video on the net demonstrating how to do this (can't recall where right 
now).

This is one of the strengths of Pulseaudio which is too seldom 
considered when people critizise it.

-- 
Ringheims Auto - Fri musikk for bilstereo!
http://ringheimsauto.org
___
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 11:07, Paul Davis (p...@linuxaudiosystems.com) wrote:

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

the latter. padsp/aoss will continue to be available.

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] 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 Poettering 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
On Thu, Jul 23, 2009 at 10:01 AM, Lennart Poettering 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 09:38, Paul Davis (p...@linuxaudiosystems.com) wrote:

> 
> On Thu, Jul 23, 2009 at 8:49 AM, Girish
> Hilage 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 8:49 AM, Girish
Hilage 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 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 
To: Girish Hilage 
Cc: 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
Hilage 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 6:09 AM, Girish
Hilage 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


[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 
#include 
#include 
#include 
#include 
#include 
#include 

#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