Streaming audio using Computronics Tape Drives

Started by justy, Aug 14, 2018, 07:10 PM

Previous topic - Next topic

justy

I decided to stream* audio into Minecraft using Computronics Tape Drives.

*It's streaming but not exactly real time, it has to have a significant delay to make it not cut out too bad. This is due to limitations of Computronic's audio netcode.


Frekvens1

Mind if I ask how you achieved that sound purity?

I've been using LionRay, but the results are always really bad. It sounds like an old school AM radio during a thunderstorm. I've tried a few different WAV files, even mixed them in Audacity with no luck.

Are your files unsigned or signed?

justy

Quote from: Frekvens1 on Oct 17, 2018, 01:11 AMMind if I ask how you achieved that sound purity?

I've been using LionRay, but the results are always really bad. It sounds like an old school AM radio during a thunderstorm. I've tried a few different WAV files, even mixed them in Audacity with no luck.

Are your files unsigned or signed?
I'm sending 8-bit signed ints. It's mostly using 1lann's Go implementation which you can find here.

Frekvens1

Thanks for the response!

I've tried to compile it on Windows, but it wouldn't accept my pulseaudio.dll. So I tried doing it in Ubuntu. Had more luck there until ALSA lib started acting up on my audio card.

I've not used Golang before, but after messing some with his cmd code I managed to get some output. Sadly, it's 0 bytes, so no luck there.

Would have been easier if there was a binary file for it :P

However.

Since you linked me to his library and not to his cmd code, does that imply you've made your own program using his library to achieve the end goal, or is it possible for me to recreate it from the code already shown in his Github?

Any help would be highly appriciated. I've already started pulling my hair (haha).

justy

Quote from: Frekvens1 on Oct 17, 2018, 06:08 PMThanks for the response!

I've tried to compile it on Windows, but it wouldn't accept my pulseaudio.dll. So I tried doing it in Ubuntu. Had more luck there until ALSA lib started acting up on my audio card.

I've not used Golang before, but after messing some with his cmd code I managed to get some output. Sadly, it's 0 bytes, so no luck there.

Would have been easier if there was a binary file for it :P

However.

Since you linked me to his library and not to his cmd code, does that imply you've made your own program using his library to achieve the end goal, or is it possible for me to recreate it from the code already shown in his Github?

Any help would be highly appriciated. I've already started pulling my hair (haha).
That would be right, I wrote my own program to implement it. However his command line implementation should work.
It should work on Windows so long as you comment out any references to drivers/paudio since that just plays the audio back to you.

Frekvens1

Quote from: Justyn on Oct 17, 2018, 10:11 PM
Quote from: Frekvens1 on Oct 17, 2018, 06:08 PMThanks for the response!

I've tried to compile it on Windows, but it wouldn't accept my pulseaudio.dll. So I tried doing it in Ubuntu. Had more luck there until ALSA lib started acting up on my audio card.

I've not used Golang before, but after messing some with his cmd code I managed to get some output. Sadly, it's 0 bytes, so no luck there.

Would have been easier if there was a binary file for it :P

However.

Since you linked me to his library and not to his cmd code, does that imply you've made your own program using his library to achieve the end goal, or is it possible for me to recreate it from the code already shown in his Github?

Any help would be highly appriciated. I've already started pulling my hair (haha).
That would be right, I wrote my own program to implement it. However his command line implementation should work.
It should work on Windows so long as you comment out any references to drivers/paudio since that just plays the audio back to you.

Thanks for the clarification!

Frekvens1

Quote from: Justyn on Oct 17, 2018, 05:06 AM
Quote from: Frekvens1 on Oct 17, 2018, 01:11 AMMind if I ask how you achieved that sound purity?

I've been using LionRay, but the results are always really bad. It sounds like an old school AM radio during a thunderstorm. I've tried a few different WAV files, even mixed them in Audacity with no luck.

Are your files unsigned or signed?
I'm sending 8-bit signed ints. It's mostly using 1lann's Go implementation which you can find here.

I managed to successfully compile the Go code and convert a WAV file. I've tried countless WAV formats, both signed and unsigned 8-bit PCM. The sound quality have improved, but the high pitched noise screeching is still a big deal. I've compared both the LionRay and the Go code, and there isn't much difference I think.

I think more of the magic actually lies in the WAV file itself.
Do you have any checkpoints to find good or bad WAV files?

Things like bitrate, unsigned / signed, RAW (Header-less) / WAV (Microsoft) / WAV (NIST Sphere)

I might be using the 'wrong' codecs, and the result is much background noise.

If I am struggling this much then I don't think I am the only one :P

Atleast, thanks for all the help provided on this topic. Even learnt a new language today!

Frekvens1

#7
Quote from: Frekvens1 on Oct 17, 2018, 11:43 PM
Quote from: Justyn on Oct 17, 2018, 05:06 AM
Quote from: Frekvens1 on Oct 17, 2018, 01:11 AMMind if I ask how you achieved that sound purity?

I've been using LionRay, but the results are always really bad. It sounds like an old school AM radio during a thunderstorm. I've tried a few different WAV files, even mixed them in Audacity with no luck.

Are your files unsigned or signed?
I'm sending 8-bit signed ints. It's mostly using 1lann's Go implementation which you can find here.

I managed to successfully compile the Go code and convert a WAV file. I've tried countless WAV formats, both signed and unsigned 8-bit PCM. The sound quality have improved, but the high pitched noise screeching is still a big deal. I've compared both the LionRay and the Go code, and there isn't much difference I think.

I think more of the magic actually lies in the WAV file itself.
Do you have any checkpoints to find good or bad WAV files?

Things like bitrate, unsigned / signed, RAW (Header-less) / WAV (Microsoft) / WAV (NIST Sphere)

I might be using the 'wrong' codecs, and the result is much background noise.

If I am struggling this much then I don't think I am the only one :P

Atleast, thanks for all the help provided on this topic. Even learnt a new language today!

Alright, after talking with Justyn on Discord about all possibilities, he found out where I went wrong.

Here is some sample code for a WORKING downloader:
tape = peripheral.find("tape_drive")

url = "http://DirectLinkToFile.dfpwm")
local response = http.get(url, nil, true) -- THIS IS IMPORTANT

tape.seek(-tape.getPosition()) --Rewind to start
tape.write(response.readAll())
response.close()

tape.seek(-tape.getPosition())

The issue was rather simple. When the bytes was downloaded from the server, I didn't specify it to be bytes. Thats where everything went wrong. ComputerCraft expected letters instead.

How to easily create a good file:
1. Convert ANY type of music to WAV (Sound quality might get decreased depending on format used)
2. Use LionRay Wav Converter for DFPWM file. (Can be downloaded as a binary and have a user friendly UI)
3. Upload file to file provider (Github, Dropbox, Google Drive)
4. Use the code above where the URL is a direct link.
5. Enjoy!