hello,

i’m new to bela and quite new to programming in general, and would love some help with a simple puredata patch i’m making. the problem i can’t solve is how to disable audio files from looping. i've tried to search for help and figuring it out myself, but i can't seem to get there.

the project is a basic 4 channel installation, with a button that triggers four audio files. i’m using the bela mini with the multichannel expander.

i’ve successfully combined two example patches that are provided in the ide – ‘examples/multichannel/pd-multi-sample-player’ and ‘examples/puredata/digital-input’ . the button works and plays the wav files, all routed to separate outputs as intended. however, they loop.

looking in the playAudioFile~ object, i can’t quite make sense of it. any help explaining what makes them loop would be greatly appreciated!

i've attached two screenshots, of playAudioFile~ and playRetrig:

alt text

alt text

In that patch, the samples are looping because of the [metro 700] in the main patch. This drives a counter between 0 and 7 whose output is sent to the various [r clock] objects, which in turn are patched to a [select X], where X is the channel you want to start playing back on. his patch is rather complex in that it cycles through the various channels and it allows to change the pitch and so it uses [tabread~] and a [phasor~]. If all you cared about was playing back files at the original speed following the press of a button, you could use something much simpler. E.g.:

alt text

The seemingly complicated stuff on the right hand side is only to quickly N files called somethingX.wav into N arrays called arrayX, but you could make it simpler.

    giuliomoro hey, thanks a lot for your quick and detailed reply!
    however, i've removed the metro part from my patch, and it's still looping the wav file playback. this is what my main patch looks like:
    alt text

      been working on this all day, and finally got it working the way i wanted to.
      however, now another problem has appeared : )
      my files seem to be too big. first i got truncate messages, then i changed maxsize in soudfiler, now it get "pd: resizebytes() failed -- out of memory
      error: resize failed".

      does the playAudioFile~ subpatch buffer audio in some way to work with bigger files? or would you recommend using c++ instead, starting with the sample-streamer example code? thanks for your time!

      If the files don't fit in ram you should use [readsf~] instead, which streams files from disk to memory

      2197 it's still looping the wav file playback.

      Because the original patch was always looping (as it used phasor to read the wavetable) but the sound of the repetitions was muted by a gate with soft transients implemented with a line~ object.
      The example I provided used tabplay~ so it didn't have this issue

      • 2197 replied to this.

        giuliomoro [readsf~]

        thank you so much! this solved all my problems. the final patch ended up a lot less complicated than my first endeavours and now it all runs smoothly.

        follow up question: i'm working on a future project with the ctag beast, where it will be used as a simple wav file player. it's a 16 channel sound piece, with audio files are that are just under an hour long.
        do you reckon i can use the readsf~ object to handle this as well? or would that be too much data to stream from the sd card?

        thanks again!

          2197 do you reckon i can use the readsf~ object to handle this as well? or would that be too much data to stream from the sd card?

          I think it should be fine. I used more than that in the past. You can try it out on your current hardware: use 16 readsf running in parallel mixed down to stereo

          • 2197 replied to this.

            giuliomoro great, thank you. good idea to try it mixed down to stereo first.