2017-12-05 7 views
0

클라우드 기반 음성 엔진에서 mp3 오디오 데이터를 받고 16khz 샘플 속도로 pcm 데이터 (wav 형식)로 변환하는 작은 응용 프로그램을 C로 작성했습니다. mp3 데이터를 디코딩하기 위해 libmad를 사용하고 있지만 24khz에서 16khz로 다운 샘플링하는 옵션을 찾을 수 없습니다. libmad를 사용하여이 작업을 수행 할 수 있습니까? 아니면이를 수행하기 위해 별도의 별도 라이브러리가 필요합니까? 이에 관련된 모든 정보가 도움이 될 것입니다. 감사가,C에서 libmad 라이브러리를 사용하여 24khz mp3 오디오를 16khz wav로 변환 하시겠습니까?

~ Reev

답변

0

lamehelper 라이브러리이 사용할 수 있습니다 ... 사용이 웹 사이트는 당신을 도울 : 이 https://www.codeproject.com/Articles/656543/The-LAME-wrapper-An-audio-converter

귀하의 코드가 다소 this-

#include "lameHelper.h" 
struct settings_t //make a struct to store settings 
{ 
    char* title; 
    char* artist; 
    char* album; 
    char* comment; 
    char* year; 
    char* track; 
    char* genre; 
    char* albumart; 

    encode_channel_e channels; 
    bitrate_e abr_bitrate; 
    bitrate_e cbr_bitrate; 
    int quality; 
    encode_mode_e enc_mode; 
    samplerate_e resample_frequency; // This is what you are going to need 
    samplerate_e in_samplerate; 

    //The constructor: used to set default values 
    settings_t(); 
}; 

int main() 
{ 
    settings_t settings; 
    settings.enc_mode = EM_ABR; 
    settings.abr_bitrate = BR_128kbps;//If you are going to use ABR encode mode @ 128kbps 
    settings.album = "The Album";//Setting the album (id3 tag) 
    settings.albumart = "c:/.../art.jpg";//Setting the albumart 
    settings.track = "01";//Setting the track 

    //..and various other settings 

    lameHelper lhHandle; 
    lhHandle.encode("c:/.../song.mp3", "c:/.../song.wav", settings); 

    return 0; 
} 
과 같아야합니다
관련 문제