Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
|
Class holding the sampled sound for one key. More...
#include <wave.h>
Public Member Functions | |
Wave () | |
Constructor, resetting member variables. More... | |
bool | read (QIODevice &iodevice) |
Read a wave from disk. More... | |
bool | write (QIODevice &iodevice) |
Write a PCM wave to disk (QIODevice) More... | |
bool | insert (const QVector< qint32 > &L, const QVector< qint32 > &R, const bool release, const double amplitude) |
void | printInfo (int keynumber=0) |
Debugging function: Write a short summary of the wave data to qDebug() More... | |
quint32 | getRepetitionIndex () |
double | getRepetitionFactor () |
const QVector< qint16 > * | getSustainSample () |
const QVector< qint16 > * | getReleaseSample () |
int | getReleaseShift () |
int | getSustainShift () |
double | getEnvelope (int index) |
bool | envelopeExists () |
bool | waveFormExists () |
bool | releaseExists () |
void | computeTriangularWave (double frequency, int samplerate, double stereo) |
Compute a synthetic triangular wave. More... | |
Private Member Functions | |
void | computeEnvelope (int samplerate) |
Determine the envelope of the sustain wave. More... | |
void | automaticCyclicMorphing () |
Function defined externally (Importer) More... | |
Private Attributes | |
quint32 | mRepetitionIndex |
Index from where on the sample is repeated. More... | |
double | mRepetitionFactor |
Amplitude decrease factor upon repetition. More... | |
QVector< qint16 > | mSustainSample |
Sound sample when key is pressed. More... | |
QVector< qint16 > | mReleaseSample |
Sound sample when key is releasek. More... | |
int | mSustainShift |
PCM amplitudes shifted # bits to the left. More... | |
int | mReleaseShift |
PCM amplitedes shifted # bits to the left. More... | |
QVector< double > | mEnvelope |
Amplitude envelope. More... | |
const int | maxNumberOfFrames = (1<<20)-2 |
Maximal number of frames. More... | |
const int | envelopeWidth = 0x1000 |
Frames per envelope point. More... | |
Class holding the sampled sound for one key.
A sample is essentially an array of N left-right stereo pairs of signed 16-bit PCM values. This class contains two samples, namely, a long mSustainSample (up to 23.8 sec) for the sound of the instrument while the key is pressed, and a short mReleaseSample for the sound of the instrument in the moment when the key is released (usually about a few seconds).
The sustain sample is limited by the maxNumberOfFrames which is defined here as 20 bits or 1048576 frames. With a standard sample rate of 44100Hz this corresponds to a duration of 23.77 sec. Thus the maximum size of a sample is about 4MB. 88 keys would make up about 350MB of sample data.
|
private |
Function defined externally (Importer)
Definition at line 1057 of file application.cpp.
|
private |
void Wave::computeTriangularWave | ( | double | frequency, |
int | samplerate, | ||
double | stereo | ||
) |
bool Wave::insert | ( | const QVector< qint32 > & | L, |
const QVector< qint32 > & | R, | ||
const bool | release, | ||
const double | amplitude | ||
) |
void Wave::printInfo | ( | int | keynumber = 0 | ) |
bool Wave::read | ( | QIODevice & | iodevice | ) |
Read a wave from disk.
This function reads the member functions of the class Wave from the given QIODevice. The reading is aborted as soon as the QThread::isInterruptionRequested() flag is turned on.
iodevice | : Reference to the QIODevice opened for reading |
Definition at line 213 of file wave.cpp.
|
inline |
bool Wave::write | ( | QIODevice & | iodevice | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |