• Home
  • Raw
  • Download

Lines Matching +full:is +full:- +full:stream

7    This file is part of the Sonic Library.
9 This file is licensed under the Apache 2.0 license.
15 generates smooth speech at speed up factors as high as 6X, possibly more. It is
18 more, the following equation is used:
20 newSamples = period/(speed - 1.0)
23 where period is the current pitch period, determined using AMDF or any other
24 pitch estimator, and speed is the speedup factor. If the current position in
25 the input stream is pointed to by "samples", and the current output stream
26 position is pointed to by "out", then newSamples number of samples can be
29 out[t] = (samples[t]*(newSamples - t) + samples[t + period]*t)/newSamples;
31 where t = 0 to newSamples - 1.
33 For speed factors < 2X, the PICOLA algorithm is used. The above
34 algorithm is first used to double the speed of one pitch period. Then, enough
35 input is directly copied from the input to the output to achieve the desired
36 speed up factor, where 1.0 < speed < 2.0. The amount of data copied is derived:
40 length(speed - 1) = 2*period - speed*period
41 length = period*(2 - speed)/(speed - 1)
43 For slowing down speech where 0.5 < speed < 1.0, a pitch period is inserted into
44 the output twice, and length of input is copied from the input to the output
45 until the output desired speed is reached. The length of data copied is:
47 length = period*(speed - 0.5)/(1 - speed)
49 For slow down factors below 0.5, no data is copied, and an algorithm
50 similar to high speed factors is used.
53 /* Uncomment this to use sin-wav based overlap add which in theory can improve
119 /* These are used to down-sample some inputs to improve speed */
125 /* For all of the following functions, numChannels is multiplied by numSamples
128 /* Create a sonic stream. Return NULL only if we are out of memory and cannot
129 allocate the stream. Set numChannels to 1 for mono, and 2 for stereo. */
131 /* Destroy the sonic stream. */
132 void sonicDestroyStream(sonicStream stream);
133 /* Attach user data to the stream. */
134 void sonicSetUserData(sonicStream stream, void *userData);
135 /* Retrieve user data attached to the stream. */
136 void *sonicGetUserData(sonicStream stream);
137 /* Use this to write floating point data to be speed up or down into the stream.
138 Values must be between -1 and 1. Return 0 if memory realloc failed,
140 int sonicWriteFloatToStream(sonicStream stream, const float* samples, int numSamples);
141 /* Use this to write 16-bit data to be speed up or down into the stream.
143 int sonicWriteShortToStream(sonicStream stream, const short* samples, int numSamples);
144 /* Use this to write 8-bit unsigned data to be speed up or down into the stream.
146 int sonicWriteUnsignedCharToStream(sonicStream stream, const unsigned char* samples,
148 /* Use this to read floating point data out of the stream. Sometimes no data
149 will be available, and zero is returned, which is not an error condition. */
150 int sonicReadFloatFromStream(sonicStream stream, float* samples,
152 /* Use this to read 16-bit data out of the stream. Sometimes no data will
153 be available, and zero is returned, which is not an error condition. */
154 int sonicReadShortFromStream(sonicStream stream, short* samples,
156 /* Use this to read 8-bit unsigned data out of the stream. Sometimes no data
157 will be available, and zero is returned, which is not an error condition. */
158 int sonicReadUnsignedCharFromStream(sonicStream stream, unsigned char* samples,
160 /* Force the sonic stream to generate output using whatever data it currently
163 int sonicFlushStream(sonicStream stream);
165 int sonicSamplesAvailable(sonicStream stream);
166 /* Get the speed of the stream. */
167 float sonicGetSpeed(sonicStream stream);
168 /* Set the speed of the stream. */
169 void sonicSetSpeed(sonicStream stream, float speed);
170 /* Get the pitch of the stream. */
171 float sonicGetPitch(sonicStream stream);
172 /* Set the pitch of the stream. */
173 void sonicSetPitch(sonicStream stream, float pitch);
174 /* Get the rate of the stream. */
175 float sonicGetRate(sonicStream stream);
176 /* Set the rate of the stream. */
177 void sonicSetRate(sonicStream stream, float rate);
178 /* Get the scaling factor of the stream. */
179 float sonicGetVolume(sonicStream stream);
180 /* Set the scaling factor of the stream. */
181 void sonicSetVolume(sonicStream stream, float volume);
182 /* Chord pitch is DEPRECATED. AFAIK, it was never used by anyone. These
185 int sonicGetChordPitch(sonicStream stream);
186 /* Set chord pitch mode on or off. Default is off. See the documentation
188 void sonicSetChordPitch(sonicStream stream, int useChordPitch);
190 int sonicGetQuality(sonicStream stream);
191 /* Set the "quality". Default 0 is virtually as good as 1, but very much
193 void sonicSetQuality(sonicStream stream, int quality);
194 /* Get the sample rate of the stream. */
195 int sonicGetSampleRate(sonicStream stream);
196 /* Set the sample rate of the stream. This will drop any samples that have not
198 void sonicSetSampleRate(sonicStream stream, int sampleRate);
200 int sonicGetNumChannels(sonicStream stream);
203 void sonicSetNumChannels(sonicStream stream, int numChannels);
204 /* This is a non-stream oriented interface to just change the speed of a sound
205 sample. It works in-place on the sample array, so there must be at least
211 /* This is a non-stream oriented interface to just change the speed of a sound
212 sample. It works in-place on the sample array, so there must be at least
222 Time-Aliased-FFTs as described at:
226 Basically, two adjacent pitch periods are overlap-added to create a sound
228 This set of samples is converted to a spetral line using an FFT, and the result
229 is saved as a single spectral line at that moment in time. The resulting
230 spectral lines vary in resolution (it is equal to the number of samples in the
234 To generate a bitmap, linear interpolation is used to render the grayscale
246 pixel is from 0 (black) to 255 (white). Bitmaps are rows*cols in size.
257 void sonicComputeSpectrogram(sonicStream stream);
260 sonicSpectrogram sonicGetSpectrogram(sonicStream stream);
266 /* Destroy the spectrotram. This is called automatically when calling