Buen día, camaradas! Soy solo un músico principiante, pero tengo experiencia en programación. ¿Y por qué no tomar algunos datos e intentar la salida de audio (es como visualizar, solo ... cap)?
Taschemta, el plan es este:
- Encuentra datos
- Piensa cómo convertirlos en sonido
- Ajuste los parámetros del convertidor para que sea más hermoso
- Aún fuerza? ir a 1
Atrapando rayos cósmicos
Tomé los datos del sitio . Específicamente, utilicé los datos de "Mediciones variacionales" de rayos cósmicos para el período predeterminado - 31-10 de marzo, 04 - Tien-Shan y Tien-Shan Underground (para que aún pueda rastrear algunas correlaciones o armonías). Y para un cambio de datos, descargué las mediciones de "radiación gamma", también para el período predeterminado, esta vez el 5.04-10.04.
Los datos de Tien-Shan se ven así:
31.03.2020 00:00:00 3813 5504 5187 5251 4637 4071 4568 4998 4922 4858 4956 4271 3997 4358 4715 4077 4160 3980
31.03.2020 00:01:00 3653 5308 5413 5371 4691 4090 4617 5139 5009 4762 5172 4309 4208 4387 4923 4248 4092 4108
31.03.2020 00:02:00 3763 5309 5292 5298 4588 4105 4608 5072 5070 4745 4834 4158 3918 4284 5115 4233 4011 3972
…
09.04.2020 23:57:00 3855 5308 5239 5190 4531 4063 4537 5035 5084 4863 5089 4261 4122 4395 5394 4186 4167 4078
09.04.2020 23:58:00 3955 5492 5416 5406 4458 4037 4474 5122 4942 4733 5168 4330 4026 4357 5283 4059 4174 3857
09.04.2020 23:59:00 3811 5378 5334 5121 4472 3955 4334 4992 4940 4646 4822 4378 4137 4195 4880 4049 4002 3817
Tien-Shan Chart:

La estructura de datos subterráneos de Tien-Shan es idéntica a la estructura anterior, pero los valores en sí son mucho más bajos:
31.03.2020 00:00:00 20 32 29 26 20 20 17 14 16
31.03.2020 00:01:00 14 16 17 27 20 27 9 15 7
31.03.2020 00:02:00 13 22 16 22 15 18 12 15 11
…
09.04.2020 23:57:00 17 19 20 27 20 17 11 18 16
09.04.2020 23:58:00 14 33 19 19 18 16 15 16 9
09.04.2020 23:59:00 16 31 23 25 21 22 16 10 14
Gráfico subterráneo de Tien-Shan:

Y los datos de radiación gamma se ven así:
05.04.2020 00:00:02 20640 5345 4726 3532 2365 2118 1261 891 655 334 252 194
05.04.2020 00:00:12 21160 5295 4666 3526 2365 2138 1250 852 627 309 235 190
05.04.2020 00:00:22 19581 5189 4562 3536 2401 2130 1229 820 618 324 243 172
…
09.04.2020 23:59:37 22381 5134 4505 3429 2274 2044 1223 823 569 275 205 154
09.04.2020 23:59:47 21917 5186 4577 3448 2273 2044 1166 803 563 293 214 165
09.04.2020 23:59:58 20930 5275 4644 3561 2382 2148 1248 868 609 289 232 176
Punto de radio Mu1 gráfico:

Si uso cualquier otro dato, actualizaré la declaración de fuentes constantes (párrafo anterior)
Primer intento
. . , , Audacity . ! , - .
, Audacity float -1.00000 1.00000, -1/1 = 0dB — , .
, csv, , (\s\t\n)+
, , .
Audacity
raw Audacity :
1:
;This is a comment and will be ignored.
0.07100 0.14056 0.20727 0.26978 0.32682 0.37724 0.42001 0.45428 0.47933 0.49468 0.50000 0.49518 0.48034 0.45575 0.42193 0.37957 0.32951 0.27277 0.21050 0.14397 0.07452 0.00356 -0.06747 -0.13713 -0.20402 -0.26677 -0.32411 -0.37489 -0.41807 -0.45278 -0.47831 -0.49415 -0.49997 -0.49566 -0.48131 -0.45721 -0.42384 -0.38188 -0.33218 -0.27575 -0.21373 -0.14738 -0.07804 -0.00712 0.06394 0.13370 0.20076 0.26375 0.32139 0.37252 0.41611 0.45125 0.47726 0.49359 0.49992 0.49612 0.48226 0.45864 0.42571 0.38416 0.33483 0.27871 0.21694 0.15078 0.08156 0.01068 -0.06040 -0.13027 -0.19749 -0.26072 -0.31866 -0.37014 -0.41412 -0.44971 -0.47618 -0.49301 -0.49984 -0.49655 -0.48319 -0.46004 -0.42757 -0.38643 -0.33747 -0.28166 -0.22015 -0.15417 -0.08507 -0.01425
:
0.00000 -0.00000
0.10000 -0.10000
0.20000 -0.20000
0.30000 -0.30000
0.40000 -0.40000
0.50000 -0.50000
0.60000 -0.60000
0.70000 -0.70000
0.80000 -0.80000
0.90000 -0.90000
1.00000 -1.00000
, ( , — ).
** , . , — , , — 0dB.
PoC — Proof of Concept. — -, .
. .
, Audacity , float [-1.00000-1.00000]. : , , , .
( F12), , .
. Find & Replace : (.+?\t){x}(.+?)\t.+?\n->
\2,`, — + 1 ( ).
csv :
3813,3790,3801,3833,3674,3822,3639,3848,3866,3794,3747,3938,3823,3989,3963,3852,3836,3694,3883,3748,3802,3884,3790,3684,3895,3872,3885,4011,3844,3901,3713,3870,3868,3772,3866,3939,3856,3720,3640,3929,3905,...
, :
a = [1, 2, 3, 4, 5]
function parse_array(arr) {
console.log(“Min: “ + Math.min(...arr));
console.log(“Max: “ + Math.max(...arr));
console.log(“Avg: “ + arr.reduce((a, b) => a + b) / arr.length);
}
> parse_array(a)
1
5
3
, , Tien-Shan:
1: Min: 3514; Max: 4192; Avg: 3844.4135528815705
2: Min: 4934; Max: 5741; Avg: 5358.663125307817
3: Min: 4945; Max: 5703; Avg: 5313.77323577007
4: Min: 4882; Max: 5725; Avg: 5281.23640329276
5: Min: 4219; Max: 4953; Avg: 4598.3294167311615
6: Min: 3712; Max: 4426; Avg: 4075.323506648843
7: Min: 4168; Max: 4966; Avg: 4530.841131358616
8: Min: 4576; Max: 5344; Avg: 4973.967775979737
9: Min: 4608; Max: 5478; Avg: 4976.573559417435
10: Min: 4459; Max: 5261; Avg: 4795.212692605362
11: Min: 4574; Max: 5380; Avg: 4989.718215718005
12: Min: 3944; Max: 4757; Avg: 4331.33553788785
13: Min: 0 (3771); Max: 4428; Avg: 4095.4295363399706
14: Min: 0 (4084); Max: 4865; Avg: 4407.586716386407
15: Min: 0 (4384); Max: 5394; Avg: 4866.680292689791
16: Min: 0 (3837); Max: 4703; Avg: 4238.36325898825
17: Min: 0 (3786); Max: 4661; Avg: 4204.146837402378
18: Min: 0 (3753); Max: 4596; Avg: 4152.545697600788
* , duh.
, float [-1.00000-1.00000] :
a = [1, 2, 3, 4, 5]
function parse_array(arr) {
arr = arr.filter(a => a != 0);
min = Math.min(...arr);
max = Math.max(...arr);
avg = arr.reduce((a, b) => a + b) / arr.length;
console.log("Min: " + min + "; Max: " + max + "; Avg: " + avg);
floatify = function (a) {
if (a == 0) return 0;
if (a > avg) {
return (a - avg) / (max - avg);
} else {
return (a - min) / (avg - min) - 1;
}
console.log(arr.map(a => floatify(a)));
}
> parse_array(a)
Min: 1; Max: 5; Avg: 3
[-1, -0.5, 0, 0.5, 1]
:
-0.09502086396735898
-0.579290635757401
-0.24635516765174703
-0.1646346436621775
-0.1313410968516121
-0.03448714249360363
Audacity Tools → Sample Data Import…
- ( Tien-Shan):

. , .
.
()
. , . , :
Timestamp FractionalDate UncorrectedCountRate[cts/min] CorrectedCountRate[cts/min] Pressure[mbar]
2020-03-11T00:00:00Z 71.0000000 7150 6702 991.00
2020-03-11T00:30:00Z 71.0208333 7205 6749 990.91
2020-03-11T01:00:00Z 71.0416667 7214 6750 990.75
2020-03-11T01:30:00Z 71.0625000 7250 6776 990.61
2020-03-11T02:00:00Z 71.0833333 7275 6792 990.45
, .
:
( → )
: detune,
Overtone
, , - . , . Overtone ( ).
:
- Ovetone. : Java, Clojure, Supercollider, Leiningen, JackD jackd, pulseaudio alsa. !
Clojure Leiningen.
, , .
Clojure
, . , , .
Clojure, . . , lein repl
( ), tone.clj, , repl-.
:
(demo 0.5 (sin-osc 440))
, . , .
lein repl
ovetone
user=> (use ‘overtone.live)
user=> (load-file “tone.clj”)
? ! ? - . , …
, “”. / , .
:
user=> (def a [1,2,3])
#'user/a
user=> (prn-str a)
"[1 2 3]\n"
user=> (spit "stored-array.dat" (prn-str a))
nil
user=> (slurp "stored-array.dat")
"[1 2 3]\n"
* , Clojure, overtone.live —
, Clojure. , , , , — .
UPD: , \n , :
user=> (defn trim [input] (clojure.string/replace input #"\n" ""))
#'user/trim
, , (\n, …):
user=> (trim (slurp “stored-array.dat”))
“[1 2 3]”
, , overtone. , .
, , overtone, .
— Shadertoy.com
? . , !
:
vec2 mainSound(float time) {
return vec2(sin(6.2831 * 440.0 * time) * exp(-2.0 * time));
}
**(… … — )
— shadertoy , :
:
vec2 mainSound(float time) {
vec2 result = vec2(sin(6.2831 * 440.0 * time) * exp(-2.0 * time));
if (time > 1.0) {
result = vec2(sin(6.2831 * 262.0 * time) * exp(-2.0 * (time - 1.0)));
}
return result;
}
Shadertoy , !
, — :
- , .
struct Note {
float frequency;
float offset;
float duration;
};
- (
return
) :
float noteFreq(Note note, float time) {
return cos(6.2831 * note.frequency * time) * exp(-1.0/note.duration * (time - note.offset));
}
, “ ”, ( ; 12 ).
float nearestNote(float value) {
for (int i = 1; i < scale.length(); i++) {
if (scale[i] > value) {
return scale[i - 1];
}
}
return scale[0];
}
vec2 mainSound(float time) {...}
.
. , , boilerplate .
. -, , .
, , ( ). , “” , : 2:1 (4:1) 3:1 . , , . :
const float leadTempoRatio = 2.0;
const float midTempoRatio = 2.0/3.0;
const float bassTempoRatio = 1.0;
const float[] dataLead = float[] (5504.0, 5308.0, 5309.0, 5289.0, 5225.0, 5208.0, 5190.0, 5250.0, 5362.0, 5486.0, 5314.0, 5467.0, 5292.0, 5305.0, 5167.0, 5423.0, 5402.0, 5280.0, 5420.0, 5428.0, 5260.0, 5306.0, 5379.0, 5283.0, 5234.0, 5340.0, 5252.0, 5568.0, 5476.0, 5248.0, 5494.0, 5480.0, 5230.0, 5609.0, 5323.0, 5392.0, 5304.0, 5478.0, 5321.0, 5435.0, 5179.0, 5444.0, 5289.0, 5413.0, 5275.0, 5389.0, 5500.0, 5221.0, 5276.0, 5356.0, 5250.0, 5414.0, 5269.0, 5269.0, 5216.0, 5512.0, 5410.0, 5300.0, 5426.0, 5433.0, 5156.0, 5482.0, 5281.0, 5377.0, 5279.0, 5317.0, 5111.0, 5455.0, 5435.0, 5239.0, 5353.0, 5342.0, 5519.0, 5242.0, 5281.0, 5226.0, 5374.0, 5190.0, 5232.0, 5292.0, 5466.0, 5298.0, 5265.0, 5521.0, 5435.0, 5252.0, 5245.0, 5506.0, 5491.0, 5343.0, 5390.0, 5287.0, 5349.0, 5332.0, 5515.0, 5358.0, 5369.0, 5396.0, 5187.0, 5308.0, 5322.0, 5207.0, 5355.0, 5388.0, 5265.0, 5217.0, 5254.0, 5494.0, 5306.0, 5380.0, 5352.0, 5297.0, 5395.0, 5387.0, 5410.0, 5448.0, 5301.0, 5182.0, 5465.0, 5327.0, 5617.0, 5362.0, 5417.0, 5470.0, 5549.0, 5283.0, 5425.0, 5419.0, 5307.0, 5405.0, 5286.0, 5228.0, 5400.0, 5426.0, 5378.0, 5396.0, 5514.0, 5393.0, 5314.0, 5318.0, 5431.0, 5236.0, 5257.0, 5239.0, 5447.0, 5439.0, 5399.0, 5484.0, 5455.0, 5226.0, 5586.0, 5491.0, 5338.0, 5390.0, 5275.0, 5278.0, 5474.0, 5332.0, 5320.0, 5355.0, 5387.0, 5435.0, 5406.0, 5196.0, 5363.0, 5500.0, 5466.0, 5443.0, 5248.0, 5510.0, 5342.0, 5270.0, 5123.0, 5485.0, 5318.0, 5469.0, 5249.0, 5330.0, 5406.0, 5543.0, 5203.0, 5281.0, 5395.0, 5416.0, 5249.0, 5252.0, 5372.0, 5397.0, 5327.0, 5260.0, 5430.0, 5334.0, 5309.0, 5435.0, 5381.0, 5324.0, 5399.0, 5504.0, 5320.0, 5458.0);
const float[] dataMid = float[] (3813.0, 3653.0, 3763.0, 3790.0, 3801.0, 3833.0, 3674.0, 3822.0, 3639.0, 3848.0, 3866.0, 3794.0, 3747.0, 3938.0, 3823.0, 3989.0, 3963.0, 3852.0, 3836.0, 3694.0, 3883.0, 3748.0, 3802.0, 3884.0, 3790.0, 3684.0, 3895.0, 3872.0, 3885.0, 4011.0, 3844.0, 3901.0, 3713.0, 3870.0, 3868.0, 3772.0, 3866.0, 3939.0, 3856.0, 3720.0, 3640.0, 3929.0, 3905.0, 3811.0, 3811.0, 3899.0, 3699.0, 3868.0, 3892.0, 3746.0, 3878.0, 3778.0, 3894.0, 3740.0, 3709.0, 3710.0, 3812.0, 3856.0, 3811.0, 3935.0, 3850.0, 3859.0, 3800.0, 3748.0, 3725.0, 3814.0, 3897.0, 3745.0, 3763.0, 3833.0, 3964.0, 3770.0, 3846.0, 3776.0, 3945.0, 3791.0, 3799.0, 3709.0, 3922.0, 3825.0, 3804.0, 3869.0, 3829.0, 3770.0, 3838.0, 3820.0, 3734.0, 3979.0, 3765.0, 3764.0, 3857.0, 3861.0, 3869.0, 3787.0, 3963.0, 3780.0, 3847.0, 3759.0, 3857.0, 3782.0, 3711.0, 3843.0, 3909.0, 3839.0, 3811.0, 3874.0, 3849.0, 3883.0, 3925.0, 3752.0, 3847.0, 3731.0, 3824.0, 3905.0, 3901.0, 3926.0, 3897.0, 3751.0, 3896.0, 3752.0, 3854.0, 3936.0, 3767.0, 3812.0, 3933.0, 3889.0, 3808.0, 3703.0, 3948.0, 3883.0, 3872.0, 3762.0, 3870.0, 3899.0, 3818.0, 3900.0, 3774.0, 3951.0, 3818.0, 3893.0, 3821.0, 3823.0, 3801.0, 3833.0, 3744.0, 3769.0, 3864.0, 3923.0, 3974.0, 3810.0);
const float[] dataBass = float[] (20.0, 14.0, 13.0, 14.0, 10.0, 23.0, 16.0, 18.0, 6.0, 16.0, 18.0, 7.0, 15.0, 13.0, 14.0, 22.0, 12.0, 14.0, 12.0, 14.0, 19.0, 18.0, 8.0, 16.0, 13.0, 12.0, 21.0, 17.0, 22.0, 19.0, 11.0, 16.0, 16.0, 24.0, 16.0, 20.0, 18.0, 20.0, 17.0, 22.0, 23.0, 14.0, 17.0, 16.0, 23.0, 14.0, 15.0, 10.0, 12.0, 14.0, 20.0, 22.0, 14.0, 14.0, 20.0, 24.0, 14.0, 23.0, 20.0, 25.0, 14.0, 17.0, 21.0, 21.0, 18.0, 18.0, 13.0, 11.0, 21.0, 22.0, 16.0, 13.0, 24.0, 26.0, 29.0, 27.0, 18.0, 23.0, 15.0, 18.0, 8.0, 17.0, 24.0, 14.0, 12.0, 18.0, 16.0, 15.0, 25.0, 12.0, 19.0, 11.0, 18.0, 25.0, 21.0, 16.0, 19.0, 24.0, 19.0, 14.0);
. — ( , ). ( ):
float fixLead(float value) {
return nearestNote(value / 8.0);
}
float fixMid(float value) {
return nearestNote(value / 10.0);
}
float fixBass(float value) {
return nearestNote(value * 7.0);
}
— — , .
— ( ), — .
. , . , copy-paste, :)
const float[] scale = float[] (16.35, 18.35, 20.60, 21.83, 24.50, 27.50, 30.87, 32.70, 36.71, 41.20, 43.65, 49.00, 55.00, 61.74, 65.41, 73.42, 82.41, 87.31, 98.00, 110.00, 123.47, 130.81, 146.83, 164.81, 174.61, 196.00, 220.00, 246.94, 261.63, 293.66, 329.63, 349.23, 392.00, 440.00, 493.88, 523.25, 587.33, 659.25, 698.46, 783.99, 880.00, 987.77, 1046.50, 1174.66, 1318.51, 1396.91, 1567.98, 1760.00, 1975.53, 2093.00, 2349.32, 2637.02, 2793.83, 3135.96, 3520.00, 3951.07, 4186.01, 4698.63, 5274.04, 5587.65, 6271.93, 7040.00, 7902.13);
C0 B8, , 8 7 . ( , ).
“” fix*()
.
: , , .
, mainSound(float time) {...}
, noteFreq()
.
float result = 0.0;
for (int i = 0; i < dataLead.length(); i++) {
Note noteLead = Note(fixLead(dataLead[i]), float(i) + 2.0, 1.0/4.0);
if (time > noteLead.offset) {
float amplitude = noteFreq(noteLead, time);
result += amplitude;
}
}
return vec2(result);
. . .
Shadertoy — , - . . . .
Sound
. . . DRY
, , . , .
, Sound
Common
, :
vec2 mainSound(float time) {
return _mainSound(time);
}
( Buf A
):
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
_mainSound(iTime);
fragColor = vec4(FRAG_COLOR);
}
— , .
(iTime
time
). “ ”. , “” ( — ; — ; — ):
float result = 0.0;
vec4 frag_color = vec4(0.0);
frag_color.a = 1.0;
for (int i = 0; i < dataLead.length(); i++) {
Note noteLead = Note(fixLead(dataLead[i]), float(i) + 2.0, 1.0/4.0);
if (time > noteLead.offset) {
float amplitude = noteFreq(noteLead, time);
result += amplitude;
frag_color.b += amplitude;
}
}
FRAG_COLOR = frag_color;
return vec2(result);
, . , , , .
, , , - , .
** Shadertoy . , .
() . !
( ):
.
, wav-.
** ...
¡Gracias a todos por vuestro interés! No puedo garantizar que el texto esté escrito claramente, pero puedo prometer masticar todos los momentos incomprensibles (que yo mismo entiendo) en los comentarios.
Todos ️
UPD: en shadowrtoy Sound, una pestaña puede llamar directamentemainSound()
desde unaCommon
pestaña. Por lo tanto,Sound
puede estar vacío, pero enCommon
renombrar_mainSound()
amainSound()
.
Tampoco lo necesitamos bufA
, porque es una capa adicional y podemos llamarla mainSound()
directamente desde la Image
pestaña, y en ella ya funciona con el píxel recibido, sin representar la textura del mediador.
Todo está en el mismo enlace.