KNS | 28 Oct 15:20 2014
Picon

Setting default driver



I've just compiled a couple versions of portaudio, on Windows using MinGW.  The first was with just ASIO and the second ASIO and DirectX.  When compiling the included examples the former behaves as expected.  Specifically, the asio4all control window appears.  For the second, and this is the really naive part, how do I let the application know to use ASIO first, then default to DirectX?  

Incidentally, by default I should I expect substantially better input and output latency with asio4all relative to directx.  I do have an M-Audio Transit but for the sake of convenience I would like to trade on that latency.  I would be comfortable with on the order of 20 or so milliseconds.

Thanks. 
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
Evan Balster | 25 Oct 11:12 2014
Picon

Advice: inter-device synchronization / streaming

Hey, all --

For various reasons I'm approaching a situation where a general-purpose mechanism for monitoring activity in one audio callback from another will be useful -- for instance, monitoring input from one device and playing it back in another when no duplexing is available.

The basic methodology is simple enough:  use lockfree mechanisms like ringbuffers to copy samples in the producer process and render them in the consumer one.  I'm aware of several complications that rear their heads in these situations -- primarily clock source discrepancy, which I've seen leads to some very nasty behaviors in some software.

For my purposes, a little latency and even occasional samples dropped / duplicated are acceptable -- but I'm interested in how to solve this problem well, achieving a respectable latency with minimal distortion of the signal, and haven't been able to find good documentation on it.  Hoping some of the seasoned minds here might be able to shed some light.

Thanks in advance for any advice!

Regards,
Evan
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
Garth Hjelte | 24 Oct 00:47 2014

Handling multiple in/out audio devices

How does PortAudio support audio products that have multiple inputs and multiple outputs?

Typically, does it get each stereo pair as a single PaDeviceInfo; in other words, the single hardware
device acts like 4 separate stereo devices? (Then using the separate outputs is easy; just choose the
[Audio Device]-Channel 1+2 PaDeviceInfo.)

But do some multiple in/out devices just show as one PaDeviceInfo and there's another way to declare which
inputs get recorded from /or/ which outputs are listened to? If so, how does PortAudio handle that? Does it
just not support it?

Garth Hjelte
Sampler User
Éloi Rivard | 19 Oct 23:24 2014
Picon

"underrun occured" issue

Hi,

I am a developper of GNU denemo ( http://denemo.org ) and I met some troubles with Portmidi. In short, denemo produces a constant error message flow:

ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred

I don't know the cause of this but I can only fix this with the environment var "PULSE_LATENCY_MSEC=30"

I though maybe it is due to a bad portaudio initialization from denemo ? Looking at this source code, do you see something wrong/chocking ?

https://github.com/denemo/denemo/blob/master/src/audio/portmidibackend.c

You can also have a look at our bug report:
https://savannah.gnu.org/bugs/index.php?43439

Thanks for your help
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
Pradeep Kumar | 10 Oct 00:26 2014
Picon

Periodic noise in playback

Hi 

I'm using portaudio in my application both for audio and video playback.
For long time it was working fine. But recently I'm facing a strange issue.
I'm hearing some periodic low click noise during playback which was not there earlier. However when I pause my playback and again resume the noise disappear for sometime (5-7 seconds) but comes back again. And this is consistence whenever I pause or start my playback. So the noise is coming after duration of playback.
I know something has changed which is causing this issue but I'm not able to figure it out. I tried many change like changing the buffer size,flags Pa_OpenStream and many other changes but the noise is still there.

Please suggest what could be doing wrong.

Thanks and Regards,
Pradeep
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
John Clements | 1 Oct 00:37 2014

brute-force approach to paTerminate?

I have a set of bindings for portaudio for Racket, an environment where it’s inconvenient[*] to pass
state between threads in order to properly ensure that paInitialize happens once at the beginning of
execution, and paTerminate is called at the end of execution. Indeed, if multiple user programs are
running simultaneously, it’s not even clear definition is the best one to use for the “end of execution”.

In light of this, I came up with this gross hack:

;; initialize unless it's already been initialized.
(define (pa-maybe-initialize)
  (cond [(pa-initialized?) (void)]
        [else (pa-initialize)]))

;; has portaudio been initialized?
(define (pa-initialized?)
  (not (= (pa-get-host-api-count/raw) pa-not-initialized-error)))

;; terminate until pa-initialized returns false
(define (pa-terminate-completely)
  (let loop ([count terminate-absurd-threshold])
    (cond ([< count 0] (error 'pa-terminate-completely 
                              "terminated more than ~s times and initialized? still returns true."
                              terminate-absurd-threshold))
          [(pa-initialized?) (pa-terminate)
                             (loop (- count 1))]
          [else #t])))

;; the number of times to try terminating before giving up:
(define terminate-absurd-threshold 1000000)

That is: call pa-maybe-initialize at the beginning of each user thread that uses portaudio, and attach
pa-terminate-completely to the end of a user thread.

Can anyone comment on the possible race conditions inherent in this approach? Yes, it makes you hold your
nose, but will it lead to core dumps?

Many thanks!

John Clements

[*] I should add that a new feature called ‘plumbers’ may help with this; before I invest time in
rewriting code (and potentially introducing more bugs), I want to evaluate the stability of the solution
that I currently have.
Garth Hjelte | 26 Sep 21:40 2014

Multiple SoundFonts

In the API:

>The synthesizer can load any number of SoundFonts. The loaded SoundFonts are treated as a stack, where
each new loaded SoundFont is placed at the top of the stack. When selecting presets by bank and program
numbers, SoundFonts are searched beginning at the top of the stack. In the case where there are presets in
different SoundFonts with identical bank and program numbers, the preset from the most recently loaded
SoundFont is used. The fluid_synth_program_select() can be used for unambiguously selecting a preset
or bank offsets could be applied to each SoundFont with fluid_synth_set_bank_offset(), to try and
ensure that each preset has unique bank and program numbers. 

I just want to make sure I got this right. I want to use multiple SoundFonts, but I'm not in a position to dicker
around with the BankNum setting in the SoundFonts I create, they'll always be set to 0.

So this is where fluid_synth_set_bank_offset() comes in handy, right? For each SF loaded I'd do something
like this;

fluid_synth_set_bank_offset(synth, sfont_id[MySoundFontIndex], MySoundFontIndex);

So then to switch to a new soundfont for NoteOn, I do this:

fluid_synth_program_select(synth, MIDIChannel, BankNum, PresetNum);

Then every fluid_synth_noteon() call, the Preset that's played is the SoundFont represented by the
BankNum, and the PresetNum in that Bank, right?

In other words I'm switching SoundFont's by switching BankNum's, without hardchanging the BankNum in the
SF's. All SF's that I use (I create them from scratch on the fly) will have one Bank with BankNum=0.

(Perhaps there's other ways of toggling between SF's, I just thought this may be the best way for me. Any
suggestions are welcome.)

But is this correct; is this how fluid_synth_set_bank_offset works?  

Garth Hjelte
Sampler User
Dinesh Iyer | 25 Sep 22:24 2014
Picon

Speaker Configuration in DirectSound

Hi all,
I apologize for the multiple emails but each question is unrelated to the other and thought that this would be better for tracking and searching.

Since the March 26, 2011 version of PortAudio, in DirectSound, the maximum number of channels for a device is being guessed based on the speaker configuration. The code for this is in pa_win_ds.c (line 863- 895) in the AddOutputDeviceInfoFromDirectSound function.

This was not done earlier and the check unfortunately breaks a use case of mine.

I am shipping a demo as part of my application that uses 5.1 surround audio. This demo uses the default device. It used to work for customers even if the default device on their system had a maximum of only two channels, say a USB headset. This demo not does not work now. 

I will be happy to update my dmeo but many of our users have built applications using this behaviour and so it is very difficult to add this restriction all of a sudden.

The only workaround that I see is to comment out the specified lines of code. Are there any other suggested workarounds?

Regards,
Dinesh



_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
Dinesh Iyer | 25 Sep 22:04 2014
Picon

Audio Latency degradation with latest PortAudio

Hi all,
I am upgrading to PortAudio Jan 30, 2014 from March 26, 2011 release and I am noticing a degradation in audio latency that I can get from the new version of the library with ASIO and CoreAudio.

On CoreAudio, I was able to run at a buffersize of 32 samples <at> 44100 Hz without any sample drops with the older version of the library. However, with the new version, I need to bump the buffersize upto 48 or 64 samples to be able to run without any sample drops. This affects the latency.

I am facing the same latency issue with ASIO too. I was able to run my Steinberg UR22 at 64 samples without any drops but now I have to bump it up.

I have also noticed that on Mac, it takes around 0.5 seconds for the paCallback to be fired the first time after calling PaStartStream. In my setup, I am playing back and recording data to measure roundtrip latency. I start playback before starting recording. I am dumping out time stamps in my code and I notice that the first call to paCallback for recording always occurs ~0.5 seconds after calling PaStartStream. I have observed this in both versions of the library.


Regards,
Dinesh
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
Dinesh Iyer | 24 Sep 17:08 2014
Picon

Playing back 24-bit audio using DirectSound results in distorted output

Hi,
I am in the process of upgrading to the latest version of PortAudio Jan 30, 2014 and I noticed that when I attempt to play audio using DirectSound the output appears to be distorted. The issue appears to be in the conversion for 24-bit -> 16-bit data. This is being done because in OpenStream, the native format appears to be listed as paInt16.

PaSampleFormat nativeOutputFormats = paInt16;
        /* PaSampleFormat nativeOutputFormats = paUInt8 | paInt16 | paInt24 | paInt32 | paFloat32; */

        hostOutputSampleFormat =
            PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );

However, when I change this to paInt16 | paInt24, the playback works without any distortions.

You can find the text file containing the samples in the link below:

There are no distortions when I attempt to playback data at 8-bit, 16-bit, 32-bit but only for 24-bit.

Why is the sample format hardcoded to paInt16? Is the change I made an appropriate fix?

Regards,
Dinesh
_______________________________________________
Portaudio mailing list
Portaudio <at> music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
tompoe | 20 Sep 07:40 2014
Picon

SOLVED: low level static with Portaudio

Fiddled, and found my HDM1 sound volume was excessive.  Once I lowered 
to 50%, static disappeared.  I'm hard of hearing, so my normal volume on 
television channels is usually much higher. Thanks, much.  And, by the 
way, am impressed with Portaudio.  Good work, people.
Thanks, Tom

Gmane