-1

I'm working on the sound part of an interactive installation that would need an event to be triggered by osc an undefined number of times, making the sound linked to it overlaps instead of being rewinded and started again.

Would it be possible to do that without needing to make an array of loadings of the same sound?

I'm actually trying to do it with processing and minim library. Do you think it would be easier to achieve it with another programming software? I've found myself in the same difficulties trying to do it with puredata. Any tip or clue would be extremely welcome.

Thanks a lot.

rojele
  • 80
  • 7

2 Answers2

2

You will need multiple readers ([tabread~] resp [tabplay~] in Pd; i don't know about Processing/minim, but the same principle applies) to read the table multiple times (in parallel), where each one can be started separately.

However, you only need a single instance of your data array (e.g. [table]), as the various readers can access the same array independently.

umläute
  • 28,885
  • 9
  • 68
  • 122
  • Hi, thanks for the info. Finally that's what I've done in pd: Built different readers using [tabread4~] with [phasor~] for accessing independently from a single audioarray [table], each one of them with a control int for checking if they are actually reading the sound. In the moment where the osc message comes in, it iterates over the different control ints searching for the first one that is not being readen, and therefore reads the array with that first not used reader. Thanks! – rojele Oct 18 '21 at 10:30
  • 1
    typically you would use `[poly]` for assigning notes to voices – umläute Oct 18 '21 at 14:51
1

Can you use Java libraries in Processing? Processing is built on Java, yes?

If you can, I have a library you can use, supporting a class I call AudioCue available via github. This is modeled on a Java Clip but with additional capabilities. It allows multiple, concurrent playback. AudioCue also has real time controls for volume, panning and playback speed, in case you want to play around with adding some more interactivity to your installation.

I would love to know if it can be used with Processing. Please follow up with me if you try this route. I'd like to see it done, and can possibly assist.

If Processing allows you to send PCM directly out for playback, then the basic algorithm is the store the audio data in an array, and create pointers or cursors (depending on your preferred terminology) that independently iterate through that array. This is the main basis of the algorithm I use for AudioCue, with the PCM being routed out via a Java SourceDataLine.

Phil Freihofner
  • 7,645
  • 1
  • 20
  • 41
  • Hi! Sorry but I can not even import it into procesing. import AudioCue.*; just doesn't work, so I ignore how to start trying to use it. Any idea? Would love to try it, if not for this one, maybe for future projects. Thanks! – rojele Oct 18 '21 at 09:11
  • I'd have to learn more about what you tried to find out if it failure was due to Processing/Java incompatibilities or to the syntax of the import statement. If you extract just the five java files (AudioCue.java, AudioCueInstanceEvent.java, AudioCueListener.java, AudioMixer.java, AudioMixerTrack.java), you can then edit their package names to match the package name where you locate them within your IDE. What is your IDE and package structure? – Phil Freihofner Oct 18 '21 at 21:17
  • Hi, Phil. As you said, I have now the five .java files in a folder named AudioCue in the libraries folder of processing3 windows. When writting import AudioCue.*; even this line shows an error: The package “AudioCue” does not exist. You might be missing a library. Any idea? Maybe is that you need a "library.properties" file? Thanks for your time! – rojele Oct 19 '21 at 18:12
  • I've never used Processing and I don't know anything about the Processing IDE. The code in the five files is all core java. You might be able to just manually make five classes/interfaces with the same names and copy the code in, and use it that way. – Phil Freihofner Oct 19 '21 at 19:10