Re: reading audio files off a CD under X
Re: reading audio files off a CD under X
- Subject: Re: reading audio files off a CD under X
- From: Todd Heberlein <email@hidden>
- Date: Thu, 11 Apr 2002 10:43:45 -0700
On 4/10/02 11:54 PM, "Jarrell Irvin" <email@hidden> wrote:
>
Just to clarify my previous post, I want to read files (i.e songs) off of
>
an audio CD into my Carbon application; I amn pretty sure AIFF is not
>
used to store the files on audio CDs.
I am not an expert in this, but Laurent mentioned that from the application
point of view, the audio songs appear as AIFF files. Below is a snippet of
code I wrote that uses libsndfile to read/write audio files, and the output
of that code is
% ./play_cd /Volumes/Audio\ CD/Track\ 05.cdda
sample rate: 44100
samples: 13144740
channles: 2
pcm bit width: 16
format: 20008
sections: 1
seekable: 1
Max signal: 32401
Note, the backslash space, '\ ',is used to get the spaces in the directory
and file names past the shell. This track happens to be "Smooth" from my
Santana Supernatural CD that is currently in my drive.
According the libsndfile documentation, a format of 20008 (hexadecimal)
implies a little endian AIFF file format.
SNDFILE* sf = NULL;
SF_INFO sf_info;
sf = sf_open_read(argv[1], &sf_info);
if (sf == NULL) {
cerr << "Could not open sound file " << argv[1] << endl;
return -1;
}
cout << " sample rate: " << sf_info.samplerate << endl;
cout << " samples: " << sf_info.samples << endl;
cout << " channles: " << sf_info.channels << endl;
cout << "pcm bit width: " << sf_info.pcmbitwidth << endl;
cout << " format: " << hex << sf_info.format << dec << endl;
cout << " sections: " << sf_info.sections << endl;
cout << " seekable: " << sf_info.seekable << endl;
cout << " Max signal: " << sf_signal_max(sf) << endl;
cout << endl << endl;
Todd
PS. I just wrote a quick Cocoa application using libsndfile to read CD audio
tracks and play them through an AudioDevice IOProc. It works fine.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.