1

Im new to NAudio but the goal of my project is to provide the user with the ability for the user to listen to an MP3 and then select a sample or a "chunk" of that song as a sample which could be saved to disk. These samples would be able to replayed at the same time (i.e. not merged but played at the same time).

Could someone please let me know what the overall strategy required to achieve this (....not necessarily the specifics...almost like pseduo code....).

For example would the samples / chunks of a song need to be saved as a WAV file. And these samples could be played together in the WAV format, etc.

I have seen a few small examples of a few implementations of some of the ideas Ive mentioned above but dont have a good sense of the big picture just yet.

Thanks in advance, Andrew

4

1 回答 1

0

除非您保留它们以备将来使用,否则这些块不需要保存为 WAV 文件。您可以将 PCM 音频(Mp3FileReader自动转换为 PCM)存储在字节数组中并用于RawSourceWaveStream播放它们。

至于混合它们,我建议使用MixingSampleProvider. 这确实意味着您需要将您的浮点数转换RawSourceWaveStream为 IEEE 浮点数,但您可以使用它Pcm16BitToSampleProvider来执行此操作。这将使您可以轻松地对正在混合的样本调整音量(并执行其他 DSP)。MixingSampleProvider还会自动删除已完成的输入,因此您可以在想要触发声音时添加新输入。

于 2012-12-03T06:59:23.810 回答