Kyma Forum
  Tips & Techniques
  SPC file format?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   SPC file format?
Hitoshi Chino
Member
posted 05 October 2004 03:44         Edit/Delete Message   Reply w/Quote
I've been trying to create a C++ library that reads/writes SPC file.
On reading the document about the file format, I have some questions:

1. Can I always assume that the actual size of the frame is the number of partials recorded in the SPC file plus four?
2. How to calculate the standard frame length? I tried:
length (nsec) = NumberOfSamplesInAFrame / SampleRate * 1000000000
length * NumberOfFrames seems different from the time shown in the Sound Browser.

I have some more undocumented kind of questions. Please answer them if they are not secrets

1. What is MARKER section? How can I write it?
2. What is INST section? How can I write it?
3. What is APPL-KYMA section? How can I write it?

IP: Logged

SSC
Administrator
posted 05 October 2004 11:22         Edit/Delete Message   Reply w/Quote
1. The size of the frame should be a power of two greater-or-equal to the number of partials. (Each spectral frame should be padded with zero amplitude partials.)

2. The number of sample frames divided by the frame size (power of two from answer 1) is the number of spectral frames. That number times the frame duration should be the duration of the resynthesis. The frame duration should be set to indicate how much time a sprectral frame represents.

For your additional questions:

1. The MARKER chunk is used to indicate loop points for the spectrum editor. The format of the chunk is identical to an AIFF MARKER chunk. (For correctness, the marker should point to a multiple of the frame size and not to an arbitrary sample index.)

2. The INST chunk is the same as the AIFF INST chunk and provides information about the base pitch, pitch range and velocity range that the file should be used on.

3. The APPL-KYMA chunk is not really necessary. If is used to fill in space so that the start of the spectral data is at the beginning of an allocation block for the disk that the file is stored on.

IP: Logged

Hitoshi Chino
Member
posted 06 October 2004 04:06         Edit/Delete Message   Reply w/Quote
Thanks! and I'm sorry that I wasn't very specific....

What I wanted to know in question 1 was why the number of partials in a frame recorded in a SPC file seemed four less than the number chosen on creation. For example, in 128 partial SPC files, 124 is recorded as the number of partials. Does that mean that in such a frame, only 124 partials are valid? On the other hand, when I write an SPC file, the data I can pack in a 128 partial frame is only 124 partials?

In question 2, suppose I have an original sample file (AIFF) and its frequency-domain analysis, how can I set the frame time so that their durations be the same? If I calculate the duration of the original file and divide it by the number of frames, then it might be possble, but the dependency is awkward.

Well, I'm not just hacking SPC files. I was trying to create a Sound in which !KeyDown triggers an SPC file fed to the Filter Bank Element, which carves the input sound. So far, SPC files can be created only by analizing and modifying the existing sound. But in this case I need the way to make them from the scratch....

Thanks,
Hitoshi.

IP: Logged

SSC
Administrator
posted 06 October 2004 09:41         Edit/Delete Message   Reply w/Quote
>What I wanted to know in question 1 was why the number of partials in a frame recorded in >a SPC file seemed four less than the number chosen on creation. For example, in 128 >partial SPC files, 124 is recorded as the number of partials. Does that mean that in such a >frame, only 124 partials are valid?

Yes, for harmonic spectra (the spectra with 'h' after the name), partials 1 through (nbrPartials - 4) are valid (for 's' spectral, ALL partials are valid). However, you can create your own files with the full 128 and Kyma will read them correctly (for both 'h' and 's').


>In question 2, suppose I have an original sample file (AIFF) and its frequency-domain >analysis, how can I set the frame time so that their durations be the same? If I calculate the >duration of the original file and divide it by the number of frames

That sounds like it should work.

>Well, I'm not just hacking SPC files. I was trying to create a Sound in which !KeyDown >triggers an SPC file fed to the Filter Bank Element, which carves the input sound. So far, SPC >files can be created only by analizing and modifying the existing sound. But in this case I >need the way to make them from the scratch....

Do you want to create a spectrum without analyzing an existing Sound? You could try using SyntheticSpectrumFromArray as your spectral source.

Or do you want to control the FilterBank without creating a spectrum file? You could use the live spectral analysis and skip the step of saving to disk.

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c