BGC Tools
|
Operations for Loading and Saving WAV files Some documentation on the WAV format is available here: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html More...
Public Types | |
enum | Format : ushort { Format.UNDEFINED = 0x0000, Format.PCM = 0x0001, Format.IEEE_Float = 0x0003, Format.A_Law = 0x0006, Format.u_Law = 0x0007, Format.Extensible = 0xFFFE } |
Static Public Member Functions | |
static bool | LoadBGCStream (string filepath, out IBGCStream stream) |
Loads a WAV file from the filepath as a SimpleAudioClip, returns success. More... | |
static bool | LoadBGCSimple (string filepath, out SimpleAudioClip simpleAudioClip) |
Loads a WAV file from the filepath as a SimpleAudioClip, returns success. More... | |
static bool | LoadBGCStereo (string filepath, out InterlacingAudioClip interlacingAudioClip) |
Loads a WAV file from the filepath as a InterlacingAudioClip, returns success. More... | |
static bool | LoadFile (string filepath, out int channels, out float[] samples) |
Loads a WAV file from the filepath as a float array, returns success. More... | |
static bool | LoadStereoFile (string filepath, out float[] leftSamples, out float[] rightSamples) |
Loads a Stereo WAV file from the filepath as two float arrays, returns success. More... | |
static bool | LoadPCMFile (string filepath, out int channels, out short[] samples) |
Loads a WAV file from the filepath as a PCM short array, returns success. More... | |
static bool | SaveStream (string filepath, IBGCStream stream, bool overwrite=false) |
Save the samples passed in as a WAVE file with the specified filepath. Returns success. More... | |
static bool | SaveFile (string filepath, int channels, float[] samples, bool overwrite=false) |
Save the samples passed in as a WAVE file with the specified filepath. Returns success. More... | |
static bool | SaveFile (string filepath, int channels, short[] samples, bool overwrite=false) |
Save the samples passed in as a WAVE file with the specified filepath. Returns success. More... | |
static bool | SaveFile (string filepath, int channels, float[] leftSamples, float[] rightSamples, bool overwrite=false) |
Save the samples passed in as a WAVE file with the specified filepath. Returns success. More... | |
Private Member Functions | |
delegate bool | DataParser< T > (byte[] rawData, Format format, int channels, out T parsedData) |
delegate T | DataResampler< T > (T inputData, double inputSamplingRate, double outputSamplingRate, int channels) |
delegate bool | DataWriter< T > (string filepath, T data, int channels) |
Static Private Member Functions | |
static bool | ReadFile< T > (string filepath, DataParser< T > dataParser, DataResampler< T > dataResampler, out T parsedData, out int channels) |
Internal method to load a WAV file an parse the data More... | |
static bool | ReadFMT (string filepath, byte[] buffer, out int channels, out int samplingRate, out Format format) |
Read in Format Chunk. Returns success More... | |
static FileStream | CreateFile (string filepath, int samples, int channels=2) |
static bool | ReadPCMDATA (byte[] buffer, Format format, int channels, out short[] samples) |
Read in DATA chunk. Returns success. More... | |
static bool | SimpleReadDATA (byte[] buffer, Format format, int channels, out float[] samples) |
Read in DATA chunk. Returns success. More... | |
static bool | ReadStereoDATA (byte[] buffer, Format format, int channels, out(float[] leftSamples, float[] rightSamples) samples) |
Read in Stereo DATA chunk. Returns success. More... | |
static bool | ReadStereoDATA (byte[] buffer, Format format, int channels, out float[] leftSamples, out float[] rightSamples) |
Read in Stereo DATA chunk. Returns success. More... | |
static bool | WriteFile< T > (string filepath, T data, int channels, DataWriter< T > dataWriter, bool overwrite=false) |
Save the samples passed in as a WAVE file with the specified filepath. Returns success. More... | |
static bool | SimpleWriter (string filepath, float[] samples, int channels) |
static bool | StreamWriter (string filepath, IBGCStream stream, int channels) |
static bool | SimpleWriter (string filepath, short[] samples, int channels) |
static bool | StereoWriter (string filepath,(float[] left, float[] right) samples, int channels) |
Private Attributes | |
const float | toInt16Factor = 32767f |
const float | toFloatFactor = 1f / 32767f |
Operations for Loading and Saving WAV files Some documentation on the WAV format is available here: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
Definition at line 14 of file WaveEncoding.cs.
|
strong |
Enumerator | |
---|---|
UNDEFINED | |
PCM | |
IEEE_Float | |
A_Law | |
u_Law | |
Extensible |
Definition at line 16 of file WaveEncoding.cs.
|
inlinestaticprivate |
Definition at line 452 of file WaveEncoding.cs.
|
private |
|
private |
|
private |
|
inlinestatic |
Loads a WAV file from the filepath as a SimpleAudioClip, returns success.
Definition at line 54 of file WaveEncoding.cs.
References BGC.Audio.LinearInterpolation.Resample().
Referenced by BGC.Tests.TestOverlapAdd.TestCarlileShuffler(), and BGC.Tests.TestOverlapAdd.TestPhaseVocoding().
|
inlinestatic |
Loads a WAV file from the filepath as a InterlacingAudioClip, returns success.
Definition at line 76 of file WaveEncoding.cs.
|
inlinestatic |
Loads a WAV file from the filepath as a SimpleAudioClip, returns success.
Definition at line 32 of file WaveEncoding.cs.
References BGC.Audio.LinearInterpolation.Resample().
Referenced by BGC.Audio.Spatial.GetFilter(), BGC.Tests.SynthesisTests.TestAllPassFilterSpeech(), BGC.Tests.SynthesisTests.TestFMFilterVoice(), BGC.Tests.TestOverlapAdd.TestNewConvolution(), and BGC.Tests.TestOverlapAdd.TestNewSpatialization().
|
inlinestatic |
Loads a WAV file from the filepath as a float array, returns success.
Definition at line 97 of file WaveEncoding.cs.
References BGC.Audio.LinearInterpolation.Resample().
Referenced by BGC.Tests.WAVEncodingTests.TestDualChannelWave(), and BGC.Tests.WAVEncodingTests.TestSingleChannelWave().
|
inlinestatic |
Loads a WAV file from the filepath as a PCM short array, returns success.
Definition at line 134 of file WaveEncoding.cs.
References BGC.Audio.LinearInterpolation.Resample().
|
inlinestatic |
Loads a Stereo WAV file from the filepath as two float arrays, returns success.
Definition at line 113 of file WaveEncoding.cs.
References BGC.Audio.LinearInterpolation.Resample().
|
inlinestaticprivate |
Internal method to load a WAV file an parse the data
Definition at line 218 of file WaveEncoding.cs.
|
inlinestaticprivate |
|
inlinestaticprivate |
Read in DATA chunk. Returns success.
Definition at line 553 of file WaveEncoding.cs.
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestatic |
Save the samples passed in as a WAVE file with the specified filepath. Returns success.
Definition at line 166 of file WaveEncoding.cs.
Referenced by BGC.Tests.TestOverlapAdd.TestCarlileShuffler(), BGC.Tests.WAVEncodingTests.TestDualChannelWave(), BGC.Tests.TestOverlapAdd.TestPhaseVocoding(), and BGC.Tests.WAVEncodingTests.TestSingleChannelWave().
|
inlinestatic |
Save the samples passed in as a WAVE file with the specified filepath. Returns success.
Definition at line 183 of file WaveEncoding.cs.
|
inlinestatic |
Save the samples passed in as a WAVE file with the specified filepath. Returns success.
Definition at line 200 of file WaveEncoding.cs.
|
inlinestatic |
Save the samples passed in as a WAVE file with the specified filepath. Returns success.
Definition at line 150 of file WaveEncoding.cs.
References BGC.Audio.IBGCStream.Channels.
Referenced by BGC.Tests.SynthesisTests.FMTestBell(), BGC.Tests.SynthesisTests.FMTestBrass(), BGC.Tests.SynthesisTests.FMTestDrum(), BGC.Tests.SynthesisTests.FMTestOvertones(), BGC.Tests.SynthesisTests.FMTestPiano(), BGC.Tests.SynthesisTests.FMTestTrianglePiano(), BGC.Tests.SynthesisTests.SmallAnalyticFMTest(), BGC.Tests.SynthesisTests.SmallSineFMTest(), BGC.Tests.SynthesisTests.SynthTestSnare(), BGC.Tests.SynthesisTests.TestBiQuadFilters(), BGC.Tests.SynthesisTests.TestCarrierModifiedFakeVoices(), BGC.Tests.MidiEncodingTests.TestContinuousFilter(), BGC.Tests.SynthesisTests.TestFakeVoice(), BGC.Tests.SynthesisTests.TestFDComposer(), BGC.Tests.SynthesisTests.TestFDComposerPure(), BGC.Tests.MidiEncodingTests.TestFlute(), BGC.Tests.SynthesisTests.TestFrequencyShifter(), BGC.Tests.SynthesisTests.TestFunFakeVoice(), BGC.Tests.MidiEncodingTests.TestGuitar(), BGC.Tests.MidiEncodingTests.TestHiHat(), BGC.Tests.TestOverlapAdd.TestNewConvolution(), BGC.Tests.TestOverlapAdd.TestNewSpatialization(), BGC.Tests.MidiEncodingTests.TestOrgan(), BGC.Tests.SynthesisTests.TestPhaseReEncoder(), BGC.Tests.MidiEncodingTests.TestPulses(), BGC.Tests.MidiEncodingTests.TestRenderMidi(), BGC.Tests.MidiEncodingTests.TestRenderToccataMidi(), BGC.Tests.SynthesisTests.TestSawtoothWave(), BGC.Tests.SynthesisTests.TestSineWave(), BGC.Tests.MidiEncodingTests.TestSnare(), BGC.Tests.SynthesisTests.TestSquareWave(), BGC.Tests.SynthesisTests.TestSTM(), BGC.Tests.SynthesisTests.TestTriangleWave(), BGC.Tests.SynthesisTests.TryAllPassFilter(), BGC.Tests.SynthesisTests.TryFMFilter(), and BGC.Tests.WAVEncodingTests.UpScalingTest().
|
inlinestaticprivate |
|
inlinestaticprivate |
Definition at line 936 of file WaveEncoding.cs.
|
inlinestaticprivate |
Definition at line 990 of file WaveEncoding.cs.
|
inlinestaticprivate |
Definition at line 1003 of file WaveEncoding.cs.
|
inlinestaticprivate |
Definition at line 957 of file WaveEncoding.cs.
References BGC.Audio.IBGCStream.Read(), BGC.Audio.IBGCStream.Reset(), and BGC.Audio.IBGCStream.TotalSamples.
|
inlinestaticprivate |
Save the samples passed in as a WAVE file with the specified filepath. Returns success.
Definition at line 906 of file WaveEncoding.cs.
|
private |
Definition at line 27 of file WaveEncoding.cs.
|
private |
Definition at line 26 of file WaveEncoding.cs.