From sadowski@apple.com Mon Sep 10 19:35:19 2007 From: sadowski@apple.com (Caitlin Sadowski) Date: Mon, 10 Sep 2007 11:35:19 -0700 Subject: [Stk] recording audio mac osx Message-ID: <8FFB72C3-767A-4499-93CE-95E4701382DA@apple.com> --Apple-Mail-1-688722322 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hey, I am attempting to write code which records 10 seconds (or else until the enter key is pressed) of audio in coming from a 24-bit Edirol and saves it as a WAV file. I have been using a callback function since I am working on Mac OSX (and the blocking audio classes seem to sometimes run into buffering problems on this OS). The code I have written seems to work on my Macbook without the Edirol, but when I try to use it in on my other computer (PPC G5), with or without the Edirol, a file is recorded, but it is unplayable, appears to be formatted incorrectly somehow, and shows up as having 0 channels. I am compiling the STK library files i reference in my program for both ppc and intel chips. I am missing something? There is not too much to the code (and it is mostly based on the sample code from the tutorial) so I have included it below. Am I using RtAudio with callbacks correctly? Any other ideas on what is going wrong? Thank you, Caitlin Sadowski static const Stk::StkFormat FILE_OUT_FORMAT = Stk::STK_SINT16; int handleRead( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *outputFile ) { unsigned int i, j; StkFrames frame( 1, 2 ); //one frame with two channels StkFloat *buffer = (StkFloat *) inputBuffer; FileWvOut *output = (FileWvOut *)outputFile; for ( i=0; itickFrame( frame ); } return 0; } int recToFileCallback (string waveOutName, int length, int sampleRate) { Stk::showWarnings( true ); StkFrames frame( 1, NUMBER_OF_CHANNELS ); //one frame with two channels Stk::setSampleRate( sampleRate ); RtAudio adc; FileWvOut output; unsigned int bufferFrames = RT_BUFFER_SIZE; // sample frames, if we need to specifiy RtAudio::StreamParameters inParameters; inParameters.deviceId = adc.getDefaultInputDevice(); inParameters.nChannels = 2; inParameters.firstChannel = 0; RtAudio::StreamOptions inOptions; RtAudioFormat format = RTAUDIO_SINT24; try { output.openFile (waveOutName, NUMBER_OF_CHANNELS, FileWrite::FILE_WAV, FILE_OUT_FORMAT); adc.openStream( NULL, &inParameters, format, sampleRate, &bufferFrames, &handleRead, (void *)(&output), &inOptions ); adc.startStream(); } catch ( RtError& e ) { e.printMessage(); exit( 0 ); } char input; std::cout << "\nPlaying ... press to quit.\n"; std::cin.get( input ); try { adc.stopStream(); } catch (RtError& e) { e.printMessage(); } if ( adc.isStreamOpen() ) adc.closeStream(); output.closeFile(); return 0; } --Apple-Mail-1-688722322 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Hey,=A0

I am attempting to write = code which records 10 seconds (or else until the enter key is = pressed)=A0of audio in coming from a 24-bit Edirol=A0 and saves it as a = WAV file. I have been using a callback function since I am working on = Mac OSX (and the blocking audio classes seem to sometimes run into = buffering problems on this OS).

The code I have written = seems to work on my Macbook without the Edirol, but when I try to use it = in on my other computer (PPC G5), with or without the Edirol, a file is = recorded, but it is unplayable, appears to be formatted incorrectly = somehow, and shows up as having 0 channels. I am compiling the STK = library files i reference in my program for both ppc and intel = chips.

I am = missing something? There is not too much to the code (and it is mostly = based on the sample code from the tutorial) so I have included it below. = Am I using RtAudio with callbacks correctly? Any other ideas on what is = going wrong?

Thank you,

Caitlin = Sadowski

static = const Stk::StkFormat = FILE_OUT_FORMAT =3D Stk::STK_SINT16;

int handleRead( = void *outputBuffer, = void *inputBuffer, = unsigned = int = nBufferFrames,
double streamTime, RtAudioStreamStatus status, = void *outputFile = )
{
unsigned int = i, j;
StkFrames frame( = 1, 2 );=A0 = //one frame with two = channels
StkFloat *buffer =3D= (StkFloat *) inputBuffer;
FileWvOut *output = =3D (FileWvOut *)outputFile;
=A0= =A0 for ( = i=3D0; i<nBufferFrames; i++ ) = {
for = ( j=3D0; j < NUMBER_OF_CHANNELS; j++ ) = {=A0
frame = (0, j) =3D *buffer;
*buffer++;
}
output->tickFrame( frame );
=A0= =A0 } = = =
return 0;
}

int = recToFileCallback=A0 (string = waveOutName, int = length, int sampleRate) = {


Stk::showWarnings( = true = );
StkFrames frame( 1, = NUMBER_OF_CHANNELS );=A0 //one frame with two channels
Stk::setSampleRate( sampleRate = );


RtAudio = adc;
=A0 =A0 = FileWvOut output;


unsigned int = bufferFrames =3D RT_BUFFER_SIZE; // sample frames, if we need to specifiy


RtAudio::StreamParameters inParameters;
inParameters.deviceId =3D = adc.getDefaultInputDevice();
inParameters.nChannels =3D 2;
inParameters.firstChannel =3D 0;


RtAudio::StreamOptions inOptions;
RtAudioFormat = format =3D RTAUDIO_SINT24;

try = {
output.openFile (waveOutName, = NUMBER_OF_CHANNELS, FileWrite::FILE_WAV, = FILE_OUT_FORMAT);
adc.openStream( = NULL, = &inParameters, format, sampleRate,=A0
= &bufferFrames, = &handleRead, (void = *)(&output), &inOptions ); = =A0 =A0 = adc.startStream();
}
catch = ( RtError& e ) {
e.printMessage();
exit( = 0 );
}
char = input;
std::cout << = "\nPlaying ... press <enter> to = quit.\n";
std::cin.get( = input ); =
try = {
adc.stopStream();
}
catch = (RtError& e) {
e.printMessage();
} =
if = ( adc.isStreamOpen() ) adc.closeStream();
output.closeFile();
return 0;
}

= --Apple-Mail-1-688722322-- From marci.gagliardi@gmail.com Tue Sep 11 10:00:16 2007 From: marci.gagliardi@gmail.com (Marcello Gagliardi) Date: Tue, 11 Sep 2007 10:00:16 +0100 Subject: [Stk] compile BillGaitLab Message-ID: Hi, I've just bought the book "Real Sound Synthesis for Interactive Applications" by Perry Cook, and I'm having trouble on making the BillsGaitLab synthesis working. I guess I have to compile it myself on my Mac-Intel machine, but I keep getting errors. Besides compiling by hand is a bit cumbersome because many files are to be included in the project. Does anybody know a quick way to compile the Synthesis of Walking Sounds?It is not mentioned on the website and I don't know the files hierarchy as well. Many thanks, Marcello Gagliardi From prc@CS.Princeton.EDU Fri Sep 14 05:11:52 2007 From: prc@CS.Princeton.EDU (Perry R Cook) Date: Fri, 14 Sep 2007 00:11:52 -0400 (EDT) Subject: [Stk] compile BillGaitLab In-Reply-To: References: Message-ID: Marcello, The whole project was built under Windoze, and I haven't gone back to get it ported to Mac. It's on my (long) list of things to do, but don't hold your breath. Gary Scavone had a student working on this some, maybe they've made some headway on a Mac-workable version. PRC On Tue, 11 Sep 2007, Marcello Gagliardi wrote: > Hi, > > I've just bought the book "Real Sound Synthesis for Interactive Applications" > by Perry Cook, and I'm having trouble on making the BillsGaitLab synthesis > working. I guess I have to compile it myself on my Mac-Intel machine, but I > keep getting errors. Besides compiling by hand is a bit cumbersome because > many files are to be included in the project. Does anybody know a quick way > to compile the Synthesis of Walking Sounds?It is not mentioned on the website > and I don't know the files hierarchy as well. > > Many thanks, > > Marcello Gagliardi > > _______________________________________________ > Stk mailing list > Stk@ccrma.stanford.edu > http://ccrma-mail.stanford.edu/mailman/listinfo/stk From chlikaflok@gmail.com Fri Sep 14 15:05:29 2007 From: chlikaflok@gmail.com (=?ISO-8859-1?Q?Rapha=EBl_Tremblay_Lessard?=) Date: Fri, 14 Sep 2007 10:05:29 -0400 Subject: [Stk] compile BillGaitLab In-Reply-To: References: Message-ID: <60993c0b0709140705t2b676e83p83835fdc8031f226@mail.gmail.com> ------=_Part_1977_12657077.1189778730620 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Marcello, (and probably other Mac-Intel users) It is my understanding that Mac-Intels are pretty much compatible with anything x86 based. Your problem may reside within the precompiler defines and the libraries. The usual culprits... I know it seems obvious, but I hav= e learned that we often need a reminder of the simple stuff. Cheers, Rapha=EBl Tremblay Lessard On 9/14/07, Perry R Cook wrote: > > Marcello, > > The whole project was built under Windoze, and I > haven't gone back to get it ported to Mac. It's > on my (long) list of things to do, but don't hold > your breath. Gary Scavone had a student working > on this some, maybe they've made some headway on > a Mac-workable version. > > PRC > > On Tue, 11 Sep 2007, Marcello Gagliardi wrote: > > > Hi, > > > > I've just bought the book "Real Sound Synthesis for Interactive > Applications" > > by Perry Cook, and I'm having trouble on making the BillsGaitLab > synthesis > > working. I guess I have to compile it myself on my Mac-Intel machine, > but I > > keep getting errors. Besides compiling by hand is a bit cumbersome > because > > many files are to be included in the project. Does anybody know a quick > way > > to compile the Synthesis of Walking Sounds?It is not mentioned on the > website > > and I don't know the files hierarchy as well. > > > > Many thanks, > > > > Marcello Gagliardi > > > > _______________________________________________ > > Stk mailing list > > Stk@ccrma.stanford.edu > > http://ccrma-mail.stanford.edu/mailman/listinfo/stk > > _______________________________________________ > Stk mailing list > Stk@ccrma.stanford.edu > http://ccrma-mail.stanford.edu/mailman/listinfo/stk > ------=_Part_1977_12657077.1189778730620 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Marcello, (and probably other Mac-Intel users)
 
It is my understanding that Mac-Intels are pretty much compatible with= anything x86 based. Your problem may reside within the precompiler defines= and the libraries. The usual culprits... I know it seems obvious, but I ha= ve learned that we often need a reminder of the simple stuff.
 
Cheers,
Rapha=EBl Tremblay Lessard

 
On 9/14/07, = Perry R Cook <prc@cs.princet= on.edu> wrote:
Marcello,

The whole proje= ct was built under Windoze, and I
haven't gone back to get it ported= to Mac.  It's
on my (long) list of things to do, but don't hold
your breath.&n= bsp; Gary Scavone had a student working
on this some, maybe they= 9;ve made some headway on
a Mac-workable version.

PRC

On T= ue, 11 Sep 2007, Marcello Gagliardi wrote:

> Hi,
>
> I've just bought the book "Real S= ound Synthesis for Interactive Applications"
> by Perry Cook, an= d I'm having trouble on making the BillsGaitLab synthesis
> worki= ng. I guess I have to compile it myself on my Mac-Intel machine, but I
> keep getting errors. Besides compiling by hand is a bit cumbersome= because
> many files are to be included in the project. Does anybody= know a quick way
> to compile the Synthesis of Walking Sounds?It is = not mentioned on the website
> and I don't know the files hierarchy as well.
>
> = Many thanks,
>
> Marcello Gagliardi
>
> ___________= ____________________________________
> Stk mailing list
> Stk@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk=

_______________________________________________
Stk mailing = list
Stk@ccrma.stanford.eduhttp://ccr= ma-mail.stanford.edu/mailman/listinfo/stk

------=_Part_1977_12657077.1189778730620--