Loop doesn't loop
Tried to use this example from the documentation with a .wav file in Processing 3.0 on OS X. It plays once and doesn't loop - no errors.
Mr. Lambert! I just ran this code with the Sound library 1.3.1 on Processing 3.0 and it worked fine. I tried with an AIFF, WAV, and OGG. Maybe you are using an older version of the Sound library or there is something different about your file? Could you post the file for testing.
Mr. Reas! My Sound library was out of date, but I just updated it and tried again. The files I've been trying I posted here. I just tried some other random one on my laptop, so there must be something up with these ones.
Maybe I can add some needed specs for the files to the documentation once I understand what they are...
That's wonderful. I can mechanically add that information to the docs if you sort it out. This is a new issue for me, I haven't experienced files not looping. @wirsing will hopefully have some insight.
I made one of the files a mono mp3 and it worked for me. So it is the file type. I could do some more testing using mediainfo and see what breaks it. Weird that it plays, but doesn't loop.
Ok, for what it's worth, this worked:
General
Complete name : takemain(1).mp3
Format : MPEG Audio
File size : 31.3 KiB
Duration : 2s 194ms
Overall bit rate mode : Variable
Overall bit rate : 115 Kbps
Writing library : LAME3.99.5
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Duration : 2s 194ms
Bit rate mode : Variable
Bit rate : 115 Kbps
Channel(s) : 1 channel
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 30.8 KiB (99%)
Writing library : LAME3.99.5
And this didn't work:
General
Complete name :takemain.mp3
Format : MPEG Audio
File size : 56.3 KiB
Duration : 2s 194ms
Overall bit rate mode : Variable
Overall bit rate : 209 Kbps
Writing library : Lavf55.19.104
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Mode extension : MS Stereo
Duration : 2s 194ms
Bit rate mode : Variable
Bit rate : 209 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 55.9 KiB (99%)
Same problem. Mono worked fine with loop() and when you change the mono file to stereo, then it won't work.
I just experienced this too: loop() fails on a stereo wav file. Converting the file to mono fixed the problem, but mono is kind of a bummer :)
It looks like there's a PR that attempts to fix this issue: https://github.com/processing/processing-sound/pull/69
Setting up loop() as follows worked for me:
file = new SoundFile(this, "YOUR_FILE");
file.play();
file.stop();
file.loop();
#69 has been merged (4fe919033894da2b902db1e7da4fe3cec4983ddc); could someone please test the fix? Thanks!
Not sure if still interested, but I just experienced this problem with a WAV file I created.
@P1P3L1N3's solution fixed it.
I confirmed this issue still happening in 1.3.2. The MP3 file in stereo and VBR format won't able to loop. I converted to mono AND CBR format and it worked.
@P1P3L1N3 solution worked for me too. I'm using Processing 3.3.6 on Windows 10. Worked with files .aiff, .wav and .mp3 directly downloaded from freesound.org