[Impromptu] Speech as Audio Unit?
Andrew Sorensen
andrew at moso.com.au
Sat Mar 21 13:56:15 GMT 2009
Glen,
Yes, as you've figured out you need to use NSMutableData and property
3331.
Here's an example that will do what you want (caveat to follow :-)
(define speech (au:make-node "augn" "ttsp" "appl"))
(au:connect-node speech 0 *au:output-node* 0)
(au:update-graph)
(define dat (objc:call "NSMutableData" "dataWithLength:" 4))
(define my-speech-channel-data (objc:call dat "bytes"))
(au:get-property speech 3331 *au:global-scope* 0 my-speech-channel-
data 4)
(au:speak (now) my-speech-channel-data "hello world")
The caveat is that au:speak does not work with the speech AU. Behind
the scenes this is because the speech AU requires a different "speech"
call. Seeing as we can now use the speech AU (which was not available
prior to 10.5) I'm going to switch au:speak over to use this new call
(this will be in 1.4) and deprecate the old au:get-speech* code.
Cheers,
Andrew.
On 20/03/2009, at 3:04 AM, Glen F wrote:
> To (partly) answer myself -- I didn't get the TTY speech AU to work
> yet, but I did manage to get it to work using NetAudio and the shell
> command "say -n"...I'd still like to know if it's possible the other
> way, directly using the "ttsp" Audio Unit and Impromptu speech
> commands... Here's the (or, at least, a) working version:
>
> (define reverb (au:make-node "aufx" "mrev" "appl"))
> (define netaudio (au:make-node "augn" "nrcv" "appl"))
> (au:connect-node netaudio 0 reverb 0)
> (au:connect-node reverb 0 *au:output-node* 0)
> (au:update-graph)
>
> (au:set-param (now) netaudio 0 *au:global-scope* 0 4)
> ; That actually doesn't work (nor to the values 0, 1, 2, 3).
> ; I'm not sure how to set the state to "connecting" without using
> ; the "connect" button in the UI! Until I learn otherwise...click it!
> (au:open-view netaudio)
>
> ; perhaps there's a more elegant way to do this?
> (define shell "do shell script \"say -n AUNetSend 'ree-verby!'\"")
> (sys:run-applescript shell)
>
>
> On Thu, Mar 19, 2009 at 12:31 PM, Glen F <holaglen at gmail.com> wrote:
> Hi there -- can anyone help me get speech synthesis working as an
> Audio Unit? I did it "without", but discovered it was not recorded
> when using au:start-audio-capture...therefore, I want to set it up
> using an AU.
>
> Seems there are a few options, but the most tantalizing is the
> speech AU in OS X 10.5...(don't need to use NetReceive) But I'm not
> sure how to get it to talk...I need to get the relevant "channel",
> but am not familiar enough with this stuff to know exactly how...
>
> (define speech (au:make-node "augn" "ttsp" "appl"))
> (define reverb (au:make-node "aufx" "mrev" "appl"))
> (au:connect-node speech 0 reverb 0)
> (au:connect-node reverb 0 *au:output-node* 0)
> (au:update-graph)
> (au:print-graph)
>
> (define voice1 (au:get-speech-channel)) ; this is wrong, I think...?
> (au:speak (now) voice1 "Ree-verby!") ; seems to use a non-AU voice
> channel
>
> I think I'd need to use au:get-property on property 3331
> (kAudioUnitProperty_SpeechChannel), but am not sure exactly how to
> set things up using NSMutableData and all that...or even if that's
> the right approach. Or do I need to use the system call "say -n"
> and NetReceive AUnit to get this going?
>
> Thanks for any tips,
> Glen.
>
>
>
>
>
> _______________________________________________
> Impromptu mailing list
> Impromptu at lists.moso.com.au
> http://lists.moso.com.au/mailman/listinfo/impromptu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.moso.com.au/pipermail/impromptu/attachments/20090321/8b99d56d/attachment-0001.htm
More information about the Impromptu
mailing list