
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (107)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (6372)
-
Revision 36037 : s’assurer que la class ffmpeg_movie est disponible sinon cela ne sert pas ...
9 mars 2010, par kent1@… — Logs’assurer que la class ffmpeg_movie est disponible sinon cela ne sert pas à grand chose
-
Detect volume via mic, start recording, end on silence, transcribe and sent to endpoint
15 juin 2023, par alphadmonI have been attempting to get this to work in many ways but I can't seem to get it right. Most of the time I get a part of it to work and then when I try to make other parts work, I generally break other things.


I am intercepting the volume coming from the mic and if it is louder than 50, I start a recording. I then keep recording until there is a silence, if the silence is equal to 5 seconds I then stop the recording.


I then send the recording to be transcribed by
whisper
using OpenAI API.

Once that is returned, I then want to send it to the open ai chat end point and get the response.


After that, I would like to start listening again.


Here is what I have that is sort of working so far, but the recording is an empty file always :


// DETECT SPEECH
const recorder = require('node-record-lpcm16');

// TRANSCRIBE
const fs = require("fs");
const ffmpeg = require("fluent-ffmpeg");
const mic = require("mic");
const { Readable } = require("stream");
const ffmpegPath = require("@ffmpeg-installer/ffmpeg").path;
require('dotenv').config();

// CHAT
const { Configuration, OpenAIApi } = require("openai");

// OPEN AI
const configuration = new Configuration({
 organization: process.env.OPENAI_ORG,
 apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);

// SETUP
ffmpeg.setFfmpegPath(ffmpegPath);

// VARS
let isRecording = false;
const audioFilename = 'recorded_audio.wav';
const micInstance = mic({
 rate: '16000',
 channels: '1',
 fileType: 'wav',
});

// DETECT SPEECH
const file = fs.createWriteStream('determine_speech.wav', { encoding: 'binary' });
const recording = recorder.record();
recording.stream().pipe(file);


recording.stream().on('data', async (data) => {
 let volume = parseInt(calculateVolume(data));
 if (volume > 50 && !isRecording) {
 console.log('You are talking.');
 await recordAudio(audioFilename);
 } else {
 setTimeout(async () => {
 console.log('You are quiet.');
 micInstance.stop();
 console.log('Finished recording');
 const transcription = await transcribeAudio(audioFilename);
 console.log('Transcription:', transcription);
 setTimeout(async () => {
 await askAI(transcription);
 }, 5000);
 }, 5000);
 }
});

function calculateVolume(data) {
 let sum = 0;

 for (let i = 0; i < data.length; i += 2) {
 const sample = data.readInt16LE(i);
 sum += sample * sample;
 }

 const rms = Math.sqrt(sum / (data.length / 2));

 return rms;
}

// TRANSCRIBE
function recordAudio(filename) {
 const micInputStream = micInstance.getAudioStream();
 const output = fs.createWriteStream(filename);
 const writable = new Readable().wrap(micInputStream);

 console.log('Listening...');

 writable.pipe(output);

 micInstance.start();

 micInputStream.on('error', (err) => {
 console.error(err);
 });
}

// Transcribe audio
async function transcribeAudio(filename) {
 const transcript = await openai.createTranscription(
 fs.createReadStream(filename),
 "whisper-1",
 );
 return transcript.data.text;
}

// CHAT
async function askAI(text) {
 let completion = await openai.createChatCompletion({
 model: "gpt-4",
 temperature: 0.2,
 stream: false,
 messages: [
 { role: "user", content: text },
 { role: "system", content: "Act like you are a rude person." }
 ],
 });

 completion = JSON.stringify(completion.data, null, 2);
 console.log(completion);
}



-
Files dissapearing with ffmpeg recursive conversion
13 août 2014, par CaRoXoI started in askubuntu, asking for a way to convert recursively more than 14K of wma to mp3 extracting the wma files path from a txt file.
There was an answer that could cover my needs, but a bug appears. The first run with some hundreds worked ok. The second, some wma albums got converted, others entirely deleted. There were some modifications. And last time completely, deleted all wma without converting.this was the original script
#!/usr/bin/env bash
readarray -t files < wma-files.txt
for file in "${files[@]}"; do
out=`echo $file | sed "s:wma:mp3:"`
probe=`avprobe -show_streams "$file" 2>/dev/null`
rate=`echo "$probe" | grep "bit_rate" | sed "s:.*=\(.*\)[0-9][0-9][0-9][.].*:\1:"`
avconv -i "$file" -ab "$rate"k "$out"
rm "$file"
doneThen the adaptation with ffmpeg
#!/usr/bin/env bash
readarray -t files < wma-files.txt
for file in "${files[@]}"; do
out=`echo $file | sed "s:wma:mp3:"`
probe=`avprobe -show_streams "$file" 2>/dev/null`
rate=`echo "$probe" | grep "bit_rate" | sed "s:.*=\(.*\)[0-9][0-9][0-9][.].*:\1:"`
ffmpeg -i "$file" -ab "$rate"k "$out" && rm "$file"
doneWith the first one I converted many files. Other just get deleted. The ones deleted were always the same release (so, all tracks from a release). I can listen, and even convert them with Soundkonverter.
Both of them produces "no such file of directory" and when this happens, everything get deleted.
The partition where files are stored is a usb HDD ntfs, but also happens in my ext4 internal HD.
Im under Xubuntu 14.04Here the script running with avconv (wich what i managed to convert some, but other get dissapeared) http://pastebin.com/w5weqEws and with ffmpeg (that didn’t convert any) http://pastebin.com/3QkaPzvW
I can’t find differences between successfully and deleted original wma’s. But for example, while other progs like beets read and write the tags, puddletag and mp3tag (under wine) don’t, until I converted them with soundkonverter.
As the person trying to help me there redirect me here on the original post http://askubuntu.com/questions/508278/how-to-use-ffmpeg-to-convert-wma-to-mp3-recursively-importing-from-txt-file/508304#508304
Im here asking for any help to make run an script like this. Or any to use ffmpeg to convert recursively the audio files. My capacity of understanding is short for being able to make something working just reading the docs.So I ask a help to run this. If I miss any relevant information, just tell me.
NOTE : I want to add that doing the conversion with
for file in "${files[@]}"; do
out=`echo "$file" | sed s:wma:mp3:`
avconv -i "$file" -ab 192k "$out"
rm "$file"
doneIt works in the same files (the ones that are deleted with the other). Only that it makes everything to 192k, so not good if Im converting lower bitrate ones. And get this error "Application provided invalid, non monotonically increasing dts to muxer in stream 0" that seems something typical from avconv in 14.04. With ffmpeg I cant try becouse I don’t find the way how to use it, even out of the script. I really don’t understand the docs seems
.NOTE2 : This is a mediainfo exit from :
1- A typical wma that get dissapeared always with the script
Audio
ID : 1
Format : WMA
Format version : Version 2
Codec ID : 161
Codec ID/Info : Windows Media Audio
Description of the codec : Windows Media Audio 9 - 128 kbps, 44 kHz, stereo 1-pass CBR
Duration : 2mn 25s
Bit rate mode : Constant
Bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 2.21 MiB (99%)
Language : English (US)2- A Wma that got succesfully converted (yes Im using copies now, I cant risk specially some rares audios that I got on the road)
Audio
ID : 1
Format : WMA
Format version : Version 2
Codec ID : 161
Codec ID/Info : Windows Media Audio
Description of the codec : Windows Media Audio 9 - 128 kbps, 44 kHz, stereo 1-pass CBR
Duration : 4mn 35s
Bit rate mode : Constant
Bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 4.21 MiB (99%)
Language : English (US)So, as I don’t see difference, but maybe, I’m losing any data to look into ?