Bitcoin Forum
June 22, 2024, 03:09:01 AM *
News: Voting for pizza day contest
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Electrum / Re: Electrum 2.0 release on: March 08, 2015, 09:35:53 AM
P.S.
I would be happy to help with any amodem issues.
Please use GitHub's issue tracker: https://github.com/romanz/amodem/issues
2  Bitcoin / Electrum / Re: Electrum 2.0 release on: March 08, 2015, 08:47:32 AM
Hello, thank you for your time in developing this tool. I saw the thread in which you presented this a while ago. Your reward was well deserved Wink

On to business: Altough it errors out on the console, amodem seems to be working directly inside electrum. I haven't had much time to fiddle with it, but it does broadcast the transaction audio. It still gives me an error on the console though.

Besides this, have you tried your tool with a Raspberry Pi? If so, can you recomend anything for audio input? Maybe a specific external/USB soundcard?

Thanks in advance Smiley

Thanks for the good words Smiley

Regarding the console errors - could you please attach the error log?

I haven't tried running the modem on a RPi, but I guess that it would work with any ALSA-compatible audio USB card.
Acutally, it was exactly how I was testing it before switching to PortAudio (for better cross-platform support).
You can still use ALSA utils instead of PortAudio shared library, by using the following commands:

$ amodem send -i data.tx | aplay -f S16_LE -c 1 -r 32000
$ arecord -f S16_LE -c 1 -r 32000 | amodem recv -o data.rx

Since the RPi has much slower CPU than the average PC, it may not succeed handling the audio in real-time, so you may use a temporary file to buffer it.
You should also start with the lower bitrates, as they require less processing power.
3  Bitcoin / Electrum / Re: Electrum 2.0 release on: March 08, 2015, 08:37:27 AM
Still no luck setting up amodem. Anyone tried it? What's the best frequency?

Hi unamis,

I recommend using the following commands to test and calibrate the modem:

At the sender side, run:
$ BITRATE=1 amodem-cli send -vv -c auto

At the receiver's side, run (after the sender is running):
$ BITRATE=1 amodem-cli recv -vv -c auto

The sender will play a 2kHz tone, at maximum amplitude.
The receiver will try to find the best gain, such that the received audio will have the maximal amplitude that won't saturate the microphone.
It uses binary search method to adjust the gain via PulseAudio command-line utility, and it will take ~15 seconds to find the correct value for your setup.
If everything is OK, you would get "good signal" message with the coherency measure very close to 1.

Please attach the log, if there is a problem.
4  Bitcoin / Electrum / Re: Electrum 2.0 release on: March 04, 2015, 07:50:47 AM
Hi unamis76,

I am the developer of amodem, and would be happy to help you with the installation.
Could you please run the following commands on your console (to make sure the package is installed correctly on your OS):


$ python -c "import platform; print(platform.platform())"
$ python -c "import amodem; print(amodem)"


Any tutorial to use amodem? It's says it isn't recognized on terminal after I install it...
5  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: October 16, 2014, 04:23:09 PM
BTW, I've took some time to improve the audio modem library a bit:

  • a few optimizations so decoding can run "in parallel", while the audio is being recorded.
  • unit test suite with good code coverage (integrated with https://travis-ci.org/romanz/amodem and https://coveralls.io/r/romanz/amodem)
  • better (and easier) command line interface for sending and receiving data.
  • make the library code to be PEP8 compatible.
  • add support for Python 3.
  • calibration process now checks all frequencies that are used for transmission.
  • improve equalization process, with better handling of signal distortions.
  • I am using a hexagonal constellation grid (instead of standard QAM), to improve SNR for existing bit rate -> thus decreasing error probablity

See https://github.com/romanz/amodem for details.
6  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: October 16, 2014, 04:16:17 PM
Hi etotheipi,

I've tested the quality of the "Smartphone -> PC" connection, by playing an WAV file (containing modulated audio at 48 kbps) from a Nexus 5, and recorded it from a PC microphone jack - using a standard 3.5" male-to-male cable. I've successfully demodulated a single 16kB file transmission, containing random binary data.

For the opposite direction, I need a special cable that allows me to connect to the microphone of the smartphone, so I've ordered the following cable, that seems to be fit for the job: http://www.aliexpress.com/snapshot/6288177801.html.
I will report my results when I get the cable Smiley

Regarding smartphone<->PC communication: it's indeed an interesting problem. I'll think on it...

Smartphone <--> Smartphone, too.  The nice thing about the audio solution is that there's no reason it wouldn't work, you just need the right cables.  And of course an Android version of the audio xfer Smiley

Regarding "Smartphone <-> Smartphone":
I think that it may be done easier by some kind of "QR-video" solution, since both of the smartphones should have a camera, and they are quite easy to operate (as compared to desktop screens and webcams). In addition, since we need to achieve ~6kB/s rate, we can use the larger versions of QR codes with quite low fps value. For example the largest version (#40 = 177x177) can contain 2,953 bytes = requiring 2 QR codes per second to achieve the required rate (see http://www.qrcode.com/en/about/version.html for details). The Android application itself will probably look very much like this one: http://stephendnicholas.com/archives/310 (which quite cool IMHO).

7  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: August 02, 2014, 06:40:55 PM
Thank you roman.z for contributing another soft modem to the world. They're pretty cool!

Thanks for the compliments!
It was indeed fun Smiley
8  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: August 02, 2014, 06:28:49 PM
I'm late to the party, but really like where this concept is heading to!

If it were me, I would implement this as RS232 serial comms, and then try to go about seeing if someone wanted to write a generic audio-to-serial device driver that emulated a serial port at the kernel level.  Then the separation of duties in the code is appropriate, and the audio overhead is totally optional.

Yes, I totally agree, a generic, modular solution would be sweet.
Both devices use a (virtual or physical) RS232 port, where users can decide what they put in between the two systems.

I would then not use an audio layer on top of that, but an optical:
- a green LED for sending data from online to offline, shining onto a phototransistor connected to the offline system
- a red LED for sending data from offline to online, shining onto a phototransistor connected to the online system

They flicker happily away, should be pretty fast too, and I immediately see when and how long they transmit data, and in what direction too!

Other users might prefer the audio link. Or a plain direct RS232 cable.

What do you guys think?

Ente

This sounds very interesting!

I think that given two sound cards with optical input/output (such as http://www.dx.com/p/external-5-1-channel-usb-2-0-sound-card-optical-audio-adapter-black-41289),
it may be possible to use the digital audio interface as a uni-directional data stream...

The single problem is the additional cost (if existing sound card has no such interfaces), and maybe potential security implication (if USB sound card is used).
9  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: August 02, 2014, 08:41:06 AM
You are right, but this would require simulatenous bi-directional connection between the online and the offline computers, requiring two audio cables.
Since I have got only one audio cable, I am calibrating the sender manually. Smiley
10  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: August 02, 2014, 05:30:28 AM
Hi all,

Audio modem library v1.0 is ready! Smiley
I've moved it to GitHub, under https://github.com/romanz/amodem.

The README file (https://github.com/romanz/amodem/blob/master/README.md) is now more detailed, and contains calibration and usage demos.
There are even screencasts for the demos:

The data from my test is at: https://www.dropbox.com/sh/2yai1xmntdqlwf1/AACvfzasKEHK0zVxdzI4jF7pa

A few more details about the version:
The modem is using OFDM over an audio cable with the following parameters:

    Sampling rate: 32 kHz
    BAUD rate: 1 kHz
    Symbol modulation: 64-QAM
    Carriers: (1,2,3,4,5,6,7,8) kHz

This way, modem achieves 6[bit/symbol]*8[symbol/baud]*1000[baud] = 48kpbs bitrate = 6.0 kB/s.
A simple framing with Reed-Solomon ECC is used, with (255,245) rate = ~4% overhead.
(it should take a bit less than 3 minutes for 1MB to be transmitted)

I would be happy if more people will try and test this library.
Questions, remarks and suggestions are welcome!
11  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 11, 2014, 07:08:53 PM
Hi W-M,

Thanks for the compliments!

Your comments are both correct:
- I will find a stereo cable and test it with my PC<->laptop setup.
- I will use now QAM-16, and maybe even QAM-64 if the SNR will be high enough.

Best regards,
  Roman.

Hello roman.z,etothepi and other people.

I am mostly a webdeveloper by trade, but I tinker a lot with audio as well (amongst other things, creating 100% code-generated song covers known as '/predfate2lq]Bytebeat'), and might aspire to become a full-fledged synthesizer developer or something of the likes in the future.



This truly is a very interesting idea. I would give it a shot myself, if it were not that roman.z was already doing such great work already; I don't want to make a competition about this and rather think that it's better to collaborate.

Some thoughts I stumbled upon while thinking about from your solution:
-Are you using mono or stereo audio cables right now? From the source cpde it seems to me you're not. Most computers have a built-in stereo input/output, and this would mean that you can effectively double the amount of carrier waves, and thus double the speed.
-You might want to look into QAM instead of using QPSK/8PSK, which basically adds amplitude-shift-keying on top of the phase-key shifting, greatly enhancing the amount of constellations (and thus the amount of data throughput)


Have a nice day,

~W-M
12  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 11, 2014, 07:02:36 PM
Awesome!  Those are very encouraging results.  I am busily working on the Armory 0.92 release, but after that I will have some time to see if I can reproduce your results locally.   If so, I think you deserve a bounty!    I encourage anyone else subscribed to this thread to collaborate with roman.z and see if you can get his solution working and verify that it works.  I pay out once I can use the solution to move a 2MB file between two laptops reliably, as long as the performance is somewhat close to what you just described.

Overachiever's goal:  can you find the right cables to move data back and forth between a smartphone or tablet?  How difficult would it be to demonstrate that you get sufficient performance?  I like the idea of taking a tx on your phone to the safe-deposit box, plugging in a 2-way cable between the phone and computer, and letting them do their thing.  Or two smartphones -- one online one offline.  Granted, android dev is a little out of scope for this bounty, but if we can at least propose a feasible path to getting there and expect that its performance will be acceptable, I think this solution will be 110% complete!

Thanks a lot Smiley
I will work to improve the APIs, the usability and the documentation of the tools.
May be I'll even prepare an "HOWTO" video, to demonstrate the usage of the modem.

Regarding smartphone<->PC communication: it's indeed an interesting problem. I'll think on it...
13  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 09, 2014, 05:54:53 AM
Good news, every one Smiley

I have used today a proper audio cable (instead of a headset) to connect between my PC's audio output and input, so the noise went down dramatically.
This way I was able to achieve 36kbps (after ECC) to successfully transmit 64kB.

Note that there is an overhead of ~2 seconds for the training sequence of the modem, so the effective transfer time is ~15 seconds.

Quote
$ ./test.sh
+ set -e
+ dd if=/dev/urandom of=data.send bs=1024 count=64
64+0 records in
64+0 records out
65536 bytes (66 kB) copied, 0.00955402 s, 6.9 MB/s
+ python send.py
Running MODEM @ 40.0 kbps
Encoded 65536 bytes
$ arecord rx.int16 -q -f S16_LE -c 1 -r 32000
$ aplay tx.int16 -q -f S16_LE -c 1 -r 32000
Took 17.27 seconds
+ python recv.py
2014-07-09 08:38:23,480 INFO         Carrier detected at ~58.0 ms @ 1.0 kHz: coherence=100.000%, amplitude=0.402
2014-07-09 08:38:23,483 INFO         Carrier starts at 57.500 ms
2014-07-09 08:38:24,058 INFO         Prefix OK
2014-07-09 08:38:24,058 INFO         Frequency error: -0.02 ppm
2014-07-09 08:38:24,146 INFO                1.0 kHz: Noise sigma=0.0040, SNR=47.9 dB
2014-07-09 08:38:24,235 INFO                2.0 kHz: Noise sigma=0.0034, SNR=49.5 dB
2014-07-09 08:38:24,323 INFO                3.0 kHz: Noise sigma=0.0026, SNR=51.8 dB
2014-07-09 08:38:24,411 INFO                4.0 kHz: Noise sigma=0.0027, SNR=51.4 dB
2014-07-09 08:38:24,500 INFO                5.0 kHz: Noise sigma=0.0032, SNR=50.0 dB
2014-07-09 08:38:24,588 INFO                6.0 kHz: Noise sigma=0.0025, SNR=52.0 dB
2014-07-09 08:38:24,676 INFO                7.0 kHz: Noise sigma=0.0034, SNR=49.4 dB
2014-07-09 08:38:24,765 INFO                8.0 kHz: Noise sigma=0.0042, SNR=47.6 dB
2014-07-09 08:38:24,853 INFO                9.0 kHz: Noise sigma=0.0075, SNR=42.5 dB
2014-07-09 08:38:24,941 INFO               10.0 kHz: Noise sigma=0.0197, SNR=34.1 dB
2014-07-09 08:38:24,941 INFO         Demodulation started
2014-07-09 08:38:36,076 INFO         Demodulated 616560 bits : 77.070 kB @ 11.134 seconds
2014-07-09 08:38:37,469 INFO         Decoded 65.536 kB
+ python errors.py data.recv data.send
0/524288 bit error rate: 0.000%

The constellations are here: https://i.imgur.com/7kRtJb9.png

Using 36kpbs MODEM throughput, we can transmit 5MB = 40Mb in ~1111 seconds = 18.5 minutes.
14  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 06, 2014, 06:31:47 PM
Some more technical details:
I am using 4 carrier frequencies (8, 9, 10 and 11 kHz), which are modulated using QPSK-4 (yielding 2 bits per symbol).
Each symbol duration is 1ms, so the bitrate of the modem is 8[kbps] = 2[bit/symbol] * 1000[symbol/second] * 4 (carriers).

The symbols' constellations are shown here: https://i.imgur.com/JAbGkIt.png. They can be plotted using:
Quote
$ source env/bin/activate
$ pip install matplotlib
$ PYLAB=1 python recv.py
Carrier detected at ~2242.0 ms @ 10.0 kHz: coherence=99.411%, amplitude=0.400
Carrier starts at 2241.688 ms
Prefix OK
Frequency error: 1.52 ppm
       8.0 kHz: Noise sigma=0.0790, SNR=22.0 dB
       9.0 kHz: Noise sigma=0.0407, SNR=27.8 dB
      10.0 kHz: Noise sigma=0.0348, SNR=29.2 dB
      11.0 kHz: Noise sigma=0.0288, SNR=30.8 dB
Decoded 5 blocks = 1150 bytes (ECC overhead 9.8%)
Decoded 1024 bytes
$ python errors.py data.send data.recv
0/8192 bit error rate: 0.000%
Note that the noise is higher on lower frequencies, probably due to "pink noise" (http://en.wikipedia.org/wiki/Pink_noise).

The received signal waveform and spectrogram are given here: https://i.imgur.com/JMuRbAZ.png.
They can be plotted using (after matplotlib package is installed):
Quote
$ python show.py rx.int16

By the way, is the BTC bounty still open? Smiley
15  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 05, 2014, 07:08:33 PM
Thanks for the compliment Smiley

I chose not to use QR codes, since my PC and laptop have no camera...
16  Bitcoin / Project Development / Re: [BOUNTY - 25 BTC] Audio/Modem-based communication library on: July 05, 2014, 06:35:32 PM
Hi all,

I have been working during the last weeks on an audio modem library in Python: https://bitbucket.org/romanz/amodem
EDIT: moved to GitHub: https://github.com/romanz/amodem.

I am using a simple headset, whose speaker is connected to the transmitting PC and the microphone is connected to the receiving PC.
Then, I bring the speaker and the microphone close together and use the PC's sound cards to perform the communication.

The sender is modulating data.send binary file using send.py script into 32kHz audio file (tx.int16), which is played using aplay Linux utility.
The receiver is using arecord Linux utility to record the audio file into rx.int16 32kHz audio file, which is demodulated by recv.py script into data.recv binary file.
The process requires a single manual calibration step in order to find the maximal volume for the speaker, so that it won't saturate the microphone.

The modem's bitrate is currently 8kbps - so it should not have a problem sending a simple transaction in O(seconds).
Moreover, I am sure it can be optimized by using better modulation, error correction and better audio equipment.

Currently, the documentation is quite lacking, but today was the first time I successfully transmitted 1KB of random binary data between 2 PCs, so I am quite excited Smiley
The recorded audio file is currently stored at rx.int16 - and can be demodulated by running:
Quote
$ virtualenv env
$ source env/bin/activate
$ pip install reedsolo numpy
$ python recv.py

I would be happy to continue developing this library, in order to integrate it with popular Bitcoin wallets, aiming to support air-gapped transaction signing.

Comments are welcome Smiley
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!