Playing movie clips after after another at volume 0, there's sound for a split second every clip

edited August 2017 in Library Questions

Hi,

i'm struggling to completely mute movie clips. Here's the code (I guess the problem lies in the new_movie() function at the bottom):

import processing.video.*;

Movie movie;
String[] filenames;

void setup() {
  size(640, 480);
  java.io.File folder = new java.io.File(dataPath("C:\\Users\\Marin\\Downloads\\clips"));
  filenames = folder.list();
  frameRate(30);
  new_movie();
}

void draw() {
  if (movie.time() >= movie.duration()) {
    new_movie();
  }

  if (movie.available()) {
    movie.read();
    background(0);
    image(movie, 0, 0);
  }
}

void new_movie() {
  int newmovid = int(random(filenames.length));
  movie = new Movie(this, "C:\\Users\\Marin\\Downloads\\clips\\" + filenames[newmovid]);
  movie.play();
  movie.volume(0);
}

Setting the volume before movie.play() has no effect (the whole clip plays at full volume) and removing the soundtrack from 1000+ mp4 files doesn't sound very optimal.

What should I do?

Thanks!

Answers

  • volume is a float value try .volume(0.0); you can try to set the volume before .play()

  • What OS? I am using Processing 3.3.4 and Win 10 and your code works as advertised. No sound while the movie is playing. I removed line 30 and sound is there.

    Kf

  • What OS?

    filenames suggest windows

  • Hi, thanks for your answers! .volume(0.0) doesn't make any difference and setting it before play() doesn't work (see here).

    I'm using Processing 3.2.3 on Windows 10. I will try to upgrade and report back.

  • Still no change with Processing 3.3.5.

  • You can create a ticket in GitHub describing your issue. However, keep in mind if they cannot reproduce the problem, then it is very unlikely it will be solved any time soon. Another suggestions, if you haven't tried, is to user other movies, other movie formats, or even remove the sound of the movie (as a temporal fix). I could guess this could also be due to your sound card. Try in another Windows machine if you can.

    Kf

  • Hey,

    the workaround that i'm using now is calling movie.playbin.setVolume(0) before movie.play(). It works for me. Thank you all for your help!

  • Thxs for sharing your solution.

    Kf

Sign In or Register to comment.