Create an mp3 file from scratch C#

懵懂的女人 提交于 2019-12-10 18:21:17

问题


As part of some experimentation, I thought of something, how can I create a .mp3 file from scratch in C#, that actually sounds like something, e.g, create an mp3 file that plays the note: C#, or B flat?

How can I achieve this, and it must be an mp3 file, not a wav, or anything else.


回答1:


So I'm not going to be able to give you exact code, but I can give a starting point.

So basically the steps would be

  1. Find the frequency of the wave you want. Look at this. C# (nice choice by the way!) is 17.32HZ
  2. Convert the frequency to LPCM, which is just a series of amplitude values.
  3. Convert the LPCM encoded array to an MP3 file. This is probably the hardest, but LPCM forms that basis of the WAV format and there are converters to convert that to MP3. Have a look at the NAudio baalazamon found. It supports PCM.



回答2:


I would try using NAudio it's quite powerful. The main purpose was to manipulate audio files but it's worth to try.



来源:https://stackoverflow.com/questions/8155994/create-an-mp3-file-from-scratch-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!