Gordon Gidluck | 1 Sep 2008 02:40
Favicon

references to dsound.h

I am testing a demo of Visual Studio 2008.  In doing so, I get a build 
failure due to a couple of references to dsound.h (see listing below).
I don't see dsound.h in the current code in SVN.

Hopefully someone can pick this up that knows more about what's being 
done with direct sound.

Gordon
http://live2496.com

------ Build started: Project: portaudio, Configuration: Debug Win32 ------
Compiling...
pa_allocation.c
pa_converters.c
pa_cpuload.c
pa_debugprint.c
pa_dither.c
pa_front.c
pa_process.c
pa_ringbuffer.c
pa_skeleton.c
pa_stream.c
pa_trace.c
pa_win_ds.c
c:\portaudio\src\hostapi\dsound\pa_win_ds.c(82) : fatal error C1083: 
Cannot open include file: 'dsound.h': No such file or directory
pa_win_ds_dynlink.c
c:\portaudio\src\hostapi\dsound\pa_win_ds_dynlink.h(62) : fatal error 
C1083: Cannot open include file: 'dsound.h': No such file or directory
pa_win_wmme.c
(Continue reading)

Gordon Gidluck | 1 Sep 2008 03:10
Favicon

Re: references to dsound.h

I missed the part in the readme that suggested that I should have the 
latest DirectX SDK. (Sorry)

P.S. They have a June 2008 version available.
http://www.microsoft.com/downloads/details.aspx?FamilyId=519AAE99-B701-4CA1-8495-39DDDE9D7030&displaylang=en

Gordon

Gordon Gidluck wrote:
> I am testing a demo of Visual Studio 2008.  In doing so, I get a build 
> failure due to a couple of references to dsound.h (see listing below).
> I don't see dsound.h in the current code in SVN.
>
> Hopefully someone can pick this up that knows more about what's being 
> done with direct sound.
>
> Gordon
> http://live2496.com
>
> ------ Build started: Project: portaudio, Configuration: Debug Win32 ------
> Compiling...
> pa_allocation.c
> pa_converters.c
> pa_cpuload.c
> pa_debugprint.c
> pa_dither.c
> pa_front.c
> pa_process.c
> pa_ringbuffer.c
> pa_skeleton.c
(Continue reading)

Jo Morano | 2 Sep 2008 19:54
Picon

Basic question on sample formats

Hi!

I really really need some urgent help. Just about anybody who has done anything with audio and formats should be able to help me out I think! I just need a pointer to some tutorial or web page where I can see the answer to this.

I am trying to read input from a microphone and write it in the wav format. These days I'm using juce for that since I need it in VC++ and libsndfile doesn't compile with that.

The microphone input in portaudio or in juce via ASIO SDK has samples in float**. The wav writer (at least in juce, haven't verified in libsndfile) takes samples that are int**. Is there a standard conversion that needs to happen between these two? I would think so. But for most such conversions I'd have to at least understand what to make of this portaudio generated float** format. It is called 'raw' but I can't get any documentation on what that raw means and how would it ever map to something more structured.

I believe this has to be the most basic newbie question and it's quite vexing that I haven't been able to find any documentation anywhere explaining this.

Do I need to take some college course on audio sampling before I start to get it?

Please, anyone with any idea, help!!
_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
NickMtl | 2 Sep 2008 20:15
Picon

Re: Basic question on sample formats

Jo,

I don't know about Juce, but Libsndfile has no problem loading wav
files. I'm doing this in my app and then convert to float for playback
using PortAudio.

The Libsndfile web site has detailed information on how to load and
convert and save back audio files.

It is true that there's no step-by-step tutorial on how to write an
audio recorder using PortAudio, but you can learn the same principles
from other APIs and open-source software:

- The (free) Mac development platform come with a bunch of CoreAudio
tutorials and working sample applications. Great platform for fast
prototyping.

- Study the source code of Audacity, the free audio recorder/editor
based on PortAudio. It can take a while to understand, but this is the
best place to learn how to do it all. Their wiki is very informative
too.

Hope this helps,

- Nick -

On Tue, Sep 2, 2008 at 1:54 PM, Jo Morano <jo.morano06 <at> gmail.com> wrote:
> Hi!
>
> I really really need some urgent help. Just about anybody who has done
> anything with audio and formats should be able to help me out I think! I
> just need a pointer to some tutorial or web page where I can see the answer
> to this.
>
> I am trying to read input from a microphone and write it in the wav format.
> These days I'm using juce for that since I need it in VC++ and libsndfile
> doesn't compile with that.
>
> The microphone input in portaudio or in juce via ASIO SDK has samples in
> float**. The wav writer (at least in juce, haven't verified in libsndfile)
> takes samples that are int**. Is there a standard conversion that needs to
> happen between these two? I would think so. But for most such conversions
> I'd have to at least understand what to make of this portaudio generated
> float** format. It is called 'raw' but I can't get any documentation on what
> that raw means and how would it ever map to something more structured.
>
> I believe this has to be the most basic newbie question and it's quite
> vexing that I haven't been able to find any documentation anywhere
> explaining this.
>
> Do I need to take some college course on audio sampling before I start to
> get it?
>
> Please, anyone with any idea, help!!
>
> _______________________________________________
> Portaudio mailing list
> Portaudio <at> techweb.rfa.org
> http://techweb.rfa.org/mailman/listinfo/portaudio
>
>

--

-- 
- Nick -
Jo Morano | 2 Sep 2008 20:21
Picon

Re: Basic question on sample formats

In libsndfile headers I see the following:

SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */

SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */

SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */

SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */


Does the portaudio output match SF_FORMAT_RAW or SF_FORMAT_FLOAT or SF_FORMAT_DOUBLE?

 

On Tue, Sep 2, 2008 at 11:15 AM, NickMtl <valerianmusic <at> gmail.com> wrote:
Jo,

I don't know about Juce, but Libsndfile has no problem loading wav
files. I'm doing this in my app and then convert to float for playback
using PortAudio.

The Libsndfile web site has detailed information on how to load and
convert and save back audio files.

It is true that there's no step-by-step tutorial on how to write an
audio recorder using PortAudio, but you can learn the same principles
from other APIs and open-source software:

- The (free) Mac development platform come with a bunch of CoreAudio
tutorials and working sample applications. Great platform for fast
prototyping.

- Study the source code of Audacity, the free audio recorder/editor
based on PortAudio. It can take a while to understand, but this is the
best place to learn how to do it all. Their wiki is very informative
too.

Hope this helps,

- Nick -

On Tue, Sep 2, 2008 at 1:54 PM, Jo Morano <jo.morano06 <at> gmail.com> wrote:
> Hi!
>
> I really really need some urgent help. Just about anybody who has done
> anything with audio and formats should be able to help me out I think! I
> just need a pointer to some tutorial or web page where I can see the answer
> to this.
>
> I am trying to read input from a microphone and write it in the wav format.
> These days I'm using juce for that since I need it in VC++ and libsndfile
> doesn't compile with that.
>
> The microphone input in portaudio or in juce via ASIO SDK has samples in
> float**. The wav writer (at least in juce, haven't verified in libsndfile)
> takes samples that are int**. Is there a standard conversion that needs to
> happen between these two? I would think so. But for most such conversions
> I'd have to at least understand what to make of this portaudio generated
> float** format. It is called 'raw' but I can't get any documentation on what
> that raw means and how would it ever map to something more structured.
>
> I believe this has to be the most basic newbie question and it's quite
> vexing that I haven't been able to find any documentation anywhere
> explaining this.
>
> Do I need to take some college course on audio sampling before I start to
> get it?
>
> Please, anyone with any idea, help!!
>
> _______________________________________________
> Portaudio mailing list
> Portaudio <at> techweb.rfa.org
> http://techweb.rfa.org/mailman/listinfo/portaudio
>
>



--
- Nick -

_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Phil Burk | 2 Sep 2008 20:27
Favicon

Re: Basic question on sample formats


Jo Morano wrote:
> The microphone input in portaudio or in juce via ASIO SDK has samples in 
> float**. The wav writer (at least in juce, haven't verified in 
> libsndfile) takes samples that are int**. Is there a standard conversion 
> that needs to happen between these two?

Float samples in PortAudio and most DSP applications range from -1.0 to 
1.0. Float sample can go outside that range when mixing or doing 
recursive filters.

16-bit integer samples range from -32768 to 32767. You can convert from 
a float sample to an integer sample like this:

     short *monoBuffer;
     float fs = whatever();

     // This is controversial. Same say you should round.
     // Some say use 32767.
     // You could add "dithering".
     // But the basic idea is the same.
     int is = (int) (fs * 32768.0f);

     // clip in case out of range
     if( is > 32767 ) is = 32767;
     else if( is < -32768 ) is = -32768;

     // write to short array
     *monoBuffer++ = (short) is;

Also in PortAUdio you can request paInt16 instead of paFloat32 if you do 
not want to do DSP and just want to record and write directly to WAV.

Phil Burk
Gordon Gidluck | 2 Sep 2008 23:04
Favicon

Re: Basic question on sample formats

Jo,
portAudio makes the interaction with the hardware easy, but other 
functions like file I/O are left up to the developer.

To get you started what I would recommend doing is writing your 
soundcard samples directly from your soundcard into a file and then 
reimporting that data as raw pcm into an audio editor. At that point you 
could see what you are getting and decide what to do from there. Raw 
samples are basically the pcm stream coming from your soundcard. Lots of 
audio editors can handle float format samples and many of them can 
import raw data if you tell them the # of bits, sampling rate, and # of 
channels. Float format would have a 32-bit floating point value for each 
sample.

Libsndfile will make things easier for you, but you could create your 
own functions if libsndfile won't work with your development tools. On 
windows all you would need to do is to put a RIFF header at the front of 
the file that looks correct for windows applications and update the RIFF 
counter and data chunk counter based upon the byte counts in the file. 
Information on the wav format can be found in many places. Heres one:  
http://ccrma.stanford.edu/courses/422/projects/WaveFormat/

I think that portAudio has some conversion functions built-in for 
converting from one type of sample to another. I would try to get your 
application working in float format first if your soundcard is 
outputting those types of samples. Then add the conversion and support 
for other sample types later.

Gordon

Jo Morano wrote:
> Hi!
>
> I really really need some urgent help. Just about anybody who has done 
> anything with audio and formats should be able to help me out I think! 
> I just need a pointer to some tutorial or web page where I can see the 
> answer to this.
>
> I am trying to read input from a microphone and write it in the wav 
> format. These days I'm using juce for that since I need it in VC++ and 
> libsndfile doesn't compile with that.
>
> The microphone input in portaudio or in juce via ASIO SDK has samples 
> in float**. The wav writer (at least in juce, haven't verified in 
> libsndfile) takes samples that are int**. Is there a standard 
> conversion that needs to happen between these two? I would think so. 
> But for most such conversions I'd have to at least understand what to 
> make of this portaudio generated float** format. It is called 'raw' 
> but I can't get any documentation on what that raw means and how would 
> it ever map to something more structured.
>
> I believe this has to be the most basic newbie question and it's quite 
> vexing that I haven't been able to find any documentation anywhere 
> explaining this.
>
> Do I need to take some college course on audio sampling before I start 
> to get it?
>
> Please, anyone with any idea, help!!
> ------------------------------------------------------------------------
>
> _______________________________________________
> Portaudio mailing list
> Portaudio <at> techweb.rfa.org
> http://techweb.rfa.org/mailman/listinfo/portaudio
>   
Jim Hourihan | 3 Sep 2008 18:45
Picon
Favicon

OSS v4 driver + recent snapshot


Hi all, I've been happily using portaudio for a couple of years now  
with great success (thank you to the developers!)

Yesterday, I installed the OSS v4 driver on an fc8 amd box with the  
result that the most recent snapshot of portaudio no longer functions  
properly. The hardware device is an on-board nvidia ck804 controller.

The initial symptom is not being able to get a default device (all of  
the test programs fail). If I hard-code the patest_sine binary to use  
device 0 it will send samples to the device and will drive the  
hardware, but with a lot of clipping/popping/etc.

My own software behaves similarly to the hacked patest_sine and  
reports some funny things:

   * The outputBufferDacTime (which I rely on for video sync) seems  
to be twice what one would expect
   * The output latency is larger than the reported maximum by 50% or so
   * The framesPerBuffer is 1024 if I don't ask for something  
specifically

Two devices are reported: OSS /dev/dsp and /dev/dsp1

the pa_stable tarball successfully finds the default device, but  
patest_sine makes the same noise it does in the snapshot.

The funny thing is audacity (from the fc8 rpm) works fine with this  
driver. I've been under the impression that program uses portaudio as  
well.

Any debugging guidance appreciated...

	-Jim
Richard Ash | 4 Sep 2008 11:28

Re: OSS v4 driver + recent snapshot

On Wed, 2008-09-03 at 09:45 -0700, Jim Hourihan wrote:
> Two devices are reported: OSS /dev/dsp and /dev/dsp1
> 
> the pa_stable tarball successfully finds the default device, but  
> patest_sine makes the same noise it does in the snapshot.
> 
> The funny thing is audacity (from the fc8 rpm) works fine with this  
> driver. I've been under the impression that program uses portaudio as  
> well.

Audacity does use portaudio, but not one of the public snapshots from
portaudio.com. If you have audacity 1.2.x then you are using a very old,
hacked copy of portaudio v18. If you are using a 1.3.x beta then you
have some snapshot of portaudio v19, exactly which depends on which
release you have.

Note that in audacity 1.3.x you can switch between ALSA and OSS drivers
in the audacity preferences, so you may be using the ALSA emulation from
OSS v4 rather than direct OSS. There is also an option to adjust the
audio I/O buffer size in the more recent beta releases.

Richard
christopher melen | 11 Sep 2008 22:22
Picon
Favicon

Problem with paFramesPerBufferUnspecified (Lisp PA bindings, WinXP, ASIO)

Hi,

I've written some Lisp bindings for PortAudio but I'm having problems specifying the right number of
frames per
buffer. Passing 0 as the value (equivalent to paFramesPerBufferUnspecified) doesn't give me an error,
but I also
don't get any sound. Any other value will eventually work (returns 0, and I get sound output), but most of the
time I get an underflow. I'm using blocking I/O rather than a callback, with ASIO on WinXP. I currently only
need PortAudio for output, reading a set of samples from a buffer supplied by my own Lisp synthesis program
(performing additive synthesis on SDIF files). Two points which may or not be of relevance -

(1) This is what I get (in my Lisp REPL) when I initialize PortAudio -

before paHostApiInitializers[0].
Pa_GetDeviceInfo: Num input channels reported as 65535! Changed to 2.
Pa_GetDeviceInfo: Num input channels reported as 65535! Changed to 2.
Pa_GetDeviceInfo: Num output channels reported as 65535! Changed to 2.
Pa_GetDeviceInfo: Num output channels reported as 65535! Changed to 2.
after paHostApiInitializers[0].
before paHostApiInitializers[1].
BLACKLISTED: Playback through TotalRecorder (emulated)
after paHostApiInitializers[1].
before paHostApiInitializers[2].
ASIO names[0]:ASIO DirectX Full Duplex Driver
BLACKLISTED!!!
ASIO names[1]:ASIO Multimedia Driver
BLACKLISTED!!!
ASIO names[2]:ASIO4ALL v2
PaAsio_Initialize: drv:2 name = ASIO4ALL v2
PaAsio_Initialize: drv:2 inputChannels       = 2
PaAsio_Initialize: drv:2 outputChannels      = 8
PaAsio_Initialize: drv:2 bufferMinSize       = 64
PaAsio_Initialize: drv:2 bufferMaxSize       = 2048
PaAsio_Initialize: drv:2 bufferPreferredSize = 512
PaAsio_Initialize: drv:2 bufferGranularity   = 8
PaAsio_Initialize: drv:2 defaultSampleRate = 44100.000000
PaAsio_Initialize: drv:2 defaultLowInputLatency = 0.011610
PaAsio_Initialize: drv:2 defaultLowOutputLatency = 0.011610
PaAsio_Initialize: drv:2 defaultHighInputLatency = 0.034830
PaAsio_Initialize: drv:2 defaultHighOutputLatency = 0.034830
after paHostApiInitializers[2].
before paHostApiInitializers[3].
after paHostApiInitializers[3].
0

(2) I haven't yet been able to build PortAudio itself, either with Cygwin or Mingw. I'm presently using
a v19 DLL from another application and loading that into Lisp as a foreign library.

Many thanks in advance for any suggestions,
Christopher

Gmane