how to send a sound array to sox/aplay

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

how to send a sound array to sox/aplay

René Bastian

2013.11.26

Hello,

I would use sox to play directly sound-arrays without
recording the array in a file.

I think it is possible - but I dont know how to do it.

Can you help me?

René B.
www.pythoneon.org
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/aplay

keghn
Hello,
Do you have sox installed?

 If you do use "play" at the command line as:

play  song_ogg_wav_or.mp3

array? You mean a raw file?

  Cheers.
     keghn


-----Original Message-----
From: rbastian <[hidden email]>
To: sox-users <[hidden email]>
Sent: Tue, Nov 26, 2013 9:24 am
Subject: [SoX-users] how to send a sound array to sox/aplay


2013.11.26

Hello,

I would use sox to play directly sound-arrays without
recording the array in a file.

I think it is possible - but I dont know how to do it.

Can you help me?

René B.
www.pythoneon.org
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/aplay

René Bastian
Le Tue, 26 Nov 2013 15:24:28 -0500 (EST),
[hidden email] a écrit :

> Hello,
> Do you have sox installed?

Yes:
rbm@lenovo:~$ sox --version
sox: SoX v14.3.1

>
>
>  If you do use "play" at the command line as:
>
>
> play  song_ogg_wav_or.mp3
>
>
> array? You mean a raw file?

I use sox as play:
$ play -c2 -s -r44100 -b16 audiofile.raw
# it works but that's not the matter.

I generate/produce/compose sound-arrays with Python & Numpy;
this files con be recorded as raw or wav files (or any other format).
It would be nice if I could play directly this sound-arrays.
Sox/play reads a sound-file and has then a sound-array in RAM before
sending it to the audio interface. So, it should be possible to
play a sound-array.

René B.


>
>
>   Cheers.
>      keghn
>
>
>
> -----Original Message-----
> From: rbastian <[hidden email]>
> To: sox-users <[hidden email]>
> Sent: Tue, Nov 26, 2013 9:24 am
> Subject: [SoX-users] how to send a sound array to sox/aplay
>
>
>
> 2013.11.26
>
> Hello,
>
> I would use sox to play directly sound-arrays without
> recording the array in a file.
>
> I think it is possible - but I dont know how to do it.
>
> Can you help me?
>
> René B.
> www.pythoneon.org
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most
> IT organizations don't have a clear picture of how application
> performance affects their revenue. With AppDynamics, you get 100%
> visibility into your Java,.NET, & PHP application. Start your 15-day
> FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________ Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>
>
>  


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/aplay

keghn
When you using Python & Numpy. You cannot hear the music you built or recorded?
And then you need a play after you put a track together?
Sorry for all the questions.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/aplay

Jan Stary
In reply to this post by René Bastian
> >  If you do use "play" at the command line as:
> > play  song_ogg_wav_or.mp3
> > array? You mean a raw file?
>
> I use sox as play:
> $ play -c2 -s -r44100 -b16 audiofile.raw
> # it works but that's not the matter.
>
> I generate/produce/compose sound-arrays with Python & Numpy;
> this files con be recorded as raw or wav files (or any other format).
> It would be nice if I could play directly this sound-arrays.

You probably need to explain first what a "sound array" is.

> Sox/play reads a sound-file and has then a sound-array in RAM before
> sending it to the audio interface. So, it should be possible to
> play a sound-array.

>From this it _seems_ that a "sound array" is just
the raw sequence of samples (in some given encoding).
SoX can play that of course. But please explain first.



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/play

René Bastian
Le Wed, 27 Nov 2013 08:24:01 +0100,
Jan Stary <[hidden email]> a écrit :

> > >  If you do use "play" at the command line as:
> > > play  song_ogg_wav_or.mp3
> > > array? You mean a raw file?
> >
> > I use sox as play:
> > $ play -c2 -s -r44100 -b16 audiofile.raw
> > # it works but that's not the matter.
> >
> > I generate/produce/compose sound-arrays with Python & Numpy;
> > this files con be recorded as raw or wav files (or any other
> > format). It would be nice if I could play directly this
> > sound-arrays.
>
> You probably need to explain first what a "sound array" is.

EN (? :) A sound array is a digitized sound before being written on a
medium/support.
 
DE: ein Klang-Array ist ein digitalisierter Klang bevor er auf einem
Medimum fixiert ist.
FR: un vecteur-son est un son digitalisé avant d'être fixé sur un
médium.


>
> > Sox/play reads a sound-file and has then a sound-array in RAM before
> > sending it to the audio interface. So, it should be possible to
> > play a sound-array.
>
> >From this it _seems_ that a "sound array" is just
> the raw sequence of samples (in some given encoding).
> SoX can play that of course. But please explain first.

With numpy (np), a sound-array is nothing else than a np.ndarray
of numbers (np.int16, np.int32, np.float64 etc.).

Example: A stereo array on a cd is a sequence of left np.int16/right
np.int16 samples. On a cd there are no headers - the format is implicit.

For keghn:
> When you using Python & Numpy. You cannot hear the music you built or
recorded?

It works with Python2.6 & pyalsaaudio, but
I can not longer use pyalsaaudio with Debian7.2 & Python2.7:
there is a bug in the Debian distrib (conflict between 32 & 64 bits)

rb
>
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/play

Jan Stary
On Nov 27 09:51:35, [hidden email] wrote:

> > > >  If you do use "play" at the command line as:
> > > > play  song_ogg_wav_or.mp3
> > > > array? You mean a raw file?
> > >
> > > I use sox as play:
> > > $ play -c2 -s -r44100 -b16 audiofile.raw
> > > # it works but that's not the matter.
> > >
> > > I generate/produce/compose sound-arrays with Python & Numpy;
> > > this files con be recorded as raw or wav files (or any other
> > > format). It would be nice if I could play directly this
> > > sound-arrays.
> >
> > You probably need to explain first what a "sound array" is.
>
> EN (? :) A sound array is a digitized sound before being written on a
> medium/support.
> >
> > > Sox/play reads a sound-file and has then a sound-array in RAM before
> > > sending it to the audio interface. So, it should be possible to
> > > play a sound-array.
> >
> > >From this it _seems_ that a "sound array" is just
> > the raw sequence of samples (in some given encoding).
> > SoX can play that of course. But please explain first.
>
> With numpy (np), a sound-array is nothing else than a np.ndarray
> of numbers (np.int16, np.int32, np.float64 etc.).
>
> Example: A stereo array on a cd is a sequence of left np.int16/right
> np.int16 samples. On a cd there are no headers - the format is implicit.

Hm, so it is just the raw sequence of samples, right?
So just pipe it to "| play -t raw [-c -b -r options] -"


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: how to send a sound array to sox/play

René Bastian
Le Wed, 27 Nov 2013 14:45:53 +0100,
Jan Stary <[hidden email]> a écrit :

> On Nov 27 09:51:35, [hidden email] wrote:
> > > > >  If you do use "play" at the command line as:
> > > > > play  song_ogg_wav_or.mp3
> > > > > array? You mean a raw file?
> > > >
> > > > I use sox as play:
> > > > $ play -c2 -s -r44100 -b16 audiofile.raw
> > > > # it works but that's not the matter.
> > > >
> > > > I generate/produce/compose sound-arrays with Python & Numpy;
> > > > this files con be recorded as raw or wav files (or any other
> > > > format). It would be nice if I could play directly this
> > > > sound-arrays.
> > >
> > > You probably need to explain first what a "sound array" is.
> >
> > EN (? :) A sound array is a digitized sound before being written on
> > a medium/support.
> > >
> > > > Sox/play reads a sound-file and has then a sound-array in RAM
> > > > before sending it to the audio interface. So, it should be
> > > > possible to play a sound-array.
> > >
> > > >From this it _seems_ that a "sound array" is just
> > > the raw sequence of samples (in some given encoding).
> > > SoX can play that of course. But please explain first.
> >
> > With numpy (np), a sound-array is nothing else than a np.ndarray
> > of numbers (np.int16, np.int32, np.float64 etc.).
> >
> > Example: A stereo array on a cd is a sequence of left np.int16/right
> > np.int16 samples. On a cd there are no headers - the format is
> > implicit.
>
> Hm, so it is just the raw sequence of samples, right?

yes

> So just pipe it to "| play -t raw [-c -b -r options] -"

This works in command-line:

e.g. "less -f audiofile.raw | play -t raw -c2 -s -b16 -r44100 -"

but I dont succeed with scripting it.

[I have now a provisory/temporary solution
with the ossaudiodev.py module, but it misses all the options of sox]

Thanks anyway,

René B.

>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most
> IT organizations don't have a clear picture of how application
> performance affects their revenue. With AppDynamics, you get 100%
> visibility into your Java,.NET, & PHP application. Start your 15-day
> FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________ Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users