Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #33: piezo-electric interference


sci / sci.crypt / Re: [d2t] Data to Tones

SubjectAuthor
* [d2t] Data to TonesOnion Courier
`* Re: [d2t] Data to TonesChris M. Thomasson
 `* Re: [d2t] Data to TonesOnion Courier
  `* Re: [d2t] Data to TonesChris M. Thomasson
   `- Re: [d2t] Data to TonesStefan Claas

1
Subject: [d2t] Data to Tones
From: Onion Courier
Newsgroups: sci.crypt
Organization: dizum.com - The Internet Problem Provider
Date: Fri, 27 Dec 2024 21:45 UTC
From: noreply@oc2mx.net (Onion Courier)
Subject: [d2t] Data to Tones
Message-Id: <20241227214543.0F0EC200E1@hal.oc2mx.net>
Date: Fri, 27 Dec 2024 21:45:42 +0000 (UTC)
Newsgroups: sci.crypt
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!alphared!sewer!news.dizum.net!not-for-mail
Organization: dizum.com - The Internet Problem Provider
X-Abuse: abuse@dizum.com
Injection-Info: sewer.dizum.com - 2001::1/128
View all headers

https://jmp.sh/ELTus4hj
(download and decode with Python3 code below)

import argparse
import math
import numpy as np
import struct
import sys
from scipy.fftpack import fft

SAMPLE_RATE = 44100
DURATION = 0.2
FFT_SIZE = 8820
AMPLITUDE_8BIT = 127
AMPLITUDE_16BIT = 32760
BASE_FREQ = 440.0
FREQ_STEP = 25.0 # Larger step size since we only need 16 values

def generate_tone_buffer(freq, use_16bit):
num_samples = int(SAMPLE_RATE * DURATION)
amplitude = AMPLITUDE_16BIT if use_16bit else AMPLITUDE_8BIT
bytes_per_sample = 2 if use_16bit else 1
buf = bytearray(num_samples * bytes_per_sample)

for i in range(num_samples):
t = i / SAMPLE_RATE
window = 0.5 * (1 - math.cos(2 * math.pi * i / (num_samples - 1)))
sample = int(amplitude * math.sin(2 * math.pi * freq * t) * window)

if use_16bit:
struct.pack_into('>h', buf, i * 2, sample)
else:
buf[i] = sample + AMPLITUDE_8BIT

return buf

def write_au_header(use_16bit):
encoding = 0x03 if use_16bit else 0x02
header = bytearray([
0x2e, 0x73, 0x6e, 0x64,
0x00, 0x00, 0x00, 0x20,
0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, encoding,
0x00, 0x00, 0xac, 0x44,
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
])
sys.stdout.buffer.write(header)

def encode_tones(data, use_16bit, tone_buffers):
write_au_header(use_16bit)
hex_str = data.hex()

for c in hex_str:
index = int(c, 16)
sys.stdout.buffer.write(tone_buffers[index])

def detect_frequency(samples):
windowed_samples = samples * np.hanning(len(samples))
spectrum = fft(windowed_samples)
magnitude = np.abs(spectrum[:len(spectrum) // 2])
peak_index = np.argmax(magnitude)
freq = peak_index * SAMPLE_RATE / FFT_SIZE

if peak_index > 0 and peak_index < FFT_SIZE // 2 - 1:
alpha = magnitude[peak_index - 1]
beta = magnitude[peak_index]
gamma = magnitude[peak_index + 1]
correction = 0.5 * (alpha - gamma) / (alpha - 2 * beta + gamma)
freq += correction * SAMPLE_RATE / FFT_SIZE

return freq

def freq_to_hex(freq):
index = round((freq - BASE_FREQ) / FREQ_STEP)
if 0 <= index < 16:
return format(index, 'x')
return None

def decode_tones(input_data, use_16bit):
bytes_per_sample = 2 if use_16bit else 1
input_data = input_data[24:]
num_samples = len(input_data) // bytes_per_sample

if use_16bit:
samples = np.frombuffer(input_data, dtype='>i2').astype(np.float64) / AMPLITUDE_16BIT
else:
samples = (np.frombuffer(input_data, dtype=np.uint8).astype(np.float64) - AMPLITUDE_8BIT) / AMPLITUDE_8BIT

hex_output = []
for i in range(0, num_samples, FFT_SIZE):
if i + FFT_SIZE > num_samples:
break
window = samples[i:i + FFT_SIZE]
freq = detect_frequency(window)
digit = freq_to_hex(freq)
if digit is not None:
hex_output.append(digit)

decoded_data = bytes.fromhex(''.join(hex_output))
sys.stdout.buffer.write(decoded_data)

def main():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--decode', action='store_true', help='Decode mode')
parser.add_argument('-16', '--use16bit', action='store_true', help='Use 16-bit audio (default: 8-bit)')
args = parser.parse_args()

tone_buffers = [
generate_tone_buffer(BASE_FREQ + i * FREQ_STEP, args.use16bit)
for i in range(16)
]

input_data = sys.stdin.buffer.read()

if args.decode:
decode_tones(input_data, args.use16bit)
else:
encode_tones(input_data, args.use16bit, tone_buffers)

if __name__ == '__main__':
main()

Subject: Re: [d2t] Data to Tones
From: Chris M. Thomasson
Newsgroups: sci.crypt
Organization: A noiseless patient Spider
Date: Fri, 27 Dec 2024 22:16 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: sci.crypt
Subject: Re: [d2t] Data to Tones
Date: Fri, 27 Dec 2024 14:16:50 -0800
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <vkn90h$3rp30$1@dont-email.me>
References: <20241227214543.0F0EC200E1@hal.oc2mx.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Dec 2024 23:16:49 +0100 (CET)
Injection-Info: dont-email.me; posting-host="dc94c7ace8cf84f6d4600697d86a4b2a";
logging-data="4056160"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Xan8ZoiacQBb6joaZruTiIoG/J8uHPSs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:JBfFhUBkZyV9Jjy0JtXPS8g1g/8=
Content-Language: en-US
In-Reply-To: <20241227214543.0F0EC200E1@hal.oc2mx.net>
View all headers

On 12/27/2024 1:45 PM, Onion Courier wrote:
> https://jmp.sh/ELTus4hj
> (download and decode with Python3 code below)

[snip code]

Interesting to me. Well, fwiw, here is one of my tries. Cantor Pairing
notes via MIDI:

https://youtu.be/XkwgJt5bxKI

A drum kit:

https://youtu.be/712wWf7Q9sE

;^)

Subject: Re: [d2t] Data to Tones
From: Onion Courier
Newsgroups: sci.crypt
Organization: dizum.com - The Internet Problem Provider
Date: Fri, 27 Dec 2024 22:25 UTC
References: 1 2
From: noreply@oc2mx.net (Onion Courier)
Subject: Re: [d2t] Data to Tones
References: <20241227214543.0F0EC200E1@hal.oc2mx.net>
<vkn90h$3rp30$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20241227222526.C0DBE200E1@hal.oc2mx.net>
Date: Fri, 27 Dec 2024 22:25:26 +0000 (UTC)
Newsgroups: sci.crypt
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!alphared!sewer!news.dizum.net!not-for-mail
Organization: dizum.com - The Internet Problem Provider
X-Abuse: abuse@dizum.com
Injection-Info: sewer.dizum.com - 2001::1/128
View all headers

Chris M. Thomasson wrote:
> On 12/27/2024 1:45 PM, Onion Courier wrote:
> > https://jmp.sh/ELTus4hj
> > (download and decode with Python3 code below)
>
> [snip code]
>
> Interesting to me. Well, fwiw, here is one of my tries. Cantor Pairing
> notes via MIDI:
>
> https://youtu.be/XkwgJt5bxKI
>
> A drum kit:
>
> https://youtu.be/712wWf7Q9sE

Really nice!

--
Regards
Stefan

Subject: Re: [d2t] Data to Tones
From: Chris M. Thomasson
Newsgroups: sci.crypt
Organization: A noiseless patient Spider
Date: Tue, 31 Dec 2024 21:47 UTC
References: 1 2 3
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: sci.crypt
Subject: Re: [d2t] Data to Tones
Date: Tue, 31 Dec 2024 13:47:50 -0800
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <vl1oq7$2dh2e$2@dont-email.me>
References: <20241227214543.0F0EC200E1@hal.oc2mx.net>
<vkn90h$3rp30$1@dont-email.me> <20241227222526.C0DBE200E1@hal.oc2mx.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 31 Dec 2024 22:47:51 +0100 (CET)
Injection-Info: dont-email.me; posting-host="73f7e020ca92f621b66e1ee9786e2a0e";
logging-data="2540622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BaTzl2cCl5mpQEaKll39w1seIZhDmwLk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:VLSc5yfAp6JYUK3BbC5wpwSeKn8=
In-Reply-To: <20241227222526.C0DBE200E1@hal.oc2mx.net>
Content-Language: en-US
View all headers

On 12/27/2024 2:25 PM, Onion Courier wrote:
> Chris M. Thomasson wrote:
>> On 12/27/2024 1:45 PM, Onion Courier wrote:
>>> https://jmp.sh/ELTus4hj
>>> (download and decode with Python3 code below)
>>
>> [snip code]
>>
>> Interesting to me. Well, fwiw, here is one of my tries. Cantor Pairing
>> notes via MIDI:
>>
>> https://youtu.be/XkwgJt5bxKI
>>
>> A drum kit:
>>
>> https://youtu.be/712wWf7Q9sE
>
> Really nice!
>

Thank you! :^)

Happy New Year!

Btw, I actually made it into the AMS webpage. A screenshot:

https://i.ibb.co/64dSF1d/image.png

I am humbled.

Subject: Re: [d2t] Data to Tones
From: Stefan Claas
Newsgroups: sci.crypt
Organization: To protect and to server
Date: Tue, 31 Dec 2024 21:56 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: pollux@tilde.club (Stefan Claas)
Newsgroups: sci.crypt
Subject: Re: [d2t] Data to Tones
Date: Tue, 31 Dec 2024 22:56:39 +0100
Organization: To protect and to server
Message-ID: <vl1pan$3e4do$1@paganini.bofh.team>
References: <20241227214543.0F0EC200E1@hal.oc2mx.net> <vkn90h$3rp30$1@dont-email.me> <20241227222526.C0DBE200E1@hal.oc2mx.net> <vl1oq7$2dh2e$2@dont-email.me>
Mime-Version: 1.0
Injection-Date: Tue, 31 Dec 2024 21:56:39 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3609016"; posting-host="6lqOwJyxRLkv94k9QBgAmg.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: flnews/1.3.0pre29 (for GNU/Linux)
Cancel-Lock: sha1:W8+WWfTxIEvBdClzI64K6euRuGk=
X-Ed25519-Sig: 4e9d814c9a9d069f7753bb770ff86e4552504f4c2827b9857c0fc93db68d6bac
947275a0553493e6e8b3a7220047225bdc0f0f6a8b69664a371430a3df92b900
X-Date: It's Tue Sep 11445 10:56:39 PM CET 1993, the September that never ends.
X-Notice: Filtered by postfilter v. 0.9.3
X-Ed25519-Pub: c0ffee5a36e581eb10f60b2831b3cdb955d2e7ef680dd282a8d43ad8b84b357a
View all headers

Chris M. Thomasson wrote:
> On 12/27/2024 2:25 PM, Onion Courier wrote:
> > Chris M. Thomasson wrote:
> > > On 12/27/2024 1:45 PM, Onion Courier wrote:
> > > > https://jmp.sh/ELTus4hj
> > > > (download and decode with Python3 code below)
> > >
> > > [snip code]
> > >
> > > Interesting to me. Well, fwiw, here is one of my tries. Cantor Pairing
> > > notes via MIDI:
> > >
> > > https://youtu.be/XkwgJt5bxKI
> > >
> > > A drum kit:
> > >
> > > https://youtu.be/712wWf7Q9sE
> >
> > Really nice!
> >
>
> Thank you! :^)
>
> Happy New Year!
>
> Btw, I actually made it into the AMS webpage. A screenshot:
>
> https://i.ibb.co/64dSF1d/image.png
>
> I am humbled.

Cool! Happy News Year!

--
Regards
Stefan

1

rocksolid light 0.9.8
clearnet tor