Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (42)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (11260)

  • h264 : codec reinit : remove statements without effect

    18 avril 2014, par Janne Grunau
    h264 : codec reinit : remove statements without effect
    

    avctx->coded_height,width will always equal h->height,width since
    init_dimensions() does that explicitly, Size changes are detected by
    changes in mb_height,width earlier and propagated through the
    needs_reinit variable.

    • [DBH] libavcodec/h264_slice.c
  • Anomalie #4008 (Fermé) : sauvegarde partielle du site via maintenance : une table meta est importé...

    10 février 2021, par cedric -

    ah oui c’est la structure des tables exportées, on en a besoin quand on doit reimporter (si par exemple certains plugins sont absents et des champs manquent)

  • The problem with the AudioDispatcher, the analysis in audioDispatcherFactory is not running, TarsosDSP

    4 février, par roman_gor_

    I'm making an application for sound analysis and spotlight control. The colors of the spotlight change to the beat of the music. I use the TarsosDSP library for this, additionally downloaded the FFmpeg-Kit library to convert audio to WAV format, PCM 16L to work with audioDispatcher.
The problem is that when audio is transmitted in the correct format, dispatcher starts and immediately ends. The boolean Process method is not executed, but the process Finished() method is executed. I found out that the stream starts, the file is not empty, it is converted to the correct format, BUT the getFrameLength() method, when interacting with the AudioStream to which I pass the filePath, returns the file path value -1, that is, in fact, it is not filled in. I've already searched through everything, and the github library code, and all the neural networks, I don't know how to solve this issue. The problem is with AudioDispatcher and AudioDispatcherFactory.from Pipe() ?

    


    private void playAndAnalyzeAudio(String filePath, Uri uri)
    {
        if (mediaPlayer != null)
            mediaPlayer.release();
        mediaPlayer = MediaPlayer.create(requireContext(), uri);

        new Thread(() -> {
            extractAudio(inputFilePath, outputFilePath);
            getActivity().runOnUiThread(() -> {
                mediaPlayer = MediaPlayer.create(requireContext(), uri);
                if (mediaPlayer != null) {
                    mediaPlayer.start(); // Start music after analyze
                    startSendingData(); // Start data sending
                }
            });
        }).start();
    }

    private void analyzeAudio(String filePath)
    {
        try {
            AudioDispatcher audioDispatcher = AudioDispatcherFactory.fromPipe(filePath, 44100, 1024, 0);
            MFCC mfcc = new MFCC(1024, 44100, 13, 50, 20, 10000);
            audioDispatcher.addAudioProcessor(mfcc);
            Log.d("AUDIO_ANALYSIS", "Начинаем анализ аудиофайла..." + audioDispatcher);
            audioDispatcher.addAudioProcessor(new AudioProcessor() {
                @Override
                public boolean process(AudioEvent audioEvent) {
                    Log.d("AUDIO_ANALYSIS", "Обрабатываем аудио...");

                    float[] amplitudes = audioEvent.getFloatBuffer();
                    Log.d("AUDIO_ANALYSIS", "Размер буфера: " + amplitudes.length);

                    float[] mfccs = mfcc.getMFCC();
                    if (mfccs == null) {
                        Log.e("AUDIO_ANALYSIS", "MFCC не сгенерировался!");
                        return true;
                    }

                    float currentBass = mfccs[0] + mfccs[1];
                    float totalEnergy = 0;
                    for (float amp : amplitudes) {
                        totalEnergy += Math.abs(amp);
                    }

                    Log.d("AUDIO_ANALYSIS", "Bass Energy: " + currentBass + ", Total Energy: " + totalEnergy);

                    if (currentBass > BASS_THRESHOLD || totalEnergy > ENERGY_THRESHOLD) {
                        changeColor();
                        Log.d("SONG", "Color wac changed on a : " + currentColor);
                        brightness = MAX_BRIGHTNESS;
                    } else {
                        brightness *= 0.9f;
                    }

                    return true;
                }

                @Override
                public void processingFinished() {
                    getActivity().runOnUiThread(() -> Toast.makeText(requireContext(), "Анализ завершён", Toast.LENGTH_SHORT).show());
                }
            });
            File file = new File(filePath);
            if (!file.exists() || file.length() == 0) {
                Log.e("AUDIO_ANALYSIS", "Error: file is empty! " + filePath);
                return;
            } else {
                Log.d("AUDIO_ANALYSIS", "File is, size: " + file.length() + " byte.");
            }
            Log.d("AUDIO_ANALYSIS", "Start of analyzing: " + filePath);
            File ffmpegFile = new File(getContext().getCacheDir(), "ffmpeg");
            if (!ffmpegFile.setExecutable(true)) {
                Log.e("AUDIO_ANALYSIS", "You don't have any roots for ffmpeg!");
            }
            else
                Log.e("AUDIO_ANALYSIS", "You have roots for ffmpeg!");

            new Thread(() -> {
                Log.d("AUDIO_ANALYSIS", "Start dispatcher...");
                audioDispatcher.run();
                Log.d("AUDIO_ANALYSIS", "Dispatcher end.");
            }).start();
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText(requireContext(), "Error of analyzing", Toast.LENGTH_SHORT).show();
        }
    }
public void extractAudio(String inputFilePath, String outputFilePath) {
        File outputFile = new File(outputFilePath);
        if (outputFile.exists()) {
            outputFile.delete();  // Удаляем существующий файл
        }
        // Строим команду для извлечения аудио
        String command = "-i " + inputFilePath + " -vn -acodec pcm_s16le -ar 44100 -ac 2 " + outputFilePath;

        // Используем FFmpegKit для выполнения команды
        FFmpegKit.executeAsync(command, session -> {
            if (session.getReturnCode().isSuccess()) {
                Log.d("AUDIO_EXTRACT", "Аудио извлечено успешно: " + outputFilePath);
                analyzeAudio(outputFilePath);  // Продолжаем анализировать аудио
            } else {
                Log.e("AUDIO_EXTRACT", "Ошибка извлечения аудио: " + session.getFailStackTrace());
            }
        });
    }


    


    Sorry about the number of lines, i tried to describe the problem very detailed.
I tried to change AudioDispatcherFactory.fromPipe() on a AudioDispatcherFactory.fromFile(), but this method don't available in Android, only in Java, how i see the error "Javax.sound..., unexpected error, method don't available"
I tried to change String command in executeAudio() method, to change arguments of fromPipe() method, but in did not to bring success.
I want that my audio file will be correct analyze with audiodispatcher and then, that data from analyze will be transfered to arduino. Now in Logs I see "Color : null, value : 0.0.