0

As I have not worked much with NAudio, I am not quite sure how to solve this problem:

  1. Is it possible to take a byte array and translate it into audio data and then output it through the default output interface (audio jack, speaker etc.)?
  2. Is it possible to store incoming audio signals as byte array/byte stream?

My final goal is to create some kind of data transmission using a audio cable.
The following crude graphic could somehow visualize you, what I want to create:

enter image description here

Khamill
  • 51
  • 7
unknown6656
  • 2,765
  • 2
  • 36
  • 52
  • The answer to both of your questions is yes - that's how digital audio works. – cbr Jun 19 '15 at 11:15
  • @cubrr: I know, that I am maybe asking for too much, but do you maybe have a tutorial link? I am either too stupid to find one or I have not been entering the correct search terms into google :/ – unknown6656 Jun 19 '15 at 11:17
  • Sorry, I don't. This is the first time I've heard of NAudio. – cbr Jun 19 '15 at 11:18
  • @cubrr: Ok, no problem. Thank you very much, Sir :) – unknown6656 Jun 19 '15 at 11:19
  • 2
    Found what you're looking for: [How can I play byte array of audio raw data using NAudio?](http://stackoverflow.com/questions/28792548/how-can-i-play-byte-array-of-audio-raw-data-using-naudio). Combine this with `Encoding.UTF8.GetBytes(string)` or whichever encoding. – cbr Jun 19 '15 at 12:03
  • @cubrr: Thank you very much, Sir. I have also found a way to record a byte array, so my problems are (at least in theory) solved. I will code my application this evening and contact you in case I should run into some problems. – unknown6656 Jun 19 '15 at 17:35
  • 1
    You're going to have to come up with a way of encoding the data because you have no way to synchronize the analog read cycle. Imagine that your input reads data between the output samples, you'll get something that is half way between. Then there's the issue with amplitude variance between send and receive, etc. ad nauseum. Lots of fun, but I guarantee it'll be a little frustrating. – Corey Jul 06 '15 at 07:08
  • @Corey: Im working on this small project with a friend and it is fun, but --as you said-- also a bit frustrating. We are are currently working on some kind of 'protocol' and encoding to reduce data loss.... – unknown6656 Jul 06 '15 at 09:21
  • 1
    @Unknown6656 Have a look at Trellis Coding and other techniques used in the good old modem days. You might want to also consider super-sampling to ensure that you're getting as close to your original waveform as you can, plus some kind of markers to frame your data. The average sound chip these days can sample at 96kHz or higher, so take advantage of the extra samples to get close to your output. And don't try to pack too many bits per sample, spread the data out a bit. – Corey Jul 06 '15 at 11:33

0 Answers0