'MCI'에 해당되는 글 3건

  1. 2009.03.26 waveInOpen() waveOutOpen()
  2. 2009.03.19 MCI Reference 2
  3. 2009.03.16 소음제거 프로그램
MCI 함수들을 찾다 보니 두개의 함수가 눈에 띄었다.
waveInOpen()
waveOutOpen()

MCI 함수중에 이녀석이 눈에 띈 이유는, wave를 받아오고 보내주는 장치를 열수 있을 가능성이 있어 보여서였다.
그래서 이 함수들로 검색을 해보니 조금 나오긴한다..

"소프트웨어 오디오 코덱 low-level document" 라는
유용한 문서가 발견되었는데, 출처가 불분명해서 출처를 추적해보았는데 이래저래 원본이 보이지 않는다.
아무튼 그나마 근접해 보이는 것은

볼랜드 포럼 글에서 발견한
자세한 것은 아래 "소프트웨어 오디오 코덱 low-level document"를 참조하세요.
  http://netbeta.sogang.ac.kr/%7Esuchduck/audio_low.html 라는 글인데.. 이 링크는 깨져있다..

결론은 아쉽게도 발견 실패




대충 훑어봐서 자세한 내용은 다시 읽어 봐야겠지만,
아무래도 166Mhz 시절에 쓴글이라 지금에는 어느정도 커버할 수 있을지는 몰라도,
네트워크를 통한 화상채팅에 대한 내용으로, 네트워크 전송의 부하로 인해서 어느정도 크기로 한번에 보낸다는 의미이다.
그리고 윈도우 메시지 기반으로 작동하기에, 실시간으로 하기에는 힘들지 않을까라는 생각도 든다.

'모종의 음모 > noise cancelling' 카테고리의 다른 글

WAVEFORMATEX structure  (0) 2009.04.01
음속  (0) 2009.03.30
sampling rate 관련 의문  (2) 2009.03.26
wav format 관련 문서  (0) 2009.03.26
openGL audio spectrum visualization - sndpeek  (0) 2009.03.19
Posted by 구차니
Windows Multimedia
MCI Reference

This section lists the MCI functions, structures, messages, macros, commands, and command strings, which are documented under Multimedia Reference. These elements are grouped as follows.


Notifications

MM_MCINOTIFY
MM_MCISIGNAL


Retrieving Information

mciGetCreatorTask
mciGetDeviceID
mciGetDeviceIDFromElementID
mciGetErrorString


Sending Commands

mciExecute
mciSendCommand

mciSendString


Time Formats

MCI_HMS_HOUR
MCI_HMS_MINUTE
MCI_HMS_SECOND
MCI_MAKE_HMS
MCI_MAKE_MSF
MCI_MAKE_TMSF
MCI_MSF_FRAME
MCI_MSF_MINUTE
MCI_MSF_SECOND
MCI_TMSF_FRAME
MCI_TMSF_MINUTE
MCI_TMSF_SECOND
MCI_TMSF_TRACK


Yield Procedures

mciGetYieldProc
mciSetYieldProc


Configuring a Device

break
configure
escape
index
MCI_BREAK
MCI_BREAK_PARMS
MCI_CONFIGURE
MCI_DGV_SET_PARMS
MCI_DGV_SETAUDIO_PARMS
MCI_DGV_SETVIDEO_PARMS
MCI_ESCAPE
MCI_INDEX
MCI_SEQ_SET_PARMS
MCI_SET
MCI_SET_PARMS
MCI_SETAUDIO
MCI_SETTIMECODE
MCI_SETTUNER
MCI_SETVIDEO
MCI_SPIN
MCI_VCR_SET_PARMS
MCI_VCR_SETAUDIO_PARMS
MCI_VCR_SETTUNER_PARMS
MCI_VCR_SETVIDEO_PARMS
MCI_VD_ESCAPE_PARMS
MCI_WAVE_SET_PARMS
set
setaudio
settimecode
settuner
setvideo
spin


Controlling Playback

freeze
load
MCI_DGV_FREEZE_PARMS
MCI_DGV_LOAD_PARMS
MCI_DGV_PAUSE_PARMS
MCI_DGV_PLAY_PARMS
MCI_DGV_RESUME_PARMS
MCI_DGV_STOP_PARMS
MCI_FREEZE
MCI_LOAD
MCI_LOAD_PARMS
MCI_OVLY_LOAD_PARMS
MCI_PAUSE
MCI_PLAY
MCI_PLAY_PARMS
MCI_RESUME
MCI_STOP
MCI_UNFREEZE
MCI_VCR_PLAY_PARMS
MCI_VD_PLAY_PARMS
pause
play
resume
stop
unfreeze


Controlling the Position

cue
mark
MCI_CUE
MCI_DGV_CUE_PARMS
MCI_DGV_SIGNAL_PARMS
MCI_DGV_STEP_PARMS
MCI_MARK
MCI_SEEK
MCI_SEEK_PARMS
MCI_SIGNAL
MCI_STEP
MCI_VCR_CUE_PARMS
MCI_VCR_SEEK_PARMS
MCI_VCR_STEP_PARMS
MCI_VD_STEP_PARMS
seek
signal
step


Editing

copy
cut
delete
MCI_COPY
MCI_CUT
MCI_DELETE
MCI_DGV_COPY_PARMS
MCI_DGV_CUT_PARMS
MCI_DGV_DELETE_PARMS
MCI_DGV_PASTE_PARMS
MCI_PASTE
MCI_UNDO
MCI_WAVE_DELETE_PARMS
paste
undo


Miscellaneous

MCI_GENERIC_PARMS


Opening and Closing

close
MCI_CLOSE
MCI_DGV_OPEN_PARMS
MCI_OPEN
MCI_OPEN_PARMS
MCI_OVLY_OPEN_PARMS
MCI_WAVE_OPEN_PARMS
open


Realizing a Palette

MCI_REALIZE
realize


Repainting a Frame

MCI_DGV_UPDATE_PARMS
MCI_UPDATE
update


Retrieving Information

capability
info
list
MCI_DGV_INFO_PARMS
MCI_DGV_LIST_PARMS
MCI_DGV_STATUS_PARMS
MCI_GETDEVCAPS
MCI_GETDEVCAPS_PARMS
MCI_INFO
MCI_INFO_PARMS
MCI_LIST
MCI_STATUS
MCI_STATUS_PARMS
MCI_SYSINFO
MCI_SYSINFO_PARMS
MCI_VCR_LIST_PARMS
MCI_VCR_STATUS_PARMS
status
sysinfo


Saving

MCI_DGV_RECORD_PARMS
MCI_DGV_SAVE_PARMS
MCI_OVLY_SAVE_PARMS
MCI_RECORD
MCI_RECORD_PARMS
MCI_SAVE
MCI_SAVE_PARMS
MCI_VCR_RECORD_PARMS
record
save


Video Control

capture
MCI_CAPTURE
MCI_DGV_MONITOR_PARMS
MCI_DGV_QUALITY_PARMS
MCI_DGV_RESERVE_PARMS
MCI_DGV_RESTORE_PARMS
MCI_MONITOR
MCI_QUALITY
MCI_RESERVE
MCI_RESTORE
monitor
quality
reserve
restore


Window or Display Rectangles

MCI_DGV_PUT_PARMS
MCI_DGV_RECT_PARMS
MCI_DGV_WINDOW_PARMS
MCI_OVLY_RECT_PARMS
MCI_OVLY_WINDOW_PARMS
MCI_PUT
MCI_WHERE
MCI_WINDOW
put
where
window



[링크 : http://msdn.microsoft.com/en-us/library/ms710984(VS.85).aspx]

'모종의 음모 > noise cancelling' 카테고리의 다른 글

waveInOpen() waveOutOpen()  (0) 2009.03.26
sampling rate 관련 의문  (2) 2009.03.26
wav format 관련 문서  (0) 2009.03.26
openGL audio spectrum visualization - sndpeek  (0) 2009.03.19
소음제거 프로그램  (0) 2009.03.16
Posted by 구차니
문득 얼마전 Sony P 시리즈였나?
기본적으로 Noise Cancelling을 지원한다는 이야기를 들어서
프로그램을 찾아 볼려니 보이지 않아서 한번 만들어 볼까는 호기심이 발동했다
(써글 호기심 ㄱ-)


조금 검색해보니, 구현이야 간단하지만 거리나 얼마나 큰 범위를 noise cancelling 할건지가 문제고
sound card에서 받아오는 time lag로 인해서 은근히 어렵다고 한다.


일단 winapi에서 제공하는 녀석들로 찾아 보니

MCI (Media Contol Interface) 라는게 있다.
SAPI (Speech API)도 있긴한데 TTS나 음성인식쪽이라 일단은 패스~


일단 대충 꼬라지를 보니..

step 1. 윈도우 레코드 프로그램 흉내내기 (파일로 저장)
step 2. 메모리 상에서 위상 뒤집기
step 3. 뒤집은 위상을 스피커로 출력하기

이런 순서가 될 듯 하다.

DWORD CMyRecordDlg::RecordWAVEFile(DWORD dwMilliSeconds)
{
    UINT wDeviceID;
    DWORD dwReturn;
    MCI_OPEN_PARMS mciOpenParms;
    MCI_RECORD_PARMS mciRecordParms;
    MCI_SAVE_PARMS mciSaveParms;
    MCI_PLAY_PARMS mciPlayParms;

   // Open a waveform-audio device with a new file for recording.

    mciOpenParms.lpstrDeviceType = "waveaudio";
    mciOpenParms.lpstrElementName = "";
    if (dwReturn = mciSendCommand(0, MCI_OPEN,
        MCI_OPEN_ELEMENT | MCI_OPEN_TYPE,
        (DWORD)(LPVOID) &mciOpenParms))
    {
        // Failed to open device; don't close it, just return error.
        return (dwReturn);
    }

    // The device opened successfully; get the device ID.
    wDeviceID = mciOpenParms.wDeviceID;
    // Begin recording and record for the specified number of
    // milliseconds. Wait for recording to complete before continuing.
    // Assume the default time format for the waveform-audio device
    // (milliseconds).

    mciRecordParms.dwTo = dwMilliSeconds;
    if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD,
        MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms))
    {
        mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
        return (dwReturn);
    }

    // Play the recording and query user to save the file.
    mciPlayParms.dwFrom = 0L;
    if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY,
        MCI_FROM | MCI_WAIT, (DWORD)(LPVOID) &mciPlayParms))
    {
        mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
        return (dwReturn);
    }

    if (MessageBox("Do you want to save this recording?",
        "", MB_YESNO) == IDNO)
    {
        mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
        return (0L);
    }

    // Save the recording to a file named TEMPFILE.WAV. Wait for
    // the operation to complete before continuing.

    mciSaveParms.lpfilename = "tempfile.wav";
    if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE,
        MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &mciSaveParms))
    {
        mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
        return (dwReturn);
    }

    return (0L);
}

[참고 : http://www.codeproject.com/KB/audio-video/Voice_Recording.aspx]

 Offset  Size  Name             Description

The canonical WAVE format starts with the RIFF header:

0         4   ChunkID          Contains the letters "RIFF" in ASCII form
                               (0x52494646 big-endian form).
4         4   ChunkSize        36 + SubChunk2Size, or more precisely:
                               4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
                               This is the size of the rest of the chunk
                               following this number.  This is the size of the
                               entire file in bytes minus 8 bytes for the
                               two fields not included in this count:
                               ChunkID and ChunkSize.
8         4   Format           Contains the letters "WAVE"
                               (0x57415645 big-endian form).

The "WAVE" format consists of two subchunks: "fmt " and "data":
The "fmt " subchunk describes the sound data's format:

12        4   Subchunk1ID      Contains the letters "fmt "
                               (0x666d7420 big-endian form).
16        4   Subchunk1Size    16 for PCM.  This is the size of the
                               rest of the Subchunk which follows this number.
20        2   AudioFormat      PCM = 1 (i.e. Linear quantization)
                               Values other than 1 indicate some
                               form of compression.
22        2   NumChannels      Mono = 1, Stereo = 2, etc.
24        4   SampleRate       8000, 44100, etc.
28        4   ByteRate         == SampleRate * NumChannels * BitsPerSample/8
32        2   BlockAlign       == NumChannels * BitsPerSample/8
                               The number of bytes for one sample including
                               all channels. I wonder what happens when
                               this number isn't an integer?
34        2   BitsPerSample    8 bits = 8, 16 bits = 16, etc.
          2   ExtraParamSize   if PCM, then doesn't exist
          X   ExtraParams      space for extra parameters

The "data" subchunk contains the size of the data and the actual sound:

36        4   Subchunk2ID      Contains the letters "data"
                               (0x64617461 big-endian form).
40        4   Subchunk2Size    == NumSamples * NumChannels * BitsPerSample/8
                               This is the number of bytes in the data.
                               You can also think of this as the size
                               of the read of the subchunk following this
                               number.
44        *   Data             The actual sound data.

[참고 : http://ccrma.stanford.edu/courses/422/projects/WaveFormat/]

'모종의 음모 > noise cancelling' 카테고리의 다른 글

waveInOpen() waveOutOpen()  (0) 2009.03.26
sampling rate 관련 의문  (2) 2009.03.26
wav format 관련 문서  (0) 2009.03.26
openGL audio spectrum visualization - sndpeek  (0) 2009.03.19
MCI Reference  (2) 2009.03.19
Posted by 구차니