added/fixed radioactive.php and web-audio tool for recording contributor's voices

master
Angeliki 5 years ago
parent 10ba2aa2f3
commit 1d1de18988

@ -20,3 +20,24 @@ sudo apt-get install ffmpeg
## Srttojs ## Srttojs
python3 srttojs.py description-alex1-A.srt python3 srttojs.py description-alex1-A.srt
# eaiaiaiaoi
Give access to apache for uploading audio through php
`sudo chown www-data:www-data /uploads/`
## record and save user's microphone
Updated script: https://developers.google.com/web/fundamentals/media/recording-audio
errors:
https://stackoverflow.com/questions/34215937/getusermedia-not-supported-in-chrome
Chrome finally implemented the new navigator.mediaDevices.getUserMedia() method, but they added a security that will prevent the calls from unsecure address (non https or non localhost servers)
You will call it like this :
var video = document.querySelector('video');
navigator.mediaDevices.getUserMedia({video:true}).then(function(mediaStream){
window.stream = mediaStream;
video.src = URL.createObjectURL(mediaStream);
video.play();
});

@ -44,6 +44,7 @@ window.onclick2 = function(event) {
// <!-- scripts for the soundwalk player--> // <!-- scripts for the soundwalk player-->
var a1 = document.getElementById("a1"), var a1 = document.getElementById("a1"),
a2 = document.getElementById("a2"), a2 = document.getElementById("a2"),
but = document.getElementById("but"); but = document.getElementById("but");

@ -333,6 +333,10 @@
<li id="katalin"> <li id="katalin">
<a href="#" >Vocal performance of Katalin Ladik in the film Berberian Sound Studio, 2012</a> <a href="#" >Vocal performance of Katalin Ladik in the film Berberian Sound Studio, 2012</a>
</li>
<li id="shrill">
<a href="https://www.newyorker.com/culture/cultural-comment/a-century-of-shrill-how-bias-in-technology-has-hurt-womens-voices" target="_blank" >Tallon, T. (2020) A Century of “Shrill”: How Bias in Technology Has Hurt Womens Voices, The New Yorker</a>
</li> </li>
</div> </div>

@ -181,6 +181,17 @@ echo '<br /><a href='.$num.' download='.$var1.'>download</a></div></td>'; } ?>
navigator.webkitGetUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.mozGetUserMedia ||
navigator.msGetUserMedia); navigator.msGetUserMedia);
if (typeof navigator.mediaDevices.getUserMedia === 'undefined') {
navigator.getUserMedia({
audio: true
}, streamHandler, errorHandler);
} else {
navigator.mediaDevices.getUserMedia({
audio: true
}).then(streamHandler).catch(errorHandler);
}
window.URL = window.URL || window.webkitURL; window.URL = window.URL || window.webkitURL;
var audio_context = new AudioContext; var audio_context = new AudioContext;

@ -0,0 +1,314 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="styles/widescreen.css" rel="stylesheet" type="text/css">
<!-- <link href="styles/smallscreen.css" rel="stylesheet" type="text/css"> -->
<title>Podcast1</title>
<link rel="shortcut icon" href="images/headphones_logo.png" />
<style>
h3 {font-weight: normal !important}
a {
text-decoration: none;
color: #A19696;
}
</style>
</head>
<body>
<!-- draggable -->
<br><br>
<!-- <h1 id="box-title" style="left: 45%; position: absolute;">
Mediating Speech
</h1>
-->
<!-- draggable menu-->
<div class="draggable scaleable-wrapper menu" style="top: 110%; right: 3%;">
<h2><a href="amplification.php">Amplification of female voices</a></h2>
<div class="drag-content">
(workshops)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 130%; right: 7%;">
<h2 ><a href="diary.php">Diary of West Rotterdam</a></h2>
<div class="drag-content">
(first experiments)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 90%; right: 5%;">
<h2 ><a href="player.php">Player<div class="hover-icon-speaker"><img src="images/icon-speaker.png"></div></a></h2>
<div class="drag-content">
(audio archive)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 83%; left: 2%;">
<h2 ><a href="index.php">About</a></h2>
<div class="drag-content">
(main page)
</div>
</div>
<div class="draggable scaleable-wrapper active-draggable" style="top: 3%; right: 26%">
<h2 ><a class="active" href="podcast1.php">"Mediating Speech"</a></h2>
<div class="drag-content">
<?php include 'texts/podcast1.txt'; ?>
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 34%; right: 5%">
<h2 ><a href="podcast2.php">"Voice's Transition"<div class="hover-icon"><img src="images/icon-play.png"></div></a></h2>
<div class="drag-content">
(podcast)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 49%; right: 3%">
<h2 ><a href="podcast3.php">"Blocking our Voices"<div class="hover-icon"><img src="images/icon-play.png"></div></a></h2>
<div class="drag-content">
(podcast)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 110%; left: 1%;">
<h2 ><a href="thesis-angeliki.php">"Let' s Talk About Unspeakable Things"</a></h2>
<div class="drag-content">
(thesis)
</div>
</div>
<br><br><br><br><br><br>
<table>
<tr>
<td></td>
<td><h3 style="text-align: left !important">EPISODES</h3></td>
</tr>
<tr>
<td><img src="images/headphones_logo.png" width="40px"></td>
<?php
// ini_set('display_errors',1);
// ini_set('display_startup_errors',1);
// error_reporting(E_ALL);
$files = glob("podcasts/podcast1/*.mp3");
for ($i=0; $i<count($files); $i++)
{$num = $files[$i];
$var1 = $_GET["files"]["name"];
echo '<td><audio src='.$num.' controls></audio>';
echo '<div class="tooltip-wrap" style="left:1%; top:-10px;"><img src="images/plus-icon.png" width="20px"><div class="tooltip-content-down content-transcription"><div class="left_col"><h3>NARRATOR</h3>';include $num.'.txt';
echo '</div><div class="right_col"><h3>SPEAKERS</h3>'; include $num.'-M.txt';
echo '</div></div></div>';
echo '<div style="font-size:14px;line-height:1;text-align: left;max-width:280px;">';
include $num.'-METADATA.txt';
echo '<br /><a href='.$num.' download='.$var1.'>download</a></div></td>'; } ?>
</tr></table>
<br>
<div align="center">
<?php include 'texts/dear_listener.txt'; ?>
<!-- recorder -->
<div class="recorder">
<input type="button" class="start" value="Record" />
<input type="button" class="stop" value="Stop" />
<pre class="status"></pre>
</div>
<div id="playerContainer"></div>
<br />
<div><button id="button_upload" onclick="upload()">Upload</button></div>
<br />
<div id="saved_msg"></div>
<div id="dataUrlcontainer" hidden></div>
<pre id="log" hidden></pre>
<h3>VISITORS' VOICES</h3><br />
<?php
$items=array();
$handle=fopen('./uploads/1/index.jsons','r');
if ($handle) {
while (($line=fgets($handle)) !== false) {
$item=json_decode($line,true);
$items[]=$item;
}
}
$items=array_reverse($items);
foreach($items as $item) {
$url=substr($item['file'],3);
echo '<div class=file>';
echo '<audio src='.$url.' controls></audio><br />';
echo '<div class="filename">'.$item['name'].'</div>';
echo '<div class="file_date">'.$item['date'].'</div>';
echo '</div><br />';
}
?>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/mp3recorder.js"></script>
<script src="js/draggable.js"></script>
<script src="js/jquery-1.12.4.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.ui.touch-punch.min.js"></script>
<script src="js/main.js"></script>
<!-- scripts for recorder -->
<script type="text/javascript">
var audio_context;
function __log(e, data) {
log.innerHTML += "\n" + e + " " + (data || '');
}
$(function() {
try {
// webkit shim
window.AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
if (typeof navigator.mediaDevices.getUserMedia === 'undefined') {
navigator.getUserMedia({
audio: true
}, streamHandler, errorHandler);
} else {
= navigator.mediaDevices.getUserMedia({
audio: true
}).then(streamHandler).catch(errorHandler);
}
window.URL = window.URL || window.webkitURL;
var audio_context = new AudioContext;
__log('Audio context set up.');
__log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
} catch (e) {
alert('No web audio support in this browser!');
}
$('.recorder .start').on('click', function() {
$this = $(this);
$recorder = $this.parent();
navigator.getUserMedia({audio: true}, function(stream) {
var recorderObject = new MP3Recorder(audio_context, stream, { statusContainer: $recorder.find('.status'), statusMethod: 'replace' });
$recorder.data('recorderObject', recorderObject);
recorderObject.start();
}, function(e) { });
});
document.getElementById("button_upload").style.display='none';
$('.recorder .stop').on('click', function() {
$this = $(this);
$recorder = $this.parent();
recorderObject = $recorder.data('recorderObject');
recorderObject.stop();
recorderObject.exportMP3(function(base64_data) {
var url = 'data:audio/mp3;base64,' + base64_data;
var au = document.createElement('audio');
document.getElementById("playerContainer").innerHTML = "";
// console.log(url)
document.getElementById("button_upload").style.display='block';
var duc = document.getElementById("dataUrlcontainer");
duc.innerHTML = url;
au.controls = true;
au.src = url;
//$recorder.append(au);
// $('#playerContainer').append($('<input'));
$('#playerContainer').append(au);
recorderObject.logStatus('');
});
});
});
</script>
<script>
function upload(){
var name = prompt('Enter a title or/and your name','Unnamed clip');
var dataURL = document.getElementById("dataUrlcontainer").innerHTML;
$.ajax({
type: "POST",
url: "scripts/uploadMp3_1.php",
data: {
base64: dataURL,
name: name
}
}).done(function(o) {
console.log('saved');
document.getElementById("saved_msg").innerHTML = "Uploaded!! Refresh and see your voice message in the list below :<";
});
// var person = prompt("Enter a title or a name");
// if (person != null) {
// document.getElementById("name").innerHTML =
// person;
}
// }
</script>
<!-- script for subs and sound -->
<script>
var dialogueTimings = [10,24,28,58,115,120,124,134,138,142,152,160],
dialogues = document.querySelectorAll('#transcript>div'),
transcriptWrapper = document.querySelector('#transcriptWrapper'),
audio = document.querySelector('#a2'),
previousDialogueTime = -1;
function playTranscript() {
var currentDialogueTime = Math.max.apply(Math, dialogueTimings.filter(function(v){return v <= audio.currentTime}));
if(previousDialogueTime !== currentDialogueTime) {
previousDialogueTime = currentDialogueTime;
var currentDialogue = dialogues[dialogueTimings.indexOf(currentDialogueTime)];
transcriptWrapper.scrollTop = currentDialogue.offsetTop - 50;
var previousDialogue = document.getElementsByClassName('speaking')[0];
if(previousDialogue !== undefined)
previousDialogue.className = previousDialogue.className.replace('speaking','');
currentDialogue.className +=' speaking';
}
}
;
</script>
</body>
</html>

@ -0,0 +1,219 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="styles/widescreen.css" rel="stylesheet" type="text/css">
<!-- <link href="styles/smallscreen.css" rel="stylesheet" type="text/css"> -->
<title>Radioactive Monstrosity</title>
<link rel="shortcut icon" href="images/headphones_logo.png" />
<style>
h3 {font-weight: normal !important}
a {
text-decoration: none;
color: #A19696;
}
</style>
</head>
<body>
<!-- draggable -->
<br><br>
<!-- <h1 id="box-title" style="left: 45%; position: absolute;">
Voice's Transition
</h1> -->
<!-- draggable menu-->
<div class="draggable scaleable-wrapper menu" style="top: 110%; right: 3%;">
<h2><a href="amplification.php">Amplification of female voices</a></h2>
<div class="drag-content">
(workshops)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 90%; right: 5%;">
<h2 ><a href="player.php">Player<div class="hover-icon-speaker"><img src="images/icon-speaker.png"></div></a></h2>
<div class="drag-content">
(audio archive)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 83%; left: 2%;">
<h2 ><a href="index.php">About</a></h2>
<div class="drag-content">
(main page)
</div>
</div>
<div class="draggable scaleable-wrapper menu" style="top: 110%; left: 1%;">
<h2 ><a href="thesis-angeliki.php">"Let' s Talk About Unspeakable Things"</a></h2>
<div class="drag-content">
(thesis)
</div>
</div>
<br><br><br><br><br>
<div align="center">
<?php include 'texts/radioactive_contribution.txt'; ?>
<!-- recorder -->
<div class="recorder">
<input type="button" class="start" value="Record" />
<input type="button" class="stop" value="Stop" />
<pre class="status"></pre>
</div>
<div id="playerContainer"></div>
<br />
<div><button id="button_upload" onclick="upload()">Upload</button></div>
<br />
<div id="saved_msg"></div>
<div id="dataUrlcontainer" hidden></div>
<pre id="log" hidden></pre>
<h3>VISITORS' VOICES</h3>
<?php
$items=array();
$handle=fopen('./uploads/5/index.jsons','r');
if ($handle) {
while (($line=fgets($handle)) !== false) {
$item=json_decode($line,true);
$items[]=$item;
}
}
$items=array_reverse($items);
foreach($items as $item) {
$url=substr($item['file'],3);
echo '<div class=file>';
echo '<audio src='.$url.' controls></audio><br />';
echo '<div class="filename">'.$item['name'].'</div>';
echo '<div class="file_date">'.$item['date'].'</div>';
echo '<div class="file_type">'.$item['type'].'</div>';
echo '</div><br />';
}
?>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/mp3recorder.js"></script>
<script src="js/draggable.js"></script>
<script src="js/jquery-1.12.4.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.ui.touch-punch.min.js"></script>
<script src="js/main.js"></script>
<!-- scripts for recorder -->
<script type="text/javascript">
var audio_context;
function __log(e, data) {
log.innerHTML += "\n" + e + " " + (data || '');
}
$(function() {
try {
// webkit shim
window.AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
window.URL = window.URL || window.webkitURL;
var audio_context = new AudioContext;
__log('Audio context set up.');
__log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
} catch (e) {
alert('No web audio support in this browser!');
}
$('.recorder .start').on('click', function() {
$this = $(this);
$recorder = $this.parent();
navigator.getUserMedia({audio: true}, function(stream) {
var recorderObject = new MP3Recorder(audio_context, stream, { statusContainer: $recorder.find('.status'), statusMethod: 'replace' });
$recorder.data('recorderObject', recorderObject);
recorderObject.start();
}, function(e) { });
});
document.getElementById("button_upload").style.display='none';
$('.recorder .stop').on('click', function() {
$this = $(this);
$recorder = $this.parent();
recorderObject = $recorder.data('recorderObject');
recorderObject.stop();
recorderObject.exportMP3(function(base64_data) {
var url = 'data:audio/mp3;base64,' + base64_data;
var au = document.createElement('audio');
document.getElementById("playerContainer").innerHTML = "";
// console.log(url)
document.getElementById("button_upload").style.display='block';
var duc = document.getElementById("dataUrlcontainer");
duc.innerHTML = url;
au.controls = true;
au.src = url;
//$recorder.append(au);
$('#playerContainer').append(au);
recorderObject.logStatus('');
});
});
});
</script>
<script>
function upload(){
var name = prompt('Enter a title or/and your name','Unnamed clip');
var type = prompt('Enter type of distortion','No Type');
var dataURL = document.getElementById("dataUrlcontainer").innerHTML;
$.ajax({
type: "POST",
url: "scripts/uploadMp3_5.php",
data: {
base64: dataURL,
name: name,
type: type
}
}).done(function(o) {
console.log('saved');
document.getElementById("saved_msg").innerHTML = "Uploaded!! Refresh and see your voice message in the list below :<";
});
}
</script>
</body>
</html>

@ -0,0 +1,20 @@
<?php
error_reporting(-1);
ini_set("display_errors", "On");
// requires php5
define('UPLOAD_DIR', '../uploads/5/');
$img = $_POST['base64'];
$img = str_replace('data:audio/mp3;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
#$file = UPLOAD_DIR . uniqid() . '.mp3';
$file = UPLOAD_DIR . $_POST['name'] . '_'.$_POST['type'] .'.mp3';
$success = file_put_contents($file, $data);
# make a database of recordings
$item=array('name'=>$_POST['name'],'type'=>$_POST['type'],'date'=>date("d/m/Y"), 'file'=>$file);
$handle=fopen('../uploads/5/index.jsons','a');
fwrite($handle,json_encode($item)."\n");
fclose($handle);
print $success ? $file : 'Unable to save the file.';
?>

@ -0,0 +1,20 @@
<div style="background-color: white; width: 500px;border:1px red;border-style: dashed;padding:
10px;">
<p>Dear listener,</p>
you are invited to <div class="tooltip-wrap">amplify</div> contribute with
your own voice to a collection of voices
<a href="amplification.php"
class="underline" target="_blank"></a>
<p>Maximum duration: 1 min</p>
<p>Best recorded from a computer</p>
<p><a href="images/letter-20190704.jpg" class="underline" target="_blank">Something like a Privacy Policy</a></p>
<ul>
<li>is your voice valid?</li>
<li>how does your voice sound like?</li>
<li>is your voice being interrupted often?</li>
<li>what is the gender of your voice?</li>
<li>is it in low-pitch or high-pitch?</li>
<li>had you ever had to transform or change the quality of your voice?</li>
<li>does this voice represent you?</li>
</ul>

@ -0,0 +1,9 @@
<div style="background-color: white; width: 500px;border:1px
red;border-style: dashed;padding: 10px;">
<p>Dear listener,</p>
you are invited to <div class="tooltip-wrap">amplify</div> parts of the podcasts that you find worthy of attention by listening, recording and repeating them, with your own voice, and upload them in the archive. The stories and sounds, you will listen to, are related to how female voices have been marginalised and what methods (rational/irrational) amplify and bring them in the front. Amplification can happen through repetition and multiplication. Your recording becomes part of a gathering of multiple individual voices, that repeat fragments of situations and things that are unspeakable, and can appear as feedback to them. Your voice, no matter what gender, with its own quality and uniqueness will channel these fragmented female voices. This audio collection may be, then, used as an input for <a href="amplification.php" class="underline" target="_blank">workshops</a>.
<p>Maximum duration: 1 min</p>
<p>Best recorded from a computer</p>
<p><a href="images/letter-20190704.jpg" class="underline" target="_blank">Something like a Privacy Policy</a></p>

@ -0,0 +1 @@
Subproject commit 3d9dee2cd294eb58d46c31b17855f2ceee5cde21
Loading…
Cancel
Save