AudioFile-master

所属分类:其他
开发工具:C/C++
文件大小:16786KB
下载次数:0
上传日期:2021-02-02 17:40:48
上 传 者sd_information
说明:  在c语言的平台上编写语言去噪代码,通过电脑端输入命令可以实现对语言信号的去噪
(The language denoising code is written on the C language platform, and the language signal denoising can be realized by inputting commands on the computer side)

文件列表:
AudioFile.cpp (31297, 2018-10-28)
AudioFile.h (7133, 2018-10-28)
LICENSE (35141, 2018-10-28)
tests (0, 2018-10-28)
tests\AudioFileTests.xcodeproj (0, 2018-10-28)
tests\AudioFileTests.xcodeproj\project.pbxproj (10624, 2018-10-28)
tests\AudioFileTests.xcodeproj\project.xcworkspace (0, 2018-10-28)
tests\AudioFileTests.xcodeproj\project.xcworkspace\contents.xcworkspacedata (159, 2018-10-28)
tests\AudioFileTests.xcodeproj\project.xcworkspace\xcshareddata (0, 2018-10-28)
tests\AudioFileTests.xcodeproj\project.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (238, 2018-10-28)
tests\AudioFileTests (0, 2018-10-28)
tests\AudioFileTests\AiffLoadingTests.cpp (6317, 2018-10-28)
tests\AudioFileTests\FileWritingTests.cpp (3017, 2018-10-28)
tests\AudioFileTests\WavLoadingTests.cpp (8970, 2018-10-28)
tests\AudioFileTests\main.cpp (105, 2018-10-28)
tests\AudioFileTests\makeHeaders.py (2539, 2018-10-28)
tests\AudioFileTests\test-audio (0, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_16bit_44100.aif (1411770, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_16bit_48000.aif (1536570, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_24bit_44100.aif (2117370, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_24bit_48000.aif (2304570, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_8bit_44100.aif (706170, 2018-10-28)
tests\AudioFileTests\test-audio\aiff_stereo_8bit_48000.aif (768570, 2018-10-28)
tests\AudioFileTests\test-audio\wav_mono_16bit_44100.wav (705644, 2018-10-28)
tests\AudioFileTests\test-audio\wav_mono_16bit_48000.wav (768044, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_16bit_44100.wav (1411966, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_16bit_48000.wav (1536766, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_24bit_44100.wav (2117566, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_24bit_48000.wav (2304766, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_8bit_44100.wav (706366, 2018-10-28)
tests\AudioFileTests\test-audio\wav_stereo_8bit_48000.wav (768766, 2018-10-28)
tests\AudioFileTests\test-headers (0, 2018-10-28)
tests\AudioFileTests\test-headers\aiff_stereo_16bit_44100.h (17343, 2018-10-28)
tests\AudioFileTests\test-headers\aiff_stereo_16bit_48000.h (17099, 2018-10-28)
tests\AudioFileTests\test-headers\aiff_stereo_24bit_44100.h (17318, 2018-10-28)
tests\AudioFileTests\test-headers\aiff_stereo_24bit_48000.h (16982, 2018-10-28)
tests\AudioFileTests\test-headers\aiff_stereo_8bit_44100.h (10651, 2018-10-28)
... ...

# AudioFile ![Version](https://img.shields.io/badge/version-1.0.3-green.svg?style=flat-square) ![License](https://img.shields.io/badge/license-GPL-blue.svg?style=flat-square) ![Language](https://img.shields.io/badge/language-C++-yellow.svg?style=flat-square) A simple C++ library for reading and writing audio files. Current supported formats: * WAV * AIFF Author ------ AudioFile is written and maintained by Adam Stark. [http://www.adamstark.co.uk](http://www.adamstark.co.uk) Usage ----- ### Create an AudioFile object: #include "AudioFile.h" AudioFile audioFile; ### Load an audio file: audioFile.load ("/path/to/my/audiofile.wav"); ### Get some information about the loaded audio: int sampleRate = audioFile.getSampleRate(); int bitDepth = audioFile.getBitDepth(); int numSamples = audioFile.getNumSamplesPerChannel(); double lengthInSeconds = audioFile.getLengthInSeconds(); int numChannels = audioFile.getNumChannels(); bool isMono = audioFile.isMono(); bool isStereo = audioFile.isStereo(); // or, just use this quick shortcut to print a summary to the console audioFile.printSummary(); ### Access the samples directly: int channel = 0; int numSamples = audioFile.getNumSamplesPerChannel(); for (int i = 0; i < numSamples; i++) { double currentSample = audioFile.samples[channel][i]; } ### Replace the AudioFile audio buffer with another // 1. Create an AudioBuffer // (BTW, AudioBuffer is just a vector of vectors) AudioFile::AudioBuffer buffer; // 2. Set to (e.g.) two channels buffer.resize (2); // 3. Set number of samples per channel buffer[0].resize (100000); buffer[1].resize (100000); // 4. do something here to fill the buffer with samples, e.g. #include // somewhere earler (for M_PI and sinf()) // then... int numChannels = 2; int numSamplesPerChannel = 100000; float sampleRate = 44100.f; float frequency = 440.f; for (int i = 0; i < numSamplesPerChannel; i++) { float sample = sinf (2. * M_PI * ((float) i / sampleRate) * frequency) ; for (int channel = 0; channel < numChannels; channel++) buffer[channel][i] = sample * 0.5; } // 5. Put into the AudioFile object bool ok = audioFile.setAudioBuffer (buffer); ### Resize the audio buffer // Set both the number of channels and number of samples per channel audioFile.setAudioBufferSize (numChannels, numSamples); // Set the number of samples per channel audioFile.setNumSamplesPerChannel (numSamples); // Set the number of channels audioFile.setNumChannels (int numChannels); ### Set bit depth and sample rate audioFile.setBitDepth (24); audioFile.setSampleRate (44100); ### Save the audio file to disk // Wave file (implicit) audioFile.save ("path/to/desired/audioFile.wav"); // Wave file (explicit) audioFile.save ("path/to/desired/audioFile.wav", AudioFileFormat::Wave); // Aiff file audioFile.save ("path/to/desired/audioFile.aif", AudioFileFormat::Aiff); A Note On Types ----------------- AudioFile is a template class and so it can be instantiated using floating point precision: AudioFile audioFile; ...or double precision: AudioFile audioFile; This simply reflects the data type you would like to use to store the underlying audio samples. You can still read or write 8, 16 or 24-bit audio files, regardless of the type that you use (unless your system uses a precision for floats less than your desired bit depth). Versions ------- ##### 1.0.3 - 28th October 2018 - Bug fixes - Documentation updates ##### 1.0.2 - 6th June 2017 - Bug fixes License ------- Copyright (c) 2017 Adam Stark This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .

近期下载者

相关文件


收藏者