[Stk] Reading and writing disk wav file and the real time recorded wav file

alpana jui lpnjui at googlemail.com
Wed Oct 8 01:43:31 PDT 2008


Dear Steve:


 Thank you very much for your kind advice and help. I do not know if
you  would be curious to read the objective of the project of using
Stk(actually, for RtAdudio: this is I learned from my former
colleague)  in the project.


Actually, this is a speech recognition project in this university and
playing back is not really the case.  Stk was used by my former
colleague for obtaining RtAudio for reading wav files that are in the
disk and  have been recorded and collected earlier for wavelet
analysis and later for classification. My role to work for
classification.  But I know nothing more about Stk or RtAudio.  I am
replacing my colleague  who is no longer in the project  for the
remaining task but I could not manage to use the RtAudio or Stk yet
for the purpse my colleague used for.  IN reality, my part  here is
for speech recognition  and the technical issue of speech synthesis is
not a case for me. And for this speech recognition, I need the audio
files analysis. The audio files here are some voice commands.

In this project, the collected voice commands i.e., "lichtan.wav " ,
"Radioan. wav", "notruf.wav"  etc  will be analyzed by some signal
processing techniques.   These trained data that were already analyzed
  will be compared with  real time audio data which is also required
to be analyzed by signal processing technique  for obtaining the
comparison result between the training data  and the real time test
data.  The result of the comparison between the two  by classification
techniques will be used for speech recognition result. And for this,
we need first to read the audio  files  for training that are in the
disk and were  recorded and collected already by some software(it is
not a matter how the voice data are obtained in the first place for
analysis but this has to be processed for signal analysis. This is the
reason I need to read the disk files , i.e., licht an.wav,   first and
then to try to see if these  data can be stored for signal analysis,
if so how the data are stored. Because my colleague suggested that
this signal analysis technique written by my colleague only accepts
vector float data.  In this case, I need to  be more detail oriented
for signal processing for feature extraction for my classification
task. I do not have much knowledge about Stk or RtAdudio term or the
audio term.

The objective of using audio interface in my application in the short
time project is to read the disk file, for example , some commands:
licht an, notruf, Radio an etc and record the files for reading these
to compare these later after signal processing with the earlier files
that were already in the disk to learn the similarity.


Would you suggest Chuck would help me to use this for my purpose in a
short time, please. I will  appreciate your advice very much and go
through the "Chuck" site to achieve my goal.

Thank you so much for the valuable time and advice. Further, I will
appreciate any advice, comments or suggestions to continue my task
either using Chuck or Stk or RtAudio.  In fact, I am having some
difficulties managing this audio interface as required.

Sincerely,Jui

On Wed, Oct 8, 2008 at 1:32 AM, Stephen Sinclair
<sinclair at music.mcgill.ca> wrote:
> Jui,
>
> On Tue, Oct 7, 2008 at 6:26 PM, alpana jui <lpnjui at googlemail.com> wrote:
>
> [ ... skip ... ]
>
>> Further,  I could not manage to compute the frame length of the wav
>> file. How  can I do that?
>
> FileWvIn::getChannels() will give you the number of samples in a frame.
>
>
>> I have also some questions on the sample text, is the sample is in
>> vector form or it is just a single sample? How many samples in each
>> frame ? How can I received the samples in a frame as a vector.
>
> This depends on how the wav file was recorded.  If it was recorded
> mono then the frame size will be 1.  If you call the tick() function
> as is shown in your code, then it will average all the channels of
> each frame together to give you a single sample.  If you call the
> StkFrames version of tick() then you'll get an StkFrames object with
> the samples for each channel.
>
> I don't really understand why you need more than one channel for your
> application however, since you are talking about analysing voice
> commands.
>
>
>> Can FileRead and FileWrite be directly used for my purpose of using
>> Stk,, i.e., reading and writing the disk files and recorded files,  if
>> so , would this be possible to get some hints on this, please?
>
> I think FileWvIn is easier to use.
>
>
>> I am not clear about the "tick " method or function or the purpose of
>> this. I do not know if I need this for my purposes. Could anybody make
>> comment on this, please?
>
> It's used to step through the synthesis (in your case, reading from a
> file) one sample at a time.
>
>
>> Do I need to use callback function for my purposes?
>
> Callback is used for playing real-time audio.
>
>
>> I will appreciate any response and support as well as advice  for my
>> success in my application while trying to use Stk-4.2.1.
>
> As you can see from using STK so far, it is in fact a class framework
> for writing audio synthesizers.  That is, you can start with simple
> unit generators and call their tick() functions to produce one sample
> (or frame) of audio, and pass it on to another unit generator.
>
> Some of these unit generators such as FileWvIn and FileWvOut can
> interact with .wav files, and this is a great convenience.  But...
>
> Now, I don't want to discourage you from learning C++, but have you
> considered that STK may not be the best choice for what you are trying
> to do?  There are many higher-level languages that are far easier to
> use and are quite robust that would probably accomplish what you want
> to do faster.  I really suggest checking out things like Pure Data,
> ChucK, Max/MSP.
>
> For instance, here is some chuck code that will record a 3-second wav
> file and then play it back and then print each sample to the console:
>
>
> fun void record() {
>   adc => WvOut w => blackhole;
>   "test.wav" => w.wavFilename;
>   3::second => now;
>   w.closeFile();
> }
> fun void readit(int print) {
>   WvIn w => blackhole;
>   if (!print) w => dac;
>   "test.wav" => w.path;
>   now + 3::second => time end;
>   while (now < end) {
>       if (print) <<<w.last()>>>;
>       1::samp => now;
>   }
> }
> record();
> readit(0);
> readit(1);
>
>
> Steve
>



More information about the Stk mailing list