-
Notifications
You must be signed in to change notification settings - Fork 0
/
oldindex.html
700 lines (616 loc) · 31.2 KB
/
oldindex.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bitcoin Audional Generator</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #202020;
color: white;
font-family: 'ShareTechMono-Regular', Arial, sans-serif;
width: 100vw;
overflow-x: hidden;
}
.header {
align-items: center;
background-color: black;
display: flex;
height: 100px;
justify-content: space-between;
width: 100vw;
}
.header img {
height: 100%;
}
.header h1 {
color: white;
flex-grow: 2;
font-size: 6em;
text-align: center;
}
.row {
display: flex;
flex-wrap: wrap;
margin: 0 -5px;
}
.column {
flex: 33.33%;
padding: 5px 5px;
}
.form-group {
margin-bottom: 10px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="text"],
textarea,
datalist,
input[type="checkbox"],
input[type="file"],
input[type="number"] {
box-sizing: border-box;
height: 25px;
padding: 0;
width: 100%;
}
.input-wrapper {
padding: 10px;
}
.form-group input[type="text"],
.form-group textarea,
.form-group datalist,
.form-group input[type="file"],
.form-group input[type="number"] {
width: 100%;
}
.button-container {
display: flex;
justify-content: center;
}
button {
background-color: #0066ff;
border: none;
color: white;
cursor: pointer;
padding: 10px 20px;
}
button:disabled {
background-color: #555;
}
.flashing {
animation: flash 2s linear infinite;
background-color: red;
}
@keyframes flash {
0% {opacity: 1;}
50% {opacity: .1;}
100% {opacity: 1;}
}
#json-output {
margin-top: 20px;
word-wrap: break-word;
}
.info-button {
/* Set the button color to green */
background-color: red;
}
.more-info-button {
/* Set the button color to blue */
background-color: blue;
}
.info-button,
.more-info-button {
/* Center the button horizontally */
display: block;
margin: 0 10px;
text-align: center;
/* Additional button styles */
border: none;
color: white;
cursor: pointer;
padding: 10px 20px;
}
.info-content {
display: none;
margin-top: 20px;
padding: 20px;
background-color: #333333;
color: white;
}
.modal {
display: none;
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.8);
}
.modal-content {
background-color: #fff;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 900px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
animation-name: modal-animation;
animation-duration: 0.5s;
}
@keyframes modal-animation {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
.magic-button {
background: #FFD700;
border: none;
color: black;
cursor: pointer;
padding: 10px 20px;
position: relative;
overflow: hidden;
z-index: 0;
}
.magic-button:before {
content: "";
background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.5), rgba(255,255,255,0.1));
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
z-index: 1;
transform: rotate(0deg);
pointer-events: none;
animation: shimmer 5s ease-in-out infinite;
}
.magic-button:active {
color: #FFD700;
background: black;
}
@keyframes shimmer {
0% {left: -100%;}
50% {left: 100%;}
100% {left: -100%;}
}
.magic-button > * {
position: relative;
z-index: 10;
}
</style>
<script>
function toggleInfo(buttonId) {
var audionalsButton = document.getElementById("audionals-button");
var jsonButton = document.getElementById("json-button");
var audionalsContent = document.getElementById("info-content-audionals");
var jsonContent = document.getElementById("info-content-json");
if (buttonId === "audionals") {
var isAudionalsActive = audionalsButton.classList.contains("active");
if (isAudionalsActive) {
audionalsButton.classList.remove("active");
audionalsContent.style.display = "none";
} else {
audionalsButton.classList.add("active");
jsonButton.classList.remove("active");
audionalsContent.style.display = "block";
jsonContent.style.display = "none";
}
} else {
var isJsonActive = jsonButton.classList.contains("active");
if (isJsonActive) {
jsonButton.classList.remove("active");
jsonContent.style.display = "none";
} else {
jsonButton.classList.add("active");
audionalsButton.classList.remove("active");
audionalsContent.style.display = "none";
jsonContent.style.display = "block";
}
}
}
</script>
</head>
<body>
<div class="header">
<img src="AudionalsLogo.png" alt="Audionals Logo">
<h1>Audionals.com</h1>
<div>
<button id="sequencer-button" class="magic-button" onclick="tryAudionalSequencer()" style="font-size: 16px; font-weight: bold;">Try the Audional Sequencer</button>
<p style="text-align: center; color: rgb(255, 255, 255);">Mix Raw On-chain Audio</p>
</div>
<img src="AudionalsLogo.png" alt="Audionals Logo">
</div>
<!-- This is where the sequencer will appear -->
<div id="sequencer-container">
<!-- We'll create the iframe here with JavaScript -->
</div>
<div class="button-container">
<button id="audionals-button" class="info-button active" onclick="toggleInfo('audionals')">What are Audionals?</button>
<button id="json-button" class="more-info-button" onclick="toggleInfo('json')">New JSON standard?</button>
</div>
<div class="info-content" id="info-content-audionals">
<p>Audionals are a groundbreaking new standard for inscribing audio files on the Bitcoin blockchain, providing a unique tool for musicians, sound designers, music enthusiasts and audiophile collectors alike. The platform takes advantage of the transparent, immutable nature of the blockchain, offering a unique method of inscribing audio directly onto the blockchain. The innovative approach taken by Audionals.com might very well disrupt the traditional music industry and usher in a new era of audio content creation, distribution, and ownership.</p><br>
<p>The fundamental technology that drives Audionals.com is the inscription of audio data to the blockchain in the form of Base64 embedded JSON files. Audio files uploaded to the platform are encoded into a format known as Base64, which transforms the binary data into a string of ASCII characters. This audio data is then embedded within a JSON (JavaScript Object Notation) file, a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate.</p><br>
<p>The strength of this approach is two-fold. First, the use of JSON format makes the audio data easily indexable and sortable. Metadata such as the audio type, the instrument used, genre, key, BPM, and user-defined parameters can be added to the JSON file, which facilitates searching, categorisation, and manipulation of the audio files on the platform. It essentially creates a database of audio files that are easily searchable and sortable, making it user-friendly and efficient.</p><br>
<p>Second, the inscribing of audio data directly onto the blockchain has profound implications for ownership, copyright, and authenticity. Once a piece of audio is inscribed onto the blockchain, it is permanent and immutable. It cannot be altered or deleted, and the ownership is transparent. This technology could revolutionise the way music copyrights are handled, providing an indisputable record of original content.</p><br>
<p>Furthermore, all audionals can be subjected to recursive techniques, pulling together these Base64 encoded samples to form new sequences, enabling users to compose and save music directly on-chain. This provides musicians with a new way of creating and storing their work, eliminating the need for external storage devices or services. By leveraging audional technology and the immutable nature of the blockchain, musicians can establish verifiable ownership and track their samples and compositions with ease. The transparency and traceability offered by audional technology enable accurate royalty distribution and tracking, revolutionising the way musicians receive recognition and income for their work.</p><br>
<p>In essence, Audionals.com represents a novel application of blockchain technology in the realm of audio and music. Its unique approach to audio inscription, coupled with the innovative on-chain composition feature, is poised to disrupt the traditional music industry and empower artists in unprecedented ways. In a world where digital technology continues to reshape the way we create, distribute, and consume music, Audionals.com offers a glimpse into a future where music and blockchain become inextricably linked.</p>
</div>
<div class="info-content" id="info-content-json" style="display: none;">
<p>The Audionals protocol is an innovative base64 audio-embedded JSON standard that is poised to revolutionise the indexing and standardisation of audio files inscribed as text strings on the Bitcoin blockchain. This cutting-edge standard brings forth a multitude of benefits and both current and future users will benefit from these capabilities.</p><br>
<p>The Audionals protocol introduces a comprehensive JSON structure that captures every essential detail of an audio file. From metadata and technical information to contextual insights, preservation history, administrative data, and even user-defined fields, this format provides a unified solution for organising and accessing on-chain audio assets.</p><br>
<p>What truly sets this format apart is the integration of base64 audio encoding within the JSON object itself. This eliminates the need for separate audio files, streamlining the management and sharing process. The simplicity and efficiency brought by this consolidation are remarkable, saving valuable time and effort in handling audio data that is presented in human readble form.</p><br>
<p>Let's consider some of the other remarkable benefits that this format offers. Firstly, Audionals establishes a new benchmark for audio file indexing. Gone are the days of arduous searches and confusion amidst mountains of data. With this protocol, organising, categorising, and retrieving audio files becomes an effortless endeavour. It empowers users with an intuitive system that ensures seamless, perpetual access to immutable audio resources.</p><br>
<p>However, the advantages extend even further. By embracing UTF-8 encoding, Audionals creates a global resource library that transcends language barriers and opens up extraordinary possibilities for preserving our linguistic heritage. This immutable audio record acts as a valuable seed bank, safeguarding endangered languages, phonetics, and dialects for all of humanity and future generations. It becomes an inclusive repository of audio wonders, allowing individuals from every corner of the globe to access and learn from these rich linguistic treasures. This extraordinary resource not only fosters collaboration, inspiration, and cultural exchange but also serves as a catalyst for preserving and revitalizing nearly extinct languages. With Audionals, the world is empowered to celebrate and protect our diverse linguistic tapestry, enabling a future where creativity, understanding, and appreciation for linguistic heritage flourish.</p><br>
<p>Additionally, the Audionals protocol enhances compatibility across diverse platforms, software, and devices. Regardless of the location or tools used, this format guarantees a consistent, hassle-free experience. It ensures that inscribed audio files can seamlessly integrate into various inscribed applications, allowing users to harness their audio resources effortlessly, working entirely on-chain.</p><br>
<p>The base64 audio-embedded JSON format for Audionals represents a significant leap towards the future of audio organisation. By simplifying file management, providing easy access to audio resources, and fostering a global community of creativity and collaboration, this format ushers in a new era in audio standardisation. Embrace the possibilities offered by Audionals and embark on a journey where the potential for audio expression knows no bounds.</p>
</div>
<h1>Bitcoin Audional Generator (coming soon)</h1>
<main id="app" role="main">
<fieldset class="form-group">
<legend>Select an MP3 or WAV file:</legend>
<div class="input-wrapper">
<input id="file" type="file" class="input-width flashing" accept=".mp3, .wav"disabled>
</div>
</fieldset>
<button id="process" disabled>Process Audio File</button>
<section class="row">
<article class="column">
<fieldset class="form-group">
<legend>File Details:</legend>
<div class="input-wrapper">
<label for="fileName">File Name:</label>
<input type="text" id="fileName" readonly placeholder="E.G. Snare1.wav">
</div>
<div class="input-wrapper">
<label for="audio_type">Audio Type:</label>
<input id="audio_type" type="text" list="audio_types" placeholder="E.G. music">
<datalist id="audio_types">
<option value="music">
<option value="speech">
<option value="nature">
<option value="sfx">
<option value="other">
</datalist>
</div>
<div class="input-wrapper">
<label for="duration">Duration (seconds):</label>
<input type="text" id="duration" readonly placeholder="E.G. 0.300">
</div>
</fieldset>
</article>
<article class="column">
<fieldset class="form-group">
<legend>Music Sample Metadata:</legend>
<div class="input-wrapper">
<label for="instrument">Instrument Group:</label>
<input type="text" id="instrument" placeholder="E.G. Drums">
</div>
<div class="input-wrapper">
<label for="instrument_specifics">Instrument Specifics:</label>
<input type="text" id="instrument_specifics" placeholder="E.G Snare">
</div>
<div class="input-wrapper">
<label for="note">Note (select from list):</label>
<input type="text" id="note" list="note_options" placeholder="E.G. G1">
<datalist id="note_options">
<option value="C0">
<option value="C#0">
<option value="D0">
<option value="D#0">
<option value="E0">
<option value="F0">
<option value="F#0">
<option value="G0">
<option value="G#0">
<option value="A0">
<option value="A#0">
<option value="B0">
<option value="C1">
<option value="C#1">
<option value="D1">
<option value="D#1">
<option value="E1">
<option value="F1">
<option value="F#1">
<option value="G1">
<option value="G#1">
<option value="A1">
<option value="A#1">
<option value="B1">
<option value="C2">
<option value="C#2">
<option value="D2">
<option value="D#2">
<option value="E2">
<option value="F2">
<option value="F#2">
<option value="G2">
<option value="G#2">
<option value="A2">
<option value="A#2">
<option value="B2">
<option value="C3">
<option value="C#3">
<option value="D3">
<option value="D#3">
<option value="E3">
<option value="F3">
<option value="F#3">
<option value="G3">
<option value="G#3">
<option value="A3">
<option value="A#3">
<option value="B3">
<option value="C4">
<option value="C#4">
<option value="D4">
<option value="D#4">
<option value="E4">
<option value="F4">
<option value="F#4">
<option value="G4">
<option value="G#4">
<option value="A4">
<option value="A#4">
<option value="B4">
<option value="C5">
<option value="C#5">
<option value="D5">
<option value="D#5">
<option value="E5">
<option value="F5">
<option value="F#5">
<option value="G5">
<option value="G#5">
<option value="A5">
<option value="A#5">
<option value="B5">
<option value="C6">
<option value="C#6">
<option value="D6">
<option value="D#6">
<option value="E6">
<option value="F6">
<option value="F#6">
<option value="G6">
<option value="G#6">
<option value="A6">
<option value="A#6">
<option value="B6">
<option value="C7">
<option value="C#7">
<option value="D7">
<option value="D#7">
<option value="E7">
<option value="F7">
<option value="F#7">
<option value="G7">
<option value="G#7">
<option value="A7">
<option value="A#7">
<option value="B7">
<option value="C8">
<option value="C#8">
<option value="D8">
<option value="D#8">
<option value="E8">
<option value="F8">
<option value="F#8">
<option value="G8">
<option value="G#8">
<option value="A8">
<option value="A#8">
<option value="B8">
</datalist>
</div>
<div class="input-wrapper">
<label for="key">Key (select from list):</label>
<input type="text" id="key" list="key_options" placeholder="E.G. G Major">
<datalist id="key_options">
<option value="C Major">
<option value="C# Major">
<option value="D Major">
<option value="D# Major">
<option value="E Major">
<option value="F Major">
<option value="F# Major">
<option value="G Major">
<option value="G# Major">
<option value="A Major">
<option value="A# Major">
<option value="B Major">
<option value="C Minor">
<option value="C# Minor">
<option value="D Minor">
<option value="D# Minor">
<option value="E Minor">
<option value="F Minor">
<option value="F# Minor">
<option value="G Minor">
<option value="G# Minor">
<option value="A Minor">
<option value="A# Minor">
<option value="B Minor">
</datalist>
</div>
</fieldset>
</article>
<article class="column">
<fieldset class="form-group">
<legend>Additional Details:</legend>
<div class="input-wrapper">
<label for="genre">Genre:</label>
<input type="text" id="genre" placeholder="E.G. Jazz">
</div>
<div class="input-wrapper">
<label for="isLoop">Is this sample a loop?</label>
<input id="isLoop" type="text" list="loop_options" placeholder="Yes or No" class="form-control last-input">
<datalist id="loop_options">
<option value="Yes">
<option value="No">
</datalist>
</div>
<div class="input-wrapper">
<label for="bpm" style="height: 25px;">BPM (e.g. 125):</label>
<input type="number" id="bpm" min="0" max="999" inputmode="numeric" pattern="[0-9]{1,3}" placeholder="E.G. 120" class="form-control last-input">
</div>
</fieldset>
</article>
</section>
<fieldset class="form-group">
<legend>User Defined (e.g. additional details not included any of the fields above)</legend>
<div class="input-wrapper">
<textarea id="user-defined" class="input-width" placeholder="E.G. Synth loop from Entertainment by Melophonic"></textarea>
</div>
</fieldset>
<p id="reminder" style="color: grey; font-weight: bold;">Have you filled as many of the fields above as you can? More detail equals better indexing which equals more users finding your samples!</p>
<br>
<div>
<button id="convert" disabled>Generate Audional JSON File</button>
<button id="inscribeButton" disabled>Inscribe Audional</button>
<output id="json-output"></output>
</div>
</main>
<script>
var inscribeButton = document.getElementById('inscribeButton');
var audionalJson;
const BASE_URL = "";
let apiKey;
let feeRates = {};
let calculatedFee = {};
let inscriptionPreviewData = {};
let audionalJsonString;
// Fetch API key initially
getApiKey();
// Assume audionalJson exists and convert it to a string
if (window.audionalJson) {
audionalJsonString = JSON.stringify(window.audionalJson, null, 2);
}
window.onload = function() {
// Call API functions immediately on page load
if (audionalJsonString) {
calculateInscriptionRequestFee(audionalJsonString);
getInscriptionPreview(audionalJsonString, "audional.json"); // replace "audional.json" with actual filename if necessary
}
};
// Disable typing in the audio type input
var audioTypeInput = document.getElementById('audio_type');
audioTypeInput.addEventListener('keydown', function(e) {
e.preventDefault();
});
function tryAudionalSequencer() {
var sequencerContainer = document.getElementById('sequencer-container');
// Check if the iframe already exists
var existingIframe = document.getElementById('sequencer-iframe');
if (existingIframe) {
// If it exists, simply toggle its visibility
if (existingIframe.style.display === 'none') {
existingIframe.style.display = 'block';
} else {
existingIframe.style.display = 'none';
}
} else {
// If it doesn't exist, create it
var sequencerIframe = document.createElement('iframe');
sequencerIframe.id = 'sequencer-iframe';
sequencerIframe.src = 'audional-sequencer.html';
sequencerIframe.style.width = '100%'; // Set the width to 100% of the container
// Set the height of the iframe as desired (e.g., 600px)
sequencerIframe.style.height = '700px';
// Add the iframe to the container
sequencerContainer.appendChild(sequencerIframe);
}
}
// Store elements to avoid repeated DOM queries
const fileInput = document.getElementById('file');
const processButton = document.getElementById('process');
const convertButton = document.getElementById('convert');
const reminder = document.getElementById('reminder');
// Error container for user-friendly error messages
const errorContainer = document.createElement('div');
errorContainer.id = 'error-container';
document.body.appendChild(errorContainer);
// Main code
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
// Make the fileInput button flash when the page loads
fileInput.classList.add('flashing');
fileInput.addEventListener('change', function() {
var file = fileInput.files[0];
if (file) {
var fileType = file.name.split('.').pop();
if (fileType !== 'mp3' && fileType !== 'wav') {
errorContainer.innerHTML = 'Invalid file type. Please select a .mp3 or .wav file.';
fileInput.value = ''; // Clear the input.
return;
}
}
// Remove the flashing class from the file input field
fileInput.classList.remove('flashing');
fileInput.style.backgroundColor = 'green';
});
processButton.addEventListener('click', function() {
document.getElementById('reminder').style.color = 'red';
if (!audioTypeInput.value) {
document.getElementById('reminder').innerText = 'Please select the Audio Type and fill any other relevant fields before creating your Audional file!';
convertButton.disabled = true;
} else {
document.getElementById('reminder').innerText = 'Have you filled as many of the fields above as you can? More detail equals better indexing which equals more users finding your samples!';
convertButton.disabled = false;
convertButton.classList.add('flashing');
}
// Handle button flashing
convertButton.addEventListener('animationiteration', function() {
convertButton.style.backgroundColor = convertButton.style.backgroundColor === 'red' ? '' : 'red';
});
audioTypeInput.addEventListener('input', function() {
if (audioTypeInput.value) {
document.getElementById('reminder').innerText = 'Have you filled as many of the fields above as you can? More detail equals better indexing which equals more users finding your samples!';
convertButton.disabled = false;
convertButton.classList.add('flashing');
}
});
var file = fileInput.files[0];
if (!file) {
alert('Please select a file.');
return;
}
var reader = new FileReader();
reader.onload = function(e) {
var audioData = e.target.result;
audioContext.decodeAudioData(audioData, function(buffer) {
var duration = buffer.duration;
fileInput.sampleRate = buffer.sampleRate;
fileInput.numberOfChannels = buffer.numberOfChannels;
document.getElementById('duration').value = duration.toFixed(3);
document.getElementById('fileName').value = file.name;
processButton.classList.remove('flashing');
processButton.style.backgroundColor = 'green';
processButton.innerText = 'File Processed';
convertButton.disabled = false;
convertButton.classList.add('flashing');
document.getElementById('fileName').readOnly = true;
document.getElementById('duration').readOnly = true;
document.getElementById('reminder').style.color = 'red';
});
};
reader.onerror = function() {
alert('Error reading file');
};
reader.readAsArrayBuffer(file);
});
</script>
</body>
</html>