Re: [PD] Libpd running in OS X app

2013-07-08 Thread Joe White
Thanks for the link Rich!

I had a look at your code and I could get the tone patch to work with input
disabled, but enabling input caused an error:

* *** ERROR *** -[PdAudioUnit
initAudioUnitWithSampleRate:numberChannels:inputEnabled:][159] status code
=  kAudioUnitErr_InvalidPropertyValue*

I think this is due to the fact that with kAudioUnitSubType_HALOutput you
need to set up two callbacks for input/output processing:

*kAudioOutputUnitProperty_SetInputCallback* for retrieving the input
samples by calling the AudioUnitRender() method, processing the samples and
storing them into a ring buffer.

 *kAudioUnitProperty_SetRenderCallback* for retrieving the samples stored
in the ring buffer to output.


I have a HAL Output Unit working with AUGraph in a controller class. I'll
try and wrap it up this week and share it.

However for this purpose I didn't need audio input so I opted for the
Default Output unit. As you can see in the link from the previous email
this simplifies the code A LOT :) Maybe it'd be useful to have two projects
for output only and input/output. With the former being a very quick way
for people new to libpd to get a project up and running.

Regarding my issue with libpd not processing audio, as Dan pointed
out, it *should
*be working. However, thinking about it more it could be due to how I built
the libpd library. I noticed Rich added the whole source code into his
project so I'll try that and see if it makes any difference. Weird!

Thanks for the help guys,

Joe

On 7 July 2013 03:02, Rich E reakina...@gmail.com wrote:

 I started adding support for using PdAudioUnit in a Cocoa / OS X app
 (PdAudioController is too iOS-specific) and checked my progress into the
 cocoa branch here:

 https://github.com/libpd/libpd/tree/cocoa

 There is a (very basic) working app at:


 https://github.com/libpd/libpd/tree/cocoa/samples/cocoa_samples/CocoaPdBasic

 You can also find some experimentation I did with moving towards an
 AUGraph design but, in the end, I found it much more restrictive than just
 using Audio Units directly.  Apologies for not finding the time to finish
 this, I've been working full-time on a different project for many months
 now... but hopefully once that is done I will finish off those samples,
 unless someone else already has.

 In essence, there were only a few things that needed to be modified. Off
 the top of my head, they were:

 - switch the audio unit to kAudioUnitSubType_HALOutput
 - enable an input audio device (required on OS X, not on iOS)
 - fix some Obj-C syntax issues that are different on OS X (property
 synthesis generation I believe)

 By the way, you can use the C++ wrapper quite readily with any other
 existing audio framework that provides OS X support - I use it in cinder
 apps and of course Dan provides ofxPd.  I know others who have used
 portaudio or FMOD directly.

 cheers,
 Rich


 On Sat, Jul 6, 2013 at 9:04 AM, Dan Wilcox danomat...@gmail.com wrote:

 Sorry. I assumed you were using the existing Obj-C PdAudioUnit and
 PdAudioController classes included with libpd which were written mainly for
 iOS. We should get around to tweaking it so it works on OSX. Did you try it?

 In skimming your code, it looks like you're doing everything the
 PAudioUnit does, so I don't see any obvious problems.


 On Jul 6, 2013, at 8:52 AM, Joe White white.j...@gmail.com wrote:

 Sorry that previous code had some test stuff in it, here's a slightly
 cleaner version (ARC'd)

 http://pastebin.com/index/1bR2Ftqn

 On 6 July 2013 13:47, Joe White white.j...@gmail.com wrote:

 How do you mean the CoreAudio backend? I would have thought I should
 just be able to call the process function in my render callback. Did you
 check out the code I posted? I happy to provide that as an AudioController
 for libpd on OSX. Messages and print objects work correctly but libpd is
 not processing any audio.

 http://pastebin.com/1bR2Ftqn

 Cheers,
 Joe


 On 5 July 2013 23:33, Dan Wilcox danomat...@gmail.com wrote:

 As far as I know, the OSX port isn't finished and the CoreAudio backend
 isn't hooked up. Anyone wanna help out there or sponsor us? :D

 On Jul 5, 2013, at 7:56 AM, pd-list-requ...@iem.at wrote:

 *From: *Joe White white.j...@gmail.com
  *Subject: **[PD] Libpd running in OS X app*
 *Date: *July 5, 2013 7:34:47 AM EDT
 *To: *pd-list pd-list@iem.at


 Hi guys,

 Does anyone have any experience running libpd in an OS X app, using
 CoreAudio.

 I'm able to run a patch and receive print statements but I'm not
 getting any audio output and DSP doesn't seem to be processing. I created a
 quick test tone in code to see if it was my audio unit but that works. My
 main problem it seems is that after calling

   [PdBase processFloatWithInputBuffer:leftBuffer outputBuffer
 :leftBuffer ticks:ticks];

 ...the buffer is still empty. Anyone have any ideas?

 I'm calling [PdBase computeAudio:] just before I start the AudioUnit.
 Here's the whole controller class if that helps:
 

[PD] Fwd: Preferences weirdness in Pd 43.1 ( 2?) in RPi

2013-07-08 Thread Pierre Massat
Hi,

I again encountered some strange stuff with libraries and paths, this time
in Pd-extended 0.43.4 on windows.
Some libraries included in the extra folder just won't load (like pduino
for instance). Using [import pduino] does work though.
Also I can't add some paths, like  ...pd/docs/3.audio.examples (because i
need the reverb abstraction). Pd just won't save the path no matter what.

Cheers,

Pierre.

-- Forwarded message --
From: Pierre Massat pimas...@gmail.com
Date: 2013/7/7
Subject: Preferences weirdness in Pd 43.1 ( 2?) in RPi
To: pd-list pd-list@iem.at


Dear List,

My Pi is finally working again with Pd, but i've noticed two strange things
(strange to me) :
- the libraries in the startup list simply won't load most of the time
(zexy, cyclone, iemlib at least), although they were installed regularly in
the extra folder. I have to add their folders to the Path list. Note that
the [import] object doesn't work either for these libraries.
- when launching Pd as root, the preferences I set as a normal use don't
load. This is a bit strange to me, and I have no idea how to tell Pd to use
the same .pdsettings file in both situations.

Nothing that I couldn't get around, but the this is a bit frustating
(especially the libraries thing).

Cheers,

Pierre.
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] iemmatrix - rotate matrix

2013-07-08 Thread João Pais

Hello,

I'm programming a gui for [mtx_mul~], and it's almost finished. One thing  
is missing, and I wanted to know if someone already has a solution for it,  
before I break my head trying to find one.


I need to find a way to rotate matrixes, in order to coordenate the  
controler display, and matrix's format. Following the logic of max's  
matrixctrl object, and an usual DAW's display of audio matrixes, the lines  
are the inputs, and the columns are the outputs. But, Pd's [matrix]  
practise is the opposite.
So I'm trying to implement the standard industry display, and output  
Pd's [matrix] format.


For example, a 4x2 matrix to control [mtx_mul~] has 8 fields, and will be  
like


1 2
3 4
5 6
7 8

or

[matrix 4 2 1 2 3 4 5 6 7 8(

that is, columns are inputs, lines are outputs.

But, the current GUI would have the matrix rotated, in the order

1 2 3 4
5 6 7 8

[matrix 4 2 1 5 2 6 3 7 4 8(

where columns are outputs, and lines are inputs.

So repeating to try to make it clear: the gui sends the data in the lower  
format, and it has to be rotated to match the format above. Is there an  
object or technique that does this?


Thanks again,

João

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Libpd running in OS X app

2013-07-08 Thread Rich E
Ah, that's right I forgot: using one AUHAL audio unit only works if you are
using the same device for input and output, otherwise you need to create
two as you found out. Unfortunately this is the default setup on a macbook,
but I found that it still works if you create an Aggregate Device in the
'Audio Midi Setup' preference pane (it'll also work with hardware sound I/O
interfaces).

Yea not sure how to leave those samples / what modifications to make to
PdAudioUnit - if you get something working that is fairly general maybe we
can work it in.

About the AUGraph, the limitation I ran into was trying to feed either
speech synthesis or AUFilePlayer output into pd from a render callback - I
could only get it to work with straight Audio Units and
AudioUnitSetProperty.  See here for the gory details:

http://lists.apple.com/archives/coreaudio-api/2013/Jan/msg9.html

cheers,
Rich


On Mon, Jul 8, 2013 at 6:20 AM, Joe White white.j...@gmail.com wrote:

 Thanks for the link Rich!

 I had a look at your code and I could get the tone patch to work with
 input disabled, but enabling input caused an error:

 * *** ERROR *** -[PdAudioUnit
 initAudioUnitWithSampleRate:numberChannels:inputEnabled:][159] status code
 =  kAudioUnitErr_InvalidPropertyValue*

 I think this is due to the fact that with kAudioUnitSubType_HALOutput you
 need to set up two callbacks for input/output processing:

 *kAudioOutputUnitProperty_SetInputCallback* for retrieving the input
 samples by calling the AudioUnitRender() method, processing the samples and
 storing them into a ring buffer.

  *kAudioUnitProperty_SetRenderCallback* for retrieving the samples stored
 in the ring buffer to output.


 I have a HAL Output Unit working with AUGraph in a controller class. I'll
 try and wrap it up this week and share it.

 However for this purpose I didn't need audio input so I opted for the
 Default Output unit. As you can see in the link from the previous email
 this simplifies the code A LOT :) Maybe it'd be useful to have two projects
 for output only and input/output. With the former being a very quick way
 for people new to libpd to get a project up and running.

 Regarding my issue with libpd not processing audio, as Dan pointed out, it
 *should *be working. However, thinking about it more it could be due to
 how I built the libpd library. I noticed Rich added the whole source code
 into his project so I'll try that and see if it makes any difference. Weird!

 Thanks for the help guys,

 Joe

 On 7 July 2013 03:02, Rich E reakina...@gmail.com wrote:

 I started adding support for using PdAudioUnit in a Cocoa / OS X app
 (PdAudioController is too iOS-specific) and checked my progress into the
 cocoa branch here:

 https://github.com/libpd/libpd/tree/cocoa

 There is a (very basic) working app at:


 https://github.com/libpd/libpd/tree/cocoa/samples/cocoa_samples/CocoaPdBasic

 You can also find some experimentation I did with moving towards an
 AUGraph design but, in the end, I found it much more restrictive than just
 using Audio Units directly.  Apologies for not finding the time to finish
 this, I've been working full-time on a different project for many months
 now... but hopefully once that is done I will finish off those samples,
 unless someone else already has.

 In essence, there were only a few things that needed to be modified. Off
 the top of my head, they were:

 - switch the audio unit to kAudioUnitSubType_HALOutput
 - enable an input audio device (required on OS X, not on iOS)
 - fix some Obj-C syntax issues that are different on OS X (property
 synthesis generation I believe)

 By the way, you can use the C++ wrapper quite readily with any other
 existing audio framework that provides OS X support - I use it in cinder
 apps and of course Dan provides ofxPd.  I know others who have used
 portaudio or FMOD directly.

 cheers,
 Rich


 On Sat, Jul 6, 2013 at 9:04 AM, Dan Wilcox danomat...@gmail.com wrote:

 Sorry. I assumed you were using the existing Obj-C PdAudioUnit and
 PdAudioController classes included with libpd which were written mainly for
 iOS. We should get around to tweaking it so it works on OSX. Did you try it?

 In skimming your code, it looks like you're doing everything the
 PAudioUnit does, so I don't see any obvious problems.


 On Jul 6, 2013, at 8:52 AM, Joe White white.j...@gmail.com wrote:

 Sorry that previous code had some test stuff in it, here's a slightly
 cleaner version (ARC'd)

 http://pastebin.com/index/1bR2Ftqn

 On 6 July 2013 13:47, Joe White white.j...@gmail.com wrote:

 How do you mean the CoreAudio backend? I would have thought I should
 just be able to call the process function in my render callback. Did you
 check out the code I posted? I happy to provide that as an AudioController
 for libpd on OSX. Messages and print objects work correctly but libpd is
 not processing any audio.

 http://pastebin.com/1bR2Ftqn

 Cheers,
 Joe


 On 5 July 2013 23:33, Dan Wilcox danomat...@gmail.com wrote: